[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260105185423.GI125261@ziepe.ca>
Date: Mon, 5 Jan 2026 14:54:23 -0400
From: Jason Gunthorpe <jgg@...pe.ca>
To: Robin Murphy <robin.murphy@....com>
Cc: Dawei Li <dawei.li@...ux.dev>, will@...nel.org, joro@...tes.org,
linux-arm-kernel@...ts.infradead.org, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, set_pte_at@...look.com,
stable@...r.kernel.org
Subject: Re: [PATCH] iommu/arm-smmu-v3: Maintain valid access attributes for
non-coherent SMMU
On Mon, Jan 05, 2026 at 04:02:34PM +0000, Robin Murphy wrote:
> > It is reasonable that Linux will set the attributes properly based on
> > what it is doing. Setting the wrong attributes and expecting the HW to
> > ignore them seems like a hacky direction.
>
> Oh, I'm not saying that we *shouldn't* set our attributes more exactly -
> this would still be needed for doing things the "right" way too - I just
> want to be very clear on the reasons why.
At least I know of HW where the SMMU fetches covered by COHACC:
* Translation table walks.
* Fetches of L1STD, STE, L1CD and CD.
* Command queue, Event queue and PRI queue access.
* GERROR, CMD_SYNC, Event queue and PRI queue MSIs, if supported.
Have a mixture of coherency support. The SOC has multiple fabrics, one
non-coherent one specifically for isochronous traffic. In HW some
SMMU sub-units (like the table walk) been wired to the isochronous
fabric, while others are using the normal coherent fabric.
So when it comes to this statement:
If either the SMMU or system cannot *fully* support IO-coherent
access to SMMU structures/queues/translations, this reads as 0.
The HW is "partially" IO-coherent, so COHACC is 0.
It has been lucky that so far the incorrect attributes haven't caused a
problem, but the next spin of this HW may have issue here. I'd like to
see it fixed.
> bug per se, and although it's indeed not 100% robust, the cases where it
> doesn't hold are more often than not for the wrong reason. Therefore I would
> say doing this purely for the sake of working around bad firmware - and
> especially errata - is just as hacky if not more so.
Yeah, maybe, I am also curious what is motivating Dawei to do this work..
> the DMA API aspect I mean is that in
> general we need some sort of DMA_ATTR_NO_SNOOP when mapping/allocating such
> isochronous buffers/pagetables etc., to make the DMA layer still do the
> cache maintenance/non-cacheable remaps despite dev_is_dma_coherent() being
> true.
I have a feeling this missing support underlies some of the reasons
why FW might lie and set COHACC=0 as it resolves "how does the GPU
driver cache flush things" with no effort..
Jason
Powered by blists - more mailing lists