public inbox for patches@lists.linux.dev
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	David Woodhouse <dwmw2@infradead.org>,
	iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Tomasz Jeznach <tjeznach@rivosinc.com>,
	patches@lists.linux.dev
Subject: Re: [PATCH] iommu/dma: Always allow DMA-FQ when iommupt provides the iommu_domain
Date: Fri, 3 Apr 2026 15:36:01 -0300	[thread overview]
Message-ID: <20260403183601.GK310919@nvidia.com> (raw)
In-Reply-To: <ac-FclRknG4bwipa@willie-the-truck>

On Fri, Apr 03, 2026 at 10:16:34AM +0100, Will Deacon wrote:
> On Wed, Apr 01, 2026 at 10:13:49AM -0300, Jason Gunthorpe wrote:
> > On Wed, Apr 01, 2026 at 01:53:05PM +0100, Robin Murphy wrote:
> > > Note that IOMMU_CAP_CACHE_COHERENCY is also arguably a property of
> > > generic_pt, in as much as all its users are default-coherent with
> > > IOMMU_CACHE implied, but again RISC_V doesn't report that where AMD and
> > > Intel do.
> > 
> > Hmm.. Currently generic_pt doesn't have any idea if IOMMU_CACHE is
> > supported and working in HW. All the implemented formats ignore
> > IOMMU_CACHE entirely, they use IOMMU_MMIO to build any any non-caching
> > PTE.
> > 
> > SMMUv3 will be unlike the other three and needs
> > IOMMU_CAP_CACHE_COHERENCY.  IDK if ARM should be writing non-caching
> > PTEs for non-coherent DMA, it doesn't now..
> 
> Sorry, but I'm not sure I follow here. The driver just honours
> IOMMU_CACHE when writing the ptes and dma_info_to_prot() sets that
> according to whether or not the device is coherent. I'd prefer not to
> have the SMMU driver second-guess the DMA API around what is best for
> the endpoint.

The three drivers using iommupt right now only have two kinds of PTE,
cached and non-cached. IOMMU_MMIO selects the non-cached version
otherwise it is always cached. They don't have the idea of a '0'
value.

ARM does, so it has three kinds of PTE for each stage:
 - 0           -> ARM_LPAE_PTE_MEMATTR_NC or ARM_LPAE_MAIR_ATTR_IDX_NC
 - IOMMU_CACHE -> ARM_LPAE_PTE_MEMATTR_FWB_WB/OIWB or ARM_LPAE_MAIR_ATTR_IDX_CACHE
 - IOMMU_MMIO  -> ARM_LPAE_PTE_MEMATTR_DEV or ARM_LPAE_MAIR_ATTR_IDX_DEV

dma_info_to_prot() does make ARM do sensible things, but the other
arches ignore that and write a cachable IOPTE anyhow.

IOMMU_CAP_CACHE_COHERENCY is supposed to mean that IOMMU_CACHE works
fully in HW, so it should not be true if the iommu HW ignores the
cachable PTE.

Jason

      reply	other threads:[~2026-04-03 18:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 19:30 [PATCH] iommu/dma: Always allow DMA-FQ when iommupt provides the iommu_domain Jason Gunthorpe
2026-03-31  7:47 ` Tian, Kevin
2026-04-01 12:53 ` Robin Murphy
2026-04-01 13:13   ` Jason Gunthorpe
2026-04-03  9:16     ` Will Deacon
2026-04-03 18:36       ` Jason Gunthorpe [this message]

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=20260403183601.GK310919@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=patches@lists.linux.dev \
    --cc=robin.murphy@arm.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tjeznach@rivosinc.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