Linux IOMMU Development
 help / color / mirror / Atom feed
From: Pranjal Shrivastava <praan@google.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Nicolin Chen <nicolinc@nvidia.com>,
	iommu@lists.linux.dev, Will Deacon <will@kernel.org>,
	Joerg Roedel <joro@8bytes.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Mostafa Saleh <smostafa@google.com>,
	Samiullah Khawaja <skhawaja@google.com>,
	Daniel Mentz <danielmentz@google.com>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	David Matlack <dmatlack@google.com>
Subject: Re: [PATCH rc v2] iommu/arm-smmu-v3: Fix inconsistent ATS state tracking
Date: Mon, 11 May 2026 12:07:04 +0000	[thread overview]
Message-ID: <agHGaJfwPr7-F1z2@google.com> (raw)
In-Reply-To: <20260509171451.GG9285@ziepe.ca>

On Sat, May 09, 2026 at 02:14:51PM -0300, Jason Gunthorpe wrote:
> On Wed, May 06, 2026 at 10:04:38PM +0000, Pranjal Shrivastava wrote:
> 
> > [1] https://elixir.bootlin.com/linux/v7.0.1/source/drivers/pci/quirks.c#L5703
> 
> The quirk is broken. It clearly says the device has mis-implemented
> the ATS invalidation message so ATS must *NEVER* be enabled.
> 

I agree that the ATS must never be enable on this device. 

> Thus the quirk should cover the VFs too and also disable ATS there.

I observe the quirk does apply VFs but after the VF's iommu attach
because of how the pci_iov_add_virtfn() is written:

int pci_iov_add_virtfn(...)
{

	...
	pci_device_add(virtfn, virtfn->bus); // <------ This is where the iommu attach happens within device_add()
	rc = pci_iov_sysfs_link(dev, virtfn, id);
	if (rc)
		goto failed1;

	pci_bus_add_device(virtfn); // <---- This is where the quirk gets applied

}

i.e. in pci_device_add it calls pci_fixup_device(pci_fixup_header, dev)
whereas this ATS quirk is of `pci_fixup_final` type & gets applied within
pci_bus_add_device(). 

While, we can move this quirk to be in fixup_early / fixup_header.
I still think we should add checking the PF->ats_cap within 
pci_ats_supported before bailing out happily (return 0) for VFs.

> So I still think my original suggestion is appropriate, fail to probe
> the iommu device if ats prepare fails (serious PCI layer bug, like
> broken quirks) and fail to attach the domain of ats enable fails
> (serious internal kernel malfunction since enable must succeed if
> prepare succeeded)

I’m concerned that refusing to attach a device because it isn't ATS 
capable is bit too aggressive.

Even if pci_enable_ats() fails, the device is still perfectly capable of
performing standard DMA. We should allow the IOMMU attach to succeed but
in a 'Degraded' mode—where ATS is disabled for all it's functions, i.e. 
configured to treat it as a standard non-ATS device.

Thanks,
Praan

  reply	other threads:[~2026-05-11 12:07 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04 16:38 [PATCH rc v2] iommu/arm-smmu-v3: Fix inconsistent ATS state tracking Pranjal Shrivastava
2026-05-04 18:01 ` Nicolin Chen
2026-05-04 19:33   ` Pranjal Shrivastava
2026-05-04 20:03     ` Pranjal Shrivastava
2026-05-04 20:23     ` Nicolin Chen
2026-05-04 20:29       ` Pranjal Shrivastava
2026-05-04 20:51         ` Nicolin Chen
2026-05-04 20:40       ` Pranjal Shrivastava
2026-05-04 20:54         ` Nicolin Chen
2026-05-05 16:11     ` Jason Gunthorpe
2026-05-05 20:21       ` Nicolin Chen
2026-05-05 21:23         ` Pranjal Shrivastava
2026-05-05 21:44           ` Nicolin Chen
2026-05-05 22:06             ` Pranjal Shrivastava
2026-05-06 20:44         ` Samiullah Khawaja
2026-05-05 21:14       ` Pranjal Shrivastava
2026-05-05 22:32         ` Pranjal Shrivastava
2026-05-06  9:46           ` Jason Gunthorpe
2026-05-06 20:19             ` Pranjal Shrivastava
2026-05-06 22:03               ` Pranjal Shrivastava
2026-05-06 21:57             ` Pranjal Shrivastava
2026-05-06 22:04               ` Pranjal Shrivastava
2026-05-09 17:14                 ` Jason Gunthorpe
2026-05-11 12:07                   ` Pranjal Shrivastava [this message]
2026-05-11 14:16                     ` Jason Gunthorpe
2026-05-11 16:07                       ` Pranjal Shrivastava
2026-05-11 16:30                         ` David Matlack
2026-05-11 16:57                           ` Pranjal Shrivastava
2026-05-11 17:03                         ` Jason Gunthorpe
2026-05-06 22:20               ` Samiullah Khawaja
2026-05-07 20:12                 ` Pranjal Shrivastava

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=agHGaJfwPr7-F1z2@google.com \
    --to=praan@google.com \
    --cc=danielmentz@google.com \
    --cc=dmatlack@google.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=nicolinc@nvidia.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=robin.murphy@arm.com \
    --cc=skhawaja@google.com \
    --cc=smostafa@google.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