From: sashiko-bot@kernel.org
To: "Pranjal Shrivastava" <praan@google.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v8 3/4] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting
Date: Thu, 04 Jun 2026 18:33:40 +0000 [thread overview]
Message-ID: <20260604183341.15AAC1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260604182116.3179005-4-praan@google.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The newly introduced WARN_ON() in arm_smmu_enable_ats() can be triggered from userspace for a Virtual Function (VF) due to an ignored probe-time error, potentially crashing the kernel.
- [Low] The newly added inline comment and commit message contain factual inaccuracies regarding STE programming and probe-time validation.
--
commit e98cc7d134471b7c205436036caf90a8f69d9088
Author: Pranjal Shrivastava <praan@google.com>
iommu/arm-smmu-v3: Standardize ATS enablement failure reporting
Update arm_smmu_enable_ats() to wrap the pci_enable_ats() call in
WARN_ON(). Since probe-time checks now preclude configuration errors
any failure during hardware enablement is considered a kernel bug.
> Since probe-time checks now preclude configuration errors
> any failure during hardware enablement is considered a kernel bug.
[Severity: Low]
This isn't a bug, but the commit message states that probe-time checks
now preclude configuration errors. As noted below, the return value of
pci_prepare_ats() isn't checked during probe, so this description doesn't
seem to match the actual driver behavior.
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index e8d7dbe495f03..a9bec5c7cbf98 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -3065,7 +3065,12 @@ static void arm_smmu_enable_ats(struct arm_smmu_master *master)
> * ATC invalidation of PASID 0 causes the entire ATC to be flushed.
> */
> arm_smmu_atc_inv_master(master, IOMMU_NO_PASID);
> - if (pci_enable_ats(pdev, stu))
> +
> + /*
> + * Since pci_prepare_ats() has already verified the HW capability
> + * and programmed the STE, pci_enable_ats() should not fail here.
> + */
[Severity: Low]
This isn't a bug, but there's a typo in the comment here. pci_prepare_ats()
programs the STU (Smallest Translation Unit) in the PCI ATS capability, not
the STE (Stream Table Entry), which is SMMU-specific.
> + if (WARN_ON(pci_enable_ats(pdev, stu)))
> dev_err(master->dev, "Failed to enable ATS (STU %zu)\n", stu);
> }
[Severity: High]
Is it possible for pci_enable_ats() to fail here and trigger this warning from
userspace?
Looking at arm_smmu_probe_device(), the return value of pci_prepare_ats()
appears to be ignored:
arm_smmu_probe_device() {
...
pci_prepare_ats(to_pci_dev(dev), stu);
...
}
If a Virtual Function (VF) is probed but its Physical Function (PF) has a
mismatched STU, pci_prepare_ats() would fail silently during probe. Later,
when userspace triggers a domain attach (e.g., via VFIO),
arm_smmu_enable_ats() would call pci_enable_ats() on the VF, which fails and
triggers this newly added WARN_ON.
Also, if the error is ignored here and the driver continues as if ATS is
enabled, could this trigger a second WARN_ON(!dev->ats_enabled) in
pci_disable_ats() during domain detachment?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260604182116.3179005-1-praan@google.com?part=3
next prev parent reply other threads:[~2026-06-04 18:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 18:21 [PATCH v8 0/4] iommu: Standardize ATS robustness and state tracking Pranjal Shrivastava
2026-06-04 18:21 ` [PATCH v8 1/4] PCI/ATS: Ensure pci_ats_supported() is PF-aware for VFs Pranjal Shrivastava
2026-06-04 18:21 ` [PATCH v8 2/4] PCI/ATS: Validate STU for VFs in pci_prepare_ats() Pranjal Shrivastava
2026-06-04 18:21 ` [PATCH v8 3/4] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting Pranjal Shrivastava
2026-06-04 18:33 ` sashiko-bot [this message]
2026-06-04 20:33 ` Nicolin Chen
2026-06-04 18:21 ` [PATCH v8 4/4] iommu/vt-d: Fail probe on ATS configuration failure Pranjal Shrivastava
2026-06-04 18:34 ` sashiko-bot
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=20260604183341.15AAC1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=praan@google.com \
--cc=sashiko-reviews@lists.linux.dev \
/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