Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Nicolin Chen" <nicolinc@nvidia.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v5 3/3] iommu/arm-smmu-v3: Allow ATS to be always on
Date: Wed, 20 May 2026 21:33:46 +0000	[thread overview]
Message-ID: <20260520213346.A91161F00A39@smtp.kernel.org> (raw)
In-Reply-To: <b6d2f24356621c504e47633d9e96a7274c2859f3.1779304390.git.nicolinc@nvidia.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Silent failure to enforce ATS requirement leads to device malfunction.
- [High] Inconsistent STE configuration (Mode 1 vs Mode 2) for BLOCKED domains when ats_always_on is true.
--

commit 592bdfd18801a5a10cbb239b47e71f0772eea39e
Author: Nicolin Chen <nicolinc@nvidia.com>

iommu/arm-smmu-v3: Allow ATS to be always on

This patch modifies the ARM SMMUv3 driver to allow ATS to remain active even
when a device's default substream is attached to an identity domain. It does
this by retaining a CD table and ensuring the STE stays in Mode 1 for devices
that require ATS to be always on. It also ensures the STE is not downgraded
to Mode 2 when the last active substream becomes inactive.

> 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..5c9d4bb542249 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
[ ... ]
> @@ -3875,6 +3895,8 @@ static void arm_smmu_attach_dev_ste(struct iommu_domain *domain,
>  		.old_domain = old_domain,
>  		.ssid = IOMMU_NO_PASID,
>  	};
> +	bool ats_always_on = master->ats_always_on &&
> +			     s1dss != STRTAB_STE_1_S1DSS_TERMINATE;

[Severity: High]
Does this explicitly force ats_always_on to false for BLOCKED domains?

If s1dss is STRTAB_STE_1_S1DSS_TERMINATE, the device will initially use
Mode 2 (CFG=ABORT), which disables EATS and appears to contradict the goal
of always keeping ATS on for these devices.

Additionally, if a PASID is attached (upgrading the STE to Mode 1) and then
subsequently removed:

arm_smmu_blocking_set_dev_pasid() {
    ...
    if (!master->ats_always_on &&
        !arm_smmu_ssids_in_use(&master->cd_table)) {
            ...
    }
}

The revert operation is skipped here because master->ats_always_on
evaluates to true, leaving the STE permanently in Mode 1.

Can this create an inconsistent state machine where the initial Mode 2 state
could trigger fatal URs for ATS requests, but detaching a PASID silently
leaves the device in Mode 1?

[ ... ]
> @@ -4215,6 +4237,42 @@ static void arm_smmu_remove_master(struct arm_smmu_master *master)
[ ... ]
> +static int arm_smmu_master_prepare_ats(struct arm_smmu_master *master)
> +{
[ ... ]
> +	if (!pci_ats_required(pdev))
> +		goto out_prepare;
> +
> +	/*
> +	 * S1DSS is required for ATS to be always on for identity domain cases.
> +	 * However, the S1DSS field is ignored if !IDR0_S1P or !IDR1_SSIDSIZE.
> +	 */
> +	if (!s1p || !master->smmu->ssid_bits) {
> +		dev_info_once(master->dev,
> +			      "SMMU doesn't support ATS to be always on\n");
> +		goto out_prepare;

[Severity: High]
If the SMMU lacks the necessary features to support ats_always_on when it is
strictly required by the device, should this code return an error like
-EOPNOTSUPP instead of returning success?

Returning success here allows the IOMMU probe to succeed without configuring
ats_always_on. When the device is later attached to an IDENTITY or BLOCKED
domain, it will be configured in a mode where EATS is ignored.

Could this result in the SMMU aborting ATS Translation Requests as
Unsupported Requests (UR) on the PCIe bus and triggering AER errors, rather
than cleanly failing the probe when the hardware requirement cannot be met?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1779304390.git.nicolinc@nvidia.com?part=3

  reply	other threads:[~2026-05-20 21:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20 19:46 [PATCH v5 0/3] Allow ATS to be always on for certain ATS-capable devices Nicolin Chen
2026-05-20 19:46 ` [PATCH v5 1/3] PCI: Add pci_ats_required() for CXL.cache capable devices Nicolin Chen
2026-05-20 20:03   ` Bjorn Helgaas
2026-05-20 20:20     ` Nicolin Chen
2026-05-20 20:26   ` sashiko-bot
2026-05-20 19:46 ` [PATCH v5 2/3] PCI: Allow ATS to be always on for pre-CXL devices Nicolin Chen
2026-05-20 20:04   ` Bjorn Helgaas
2026-05-20 20:46   ` sashiko-bot
2026-05-20 19:46 ` [PATCH v5 3/3] iommu/arm-smmu-v3: Allow ATS to be always on Nicolin Chen
2026-05-20 21:33   ` sashiko-bot [this message]
2026-05-20 22:35   ` Nicolin Chen
2026-05-21 13:44     ` Jason Gunthorpe
2026-05-21 17:44       ` Nicolin Chen

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=20260520213346.A91161F00A39@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=nicolinc@nvidia.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