[PATCH v2 0/5] Add support for Broadcom BCM2712 IOMMU driver (Raspberry Pi 5)
Daniel Drake <[email protected]> Mon, 27 Jul 2026 21:43:55 +0100
| Newsgroups | dev.linux.lists.iommu,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Hi, This series adds a driver for the Broadcom BCM2712 IOMMU found on Raspberry Pi 5, and hooks up the display controller IOMMU for efficient management of graphics memory. This is adapted from the downstream driver from Raspberry Pi (original author Nick Hollinghurst), with main changes: - Implement the page table management using generic_pt - Implement brcm,iommu-cache as standards-compliant DT property, while maintaining compatibility with existing shipped RPi firmware - Drop the dma-iova-offset hack, used to work around some issue seen with dma-ranges. This will need to be investigated separately and solved properly. (It's not needed for display controller iommu support included here.) - Misc simplifications/standardisations/cleanups The IOMMU works strictly with 4KB pages. This means that unfortunately when the kernel is compiled with PAGE_SIZE=16KB (the Raspberry Pi 5 kernel default), 12KB is wasted in each page that is allocated for page tables. I plan to address this in followup work. It has been tested on Raspberry Pi 5 using a 3D-accelerated graphical environment which causes plenty of IOMMU maps & unmaps. Feedback and testing welcome! Changes in v2: - Use iommu_fwspec in xlate & probe_device - Add blocked_domain support - Simplify page size configuration between iommu driver and format - Introduce PT_FEAT_NO_SW_BIT flag to allow formats to explicitly opt-in to a defensive flushing algorithm when no sw bit is available - Implement 4MB pages at Level 1; this is more efficient and means the "allow full-table contiguous leaves in unit tests" commit has been dropped because it is no longer needed. - Hardcode the aperture in an unused part of the address space, removing it from DT (it's a software-specific decision, not an attribute of the hardware), adding more explanatory comments - Use pt_full_va_prefix to have the PT format operate within the aperture space, enabling use of IOMMU_PT_DOMAIN_OPS - Add more dt-bindings explanation to brcm,iommu-cache and drop docs around the cache property used in RPi firmware (the driver still supports this however, for fw compat reasons) - Correct iommu device address in bcm2712.dtsi - Link to v1: https://lore.kernel.org/r/[email protected] --- Daniel Drake (5): generic_pt: allow missing sw bit in DMA_INCOHERENT case dt-bindings: iommu: Add Broadcom BCM2712 IOMMU iommu/generic_pt: Add Broadcom BCM2712 page table format iommu: Add Broadcom BCM2712 IOMMU driver arm64: dts: broadcom: bcm2712: Add GPU IOMMU and IOMMU cache nodes .../bindings/iommu/brcm,bcm2712-iommu.yaml | 48 ++ .../bindings/iommu/brcm,bcm2712-iommuc.yaml | 35 ++ arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 14 + drivers/iommu/Kconfig | 15 + drivers/iommu/Makefile | 1 + drivers/iommu/bcm2712-iommu-cache.c | 73 +++ drivers/iommu/bcm2712-iommu.c | 582 +++++++++++++++++++++ drivers/iommu/bcm2712-iommu.h | 26 + drivers/iommu/generic_pt/.kunitconfig | 1 + drivers/iommu/generic_pt/Kconfig | 10 + drivers/iommu/generic_pt/fmt/Makefile | 2 + drivers/iommu/generic_pt/fmt/bcm2712.h | 283 ++++++++++ drivers/iommu/generic_pt/fmt/defs_bcm2712.h | 18 + drivers/iommu/generic_pt/fmt/iommu_bcm2712.c | 8 + drivers/iommu/generic_pt/iommu_pt.h | 13 +- drivers/iommu/generic_pt/pt_fmt_defaults.h | 7 + include/linux/generic_pt/common.h | 13 + include/linux/generic_pt/iommu.h | 12 + 18 files changed, 1156 insertions(+), 5 deletions(-) --- base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff change-id: 20260712-bcm2712-iommu-submit-2e09899e65c4 Best regards, -- Daniel Drake <[email protected]>