From: Daniel Drake <dan@reactivated.net>
To: Jason Gunthorpe <jgg@ziepe.ca>, Robin Murphy <robin.murphy@arm.com>
Cc: "Joerg Roedel (AMD)" <joro@8bytes.org>,
Will Deacon <will@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
nick.hollinghurst@raspberrypi.com
Subject: Re: [PATCH v2 4/5] iommu: Add Broadcom BCM2712 IOMMU driver
Date: Sun, 16 Aug 2026 13:50:32 +0100 [thread overview]
Message-ID: <abc25cfd-0c7d-4719-b6af-9034c87e9f88@reactivated.net> (raw)
In-Reply-To: <d6bb859e-c1e7-428e-b765-7b471e1ce005@reactivated.net>
On 31/07/2026 21:22, Daniel Drake wrote:
> The aperture could be placed anywhere, but the key idea in the current
> driver structure is that we deliberately place it above physical memory,
> so that we can have the bypass window operational for all regular
> physical addresses, meaning that iommu-unaware devices can operate as
> normal.
>
> Each of the 3-4 IOMMUs has around 5 devices hardwired into it. When the
> IOMMU is switched on (effectively via setting CTRL_OPERATING_FLAGS),
> *all* of the hardwired devices are subject to the IOMMU operation,
> uniformly. There is no gating where you can have one of the devices in
> standard passthrough mode and the rest using the IOMMU. Also there is no
> Stream ID in the transactions, there is no way to configure per-device
> page tables.
>
> Among the devices hardwired to the IOMMUs we might have:
> - Devices already set up by the firmware and relying on regular access
> to physical memory
> - Devices that don't require large contiguous DMA allocations and would
> prefer not to have the translation overhead of the iommu
> - Devices that handle scatter-gather natively and prefer not to have
> the translation overhead of the iommu
> - & devices that want to use the IOMMU :) so that they can work with
> large contiguous allocations which are actually scattered in
> underlying physical memory
>
> So we have multiple needs to tend to, which is why the driver currently
> sets up the bypass in the regular address space (serving the first 3
> above), and the IOMMU aperture in a high, unused part of the address
> space (for the devices that do want to take advantage of the IOMMU).
>
> Are those good enough reasons to set up the driver in this way? Or are
> there other approaches to consider?
Reading the thread again I'm sensing that it would be preferred to go
with a more conventional IOMMU setup, rather than trying to cover all of
the above in a single configuration.
For the next revision I am thinking:
1. Paging domain has the aperture at address 0, without bypass/identity
region i.e. some degree of memory protection is present
2. Identity domain is complete iommu bypass (as-is)
This allows the system admin to choose between the iommu benefits (and
associated minor overhead) OR the non-iommu bypass mode. That choice
would apply to all of the devices hardwired to the iommu in question --
we wouldn't attempt to support mixing identity and paging approaches at
the same time as was originally proposed.
Regarding devices set up by the firmware that require ongoing access to
RAM, of which the display controller is probably the only case, we can
use the existing mechanism that allows the firmware to communicate such
requirements.
The iommu driver will do:
.get_resv_regions = iommu_dma_get_resv_regions,
Then on the DT side, I would ask Raspberry Pi to provide a firmware
adjustment in future versions. It already dynamically programs the
framebuffer as a memreserve property, a hole in the memory map and as a
simple-framebuffer node. We would need this additionally programmed as
reserved-memory:
reserved-memory {
fw_fb: framebuffer@3f800000 {
reg = <0x0 0x3f800000 0x0 0x800000>;
iommu-addresses = <&vc4 0x0 0x3f800000 0x0 0x800000>;
};
}
and also a link back from vc4:
vc4: gpu {
memory-region = <&fw_fb>;
};
This will cause the iommu driver to set up the initial page tables with
the above memory region as an identity mapping. This is done before
paging mode is activated, so once the iommu is actually switched on, the
display controller will enjoy uninterrupted access to that framebuffer.
Let me know if anything sounds off!
Daniel
next prev parent reply other threads:[~2026-08-16 12:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 20:43 [PATCH v2 0/5] Add support for Broadcom BCM2712 IOMMU driver (Raspberry Pi 5) Daniel Drake
2026-07-27 20:43 ` [PATCH v2 1/5] generic_pt: allow missing sw bit in DMA_INCOHERENT case Daniel Drake
2026-07-27 20:43 ` [PATCH v2 2/5] dt-bindings: iommu: Add Broadcom BCM2712 IOMMU Daniel Drake
2026-07-30 6:59 ` Krzysztof Kozlowski
2026-07-27 20:43 ` [PATCH v2 3/5] iommu/generic_pt: Add Broadcom BCM2712 page table format Daniel Drake
2026-07-27 20:43 ` [PATCH v2 4/5] iommu: Add Broadcom BCM2712 IOMMU driver Daniel Drake
2026-07-28 10:51 ` Robin Murphy
2026-07-29 0:10 ` Jason Gunthorpe
2026-07-29 11:21 ` Robin Murphy
2026-07-31 20:22 ` Daniel Drake
2026-08-16 12:50 ` Daniel Drake [this message]
2026-08-16 16:57 ` Jason Gunthorpe
2026-07-30 7:00 ` Krzysztof Kozlowski
2026-07-31 20:34 ` Daniel Drake
2026-08-01 9:15 ` Krzysztof Kozlowski
2026-08-03 10:53 ` Nick Hollinghurst
2026-07-27 20:44 ` [PATCH v2 5/5] arm64: dts: broadcom: bcm2712: Add GPU IOMMU and IOMMU cache nodes Daniel Drake
2026-07-28 22:57 ` [PATCH v2 4/5] iommu: Add Broadcom BCM2712 IOMMU driver Jim Quinlan
2026-08-19 19:22 ` Daniel Drake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=abc25cfd-0c7d-4719-b6af-9034c87e9f88@reactivated.net \
--to=dan@reactivated.net \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=nick.hollinghurst@raspberrypi.com \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox