[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c1bcd9821a8f8c05@bloch.sibelius.xs4all.nl>
Date: Fri, 26 Mar 2021 18:26:14 +0100 (CET)
From: Mark Kettenis <mark.kettenis@...all.nl>
To: Arnd Bergmann <arnd@...nel.org>
Cc: sven@...npeter.dev, robh@...nel.org,
iommu@...ts.linux-foundation.org, joro@...tes.org, will@...nel.org,
robin.murphy@....com, marcan@...can.st, maz@...nel.org,
mohamed.mediouni@...amail.com, stan@...ellium.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: [PATCH 0/3] Apple M1 DART IOMMU driver
> From: Arnd Bergmann <arnd@...nel.org>
> Date: Fri, 26 Mar 2021 17:38:24 +0100
>
> On Fri, Mar 26, 2021 at 5:10 PM Sven Peter <sven@...npeter.dev> wrote:
> > On Fri, Mar 26, 2021, at 16:59, Mark Kettenis wrote:
> > > Some of the DARTs provide a bypass facility. That code make using the
> > > standard "dma-ranges" property tricky. That property would need to
> > > contain the bypass address range. But that would mean that if the
> > > DART driver needs to look at that property to figure out the address
> > > range that supports translation it will need to be able to distinguish
> > > between the translatable address range and the bypass address range.
> >
> > Do we understand if and why we even need to bypass certain streams?
>
> My guess is that this is a performance optimization.
>
> There are generally three reasons to want an iommu in the first place:
> - Pass a device down to a guest or user process without giving
> access to all of memory
> - Avoid problems with limitations in the device, typically when it
> only supports
> 32-bit bus addressing, but the installed memory is larger than 4GB
> - Protect kernel memory from broken drivers
>
> If you care about none of the above, but you do care about data transfer
> speed, you are better off just leaving the IOMMU in bypass mode.
> I don't think we have to support it if the IOMMU works reliably, but it's
> something that users might want.
Another reason might be that a device needs access to large amounts of
physical memory at the same time and the 32-bit address space that the
DART provides is too tight.
In U-Boot I might want to use bypass where it works since there is no
proper IOMMU support in U-Boot. Generally speaking, the goal is to
keep the code size down in U-Boot. In OpenBSD I'll probably avoid
bypass mode if I can.
I haven't figured out how the bypass stuff really works. Corellium
added support for it in their codebase when they added support for
Thunderbolt, and some of the DARTs that seem to be related to
Thunderbolt do indeed have a "bypass" property. But it is unclear to
me how the different puzzle pieces fit together for Thunderbolt.
Anyway, from my viewpoint having the information about the IOVA
address space sit on the devices makes little sense. This information
is needed by the DART driver, and there is no direct cnnection from
the DART to the individual devices in the devicetree. The "iommus"
property makes a connection in the opposite direction.
Cheers,
Mark
Powered by blists - more mailing lists