Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pranjal Shrivastava" <praan@google.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v5 4/7] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting
Date: Thu, 28 May 2026 22:33:11 +0000	[thread overview]
Message-ID: <20260528223312.78B331F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260528202353.3422206-5-praan@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] ATC Invalidation is sent before ATS is enabled on the PCIe endpoint, violating PCIe specifications and causing Unsupported Request (UR) completions.
--

commit a735f1337ddc38ee7c9d344d6b05b83e1d9050f4
Author: Pranjal Shrivastava <praan@google.com>

iommu/arm-smmu-v3: Standardize ATS enablement failure reporting

The SMMUv3 driver currently has a two-phase commit in its ATS enablement
flow. This commit updates arm_smmu_enable_ats() to use the WARN() macro
for any subsequent enablement failures during the commit phase since probe
checks now preclude software configuration errors.

Link: https://lore.kernel.org/all/cover.1779392420.git.nicolinc@nvidia.com/

> 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 a10affb483a4f..aaebd72bc48dc 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -2956,8 +2956,14 @@ 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);

[Severity: High]
This isn't a bug introduced by this patch, but is it safe to send an ATC
invalidation before ATS is enabled on the PCIe endpoint?

According to the PCIe Base Specification, if the Enable bit in the ATS
Control Register is clear, the Function must respond to Invalidate Requests
with an Unsupported Request (UR) Completion status.

Since the SMMUv3 architecture treats a UR completion to an ATC Invalidate as
an ATC_INV CERROR, doesn't this halt the command queue and raise a Global
Error (GERROR) interrupt?

Looking at the driver's GERROR handler, it handles this by returning
without advancing the CONS pointer past the waiting CMD_SYNC. Because the
UR is a hard error rather than a transient timeout, wouldn't retrying the
CMD_SYNC continuously fail, resulting in an infinite GERROR interrupt loop
and a completely stalled SMMU command queue?

Should pci_enable_ats() be called before sending the ATC invalidate command?

> -	if (pci_enable_ats(pdev, stu))
> -		dev_err(master->dev, "Failed to enable ATS (STU %zu)\n", stu);
> +
> +	/*
> +	 * Any failure at this point is a kernel bug. pci_ats_supported()
> +	 * and pci_prepare_ats() have already verified the hardware capability
> +	 * and programmed the STU. Thus, pci_enable_ats() should not fail here.
> +	 */
> +	WARN(pci_enable_ats(pdev, stu),
> +	     "Failed to enable ATS (STU %zu)\n", stu);
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260528202353.3422206-1-praan@google.com?part=4

  reply	other threads:[~2026-05-28 22:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28 20:23 [PATCH v5 0/7] iommu: Standardize ATS robustness and state tracking Pranjal Shrivastava
2026-05-28 20:23 ` [PATCH v5 1/7] PCI/ATS: Ensure pci_ats_supported() is PF-aware for VFs Pranjal Shrivastava
2026-05-29  6:02   ` Baolu Lu
2026-05-28 20:23 ` [PATCH v5 2/7] PCI/ATS: Validate STU for VFs in pci_prepare_ats() Pranjal Shrivastava
2026-05-29  6:05   ` Baolu Lu
2026-05-28 20:23 ` [PATCH v5 3/7] PCI/ATS: Decouple pci_ats_supported() from pci_prepare_ats() Pranjal Shrivastava
2026-05-29  6:29   ` Baolu Lu
2026-05-29  7:08     ` Pranjal Shrivastava
2026-05-28 20:23 ` [PATCH v5 4/7] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting Pranjal Shrivastava
2026-05-28 22:33   ` sashiko-bot [this message]
2026-05-28 20:23 ` [PATCH v5 5/7] iommu/vt-d: Fix RB-tree corruption and Use-After-Free in probe Pranjal Shrivastava
2026-05-29  3:20   ` Baolu Lu
2026-05-29  7:04     ` Pranjal Shrivastava
2026-05-28 20:23 ` [PATCH v5 6/7] iommu/vt-d: Fail probe on ATS configuration failure Pranjal Shrivastava
2026-05-29  6:39   ` Baolu Lu
2026-05-29  7:03     ` Pranjal Shrivastava
2026-05-28 20:23 ` [PATCH v5 7/7] iommu/amd: " Pranjal Shrivastava
2026-05-29  0:48   ` 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=20260528223312.78B331F000E9@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