[PATCH 0/2] iommu: apple-dart: device specific DMA aperture support
Janne Grunau <[email protected]>
| Newsgroups | dev.linux.lists.asahi,dev.linux.lists.iommu,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Apple DARTs are often connected directly to devices that expect only a portion of their address space to be used for DMA (for example, because other ranges are mapped directly to something else). The USB4 native host controller on M2 Pro/Max/Ultra devices expected to be sent by Sven after v7.3-rc1 requires this. In the Asahi downstream kernel the display controller and ISP require a specified DMA aperture as well. The downstream kernel uses a "apple,dma-range" property in the iommu node to specify the aperture. This is not a good way to describe the aperture as it is not property of the iommu itself but of its connected device. iommu.txt describes this use case as DMA window in its "#iommu-cells = <4>" example. Implement this for DART allowing additionally 5 iommu-cells specifying a 64-bit aperture start and length. 0x100_0000_0000 is a commonly used aperture start and the aperture often spans 36-bit address space. This range *can* be outside of the DART's IAS. In that case, it is assumed that the hardware truncates addresses and the page tables will only map the lower bits of the address. However, the specified range cannot straddle an IAS boundary (you cannot cover more than IAS worth of address space nor wrap). This corresponds to the vm-base and vm-size properties on the Apple device tree side of things. Signed-off-by: Janne Grunau <[email protected]> --- Janne Grunau (2): dt-bindings: iommu: dart: Support specifying the DMA aperture iommu: apple-dart: Support specifying the DMA aperture in the DT .../devicetree/bindings/iommu/apple,dart.yaml | 12 +++-- drivers/iommu/Kconfig | 2 +- drivers/iommu/apple-dart.c | 62 ++++++++++++++++++---- 3 files changed, 61 insertions(+), 15 deletions(-) --- base-commit: 8d3ae59288f1e7d58d76558a6ee96d533bc5019f change-id: 20260819-iommu-apple-dart-aperture-c3b9cc79d7e1 Best regards, -- Janne Grunau <[email protected]>