[PATCH v2 0/4] Fix IOVA allocation in Apple dart iommu after global LMB mem map changes

Janne Grunau j at jannau.net
Mon Nov 11 08:01:50 CET 2024


On Sun, Nov 10, 2024 at 08:52:11PM -0600, Tom Rini wrote:
> On Wed, Nov 06, 2024 at 10:10:08PM +0100, Janne Grunau via B4 Relay wrote:
> 
> > The changes in "Make LMB memory map global and persistent" [1] break
> > mapping DMA memory in the USB xHCI driver when using the apple_dart
> > iommu present on Apple silicon systems.
> > 
> > The IOVA space used by the u-boot driver (low 4GB) and physical memory
> > do not overlap. The physical memory on this systems starts depending on
> > the SoC either at 0x10_0000_0000 or 0x100_0000_0000. It make no sense to
> > manage these distinct regions in a single LMB map. In addition every
> > device has its own iommu and IO address space so sharing a single memory
> > map between all iommu instances is not necessary.
> > 
> > To fix this issue restore the used subset (add, alloc and free) of the
> > previous pointer based LMB interface with "io_" as prefix.
> > 
> > To ensure that low level lmb functions do not use the global LMB
> > variable reorder lib/lmb.c so that the variable is not visible.
> > 
> > Tested with patches from my "Fix device removal order for Apple dart
> > iommu" series [2] to fix a separate issue.
> > 
> > The cosmetic commit has two checkpatch warnings in existing code which I
> > ignored.
> > 
> > [1] https://lore.kernel.org/u-boot/20240826115940.3233167-1-sughosh.ganu@linaro.org/
> > [2] https://lore.kernel.org/u-boot/20241031-iommu_apple_dart_ordering-v1-0-8a6877946d6b@jannau.net/
> > 
> > Signed-off-by: Janne Grunau <j at jannau.net>
> > ---
> > Changes in v2:
> > - added io_lmb_teardown() and use it in dart's remove callback
> > - removed leftover from copy-n-paste in io_lmb_setup() documentation
> > - added Tom's Rb:
> > - Link to v1: https://lore.kernel.org/r/20241101-io_lmb_apple_dart_iommu-v1-0-fe4b9a74d47c@jannau.net
> 
> Sorry for the late reply here, can you please rebase on top of current
> master? A few other changes / clean-ups have gone in and I can't easily
> rebase and confirm the changes right now. Thanks!

done. I redid the cosmetic reorder patch to ensure the other changes to
lib/lmb.c are not inadvertently reverted. Please apply Patch 1 + 2
quickly to avoid the risk of having to do it again.

best regards

Janne



More information about the U-Boot mailing list