Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Daniel Drake <dan@reactivated.net>,
	"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: Wed, 29 Jul 2026 12:21:30 +0100	[thread overview]
Message-ID: <1361ff13-fd24-4ba6-a048-eb2091d989ea@arm.com> (raw)
In-Reply-To: <amlE8rEgryPqrUZd@ziepe.ca>

On 2026-07-29 1:10 am, Jason Gunthorpe wrote:
> On Tue, Jul 28, 2026 at 11:51:04AM +0100, Robin Murphy wrote:
>>> +	ret = pt_iommu_bcm2712_init(&domain->pt, &cfg, GFP_KERNEL);
>>> +	if (ret)
>>> +		goto err;
>>> +
>>> +	/* Set up a default (error) page used to catch illegal reads/writes */
>>> +	domain->default_page = iommu_alloc_pages_sz(GFP_KERNEL, PAGE_SIZE);
>>> +	if (!domain->default_page)
>>> +		goto err;
>>> +
>>> +	domain->base.geometry.aperture_start = BCM2712_APERTURE_BASE;
>>> +	domain->base.geometry.aperture_end = BCM2712_APERTURE_END - 1;
>>> +	domain->base.geometry.force_aperture = true;
>>
>> ...and thus (as things stand) this is a lie :(
> 
> Well, it shouldn't be here, the iommupt core code should be setting
> this from its own internal information. If there is something missing
> to add in the full_va_prefix we should fix it.
> 
> But, AFAIK this is the correct way to declare a page table that has a
> range of IOVA - which I think is what this is doing..

Nope, aperture_start and aperture_end already indicate the range of what 
can be used as translatable IOVAs; force_aperture is supposed to 
indicate whether addresses _outside_ that range are blocked, or may 
still be able to access memory as with a GART-style device.

Heck, a "proper" IOMMU doesn't even have an "aperture", it simply has an 
entire input address space.

>> If you want to operate like an IOMMU, then the translation aperture and the
>> bypass window should really be mutually-exclusive;
> 
> I think it is operating like an iommu..
> 
> It uses generic_single_device_group() so there is only ever one
> translation.

Also like a GART.

> If identity is attached then it clears MMMU_CTRL_OPERATING_FLAGS which
> I guess fully disables the IOVA aperture

Not unlike a GART.

> If paging is attached then it sets MMMU_CTRL_OPERATING_FLAGS and
> places the aperture at 40G. Based on the comments about blocking I
> wonder if the "bypass" even works when paging is on?

Rather like a GART.

> If blocking is attached then it sets MMMU_CTRL_OPERATING_FLAGS with
> some 0 address cap which aborts everything?

Disabling the aperture is also GART-like, but also disabling the bypass 
window would seem the be the exclusively IOMMU-like behaviour there ;)

> It looks to me like some of those comments and choices don't reflect
> what the driver actually does. Since there is only ever one
> translation we never need to be worried about where the aperture is,
> it could be anything so long as the HW gives it priority to bypass.

I'm looking at the BYPASS_START/BYPASS_END stuff, where (assuming that's 
intuitive and not completely misnamed) bcm2712_iommu_attach_dev() sure 
seems to be opening up a giant hole in all paging domains per the commit 
message, thus while they can offer the convenience of IOVA remapping, 
they aren't providing any real memory protection.

Thanks,
Robin.

> Could the aperture be placed at 0 with the bypass fully disabled? Then
> it would basically be a normal iommu.
> 
> Jason



  reply	other threads:[~2026-07-29 11:21 UTC|newest]

Thread overview: 12+ 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 [this message]
2026-07-30  7:00   ` Krzysztof Kozlowski
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

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=1361ff13-fd24-4ba6-a048-eb2091d989ea@arm.com \
    --to=robin.murphy@arm.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=conor+dt@kernel.org \
    --cc=dan@reactivated.net \
    --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=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