From: Jason Gunthorpe <jgg@ziepe.ca>
To: Pranjal Shrivastava <praan@google.com>
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 14:03:33 -0300 [thread overview]
Message-ID: <20260511170333.GS9285@ziepe.ca> (raw)
In-Reply-To: <agH-rkumGS1vX4dv@google.com>
On Mon, May 11, 2026 at 04:07:10PM +0000, Pranjal Shrivastava wrote:
> This is actually a little weird/funny...
>
> For PF: pci_prepare_ats fails as it sees a null ats_cap (quirk applied)
> and fails at pci_ats_supported().
>
> For VF: pci_prepare_ats bails out early if (dev->is_virtfn):
>
> /**
> * pci_prepare_ats - Setup the PS for ATS
> * @dev: the PCI device
> * @ps: the IOMMU page shift
> *
> * This must be done by the IOMMU driver on the PF before any VFs are created to
> * ensure that the VF can have ATS enabled.
> *
> * Returns 0 on success, or negative on failure.
> */
> int pci_prepare_ats(struct pci_dev *dev, int ps)
> {
> u16 ctrl;
>
> if (!pci_ats_supported(dev))
> return -EINVAL;
>
> if (WARN_ON(dev->ats_enabled))
> return -EBUSY;
>
> if (ps < PCI_ATS_MIN_STU)
> return -EINVAL;
>
> if (dev->is_virtfn) <---- THIS
> return 0;
I would check the PF STU here and fail if wrong, like pci_enable_ats()
does. The purpose of prepare is to make the STU right, so it is
completely logical.
> Ideally, in such cases I'd want VFs to fail at pci_ats_supported itself
The quirk should cause pci_ats_supported to fail.
My observation is that pci_prepare_ats() shuld also always fail if it
cannot setup the STU, meaning the VF should do more than just return 0
since enable_ats is doing more.
> if (dev->is_virtfn && !pci_ats_supported(pci_physfn(dev)))
> return false;
>
> OR 2. we could have pci_ats_supported call into some ats quirk helper.
Both of these seem like good options to fix the quirk. The first is
probably OK
> We need pci_ats_supported to fail here because if we contain the failure
> in pci_prepare_ats, we'll see pci_ats_supported return success in attach
> which will make arm_smmu_v3 believe that ATS is supported..
Yes, that's right for the quirk issue.
Jason
next prev parent reply other threads:[~2026-05-11 17:03 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
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 [this message]
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=20260511170333.GS9285@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=danielmentz@google.com \
--cc=dmatlack@google.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=nicolinc@nvidia.com \
--cc=pasha.tatashin@soleen.com \
--cc=praan@google.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