From: Pranjal Shrivastava <praan@google.com>
To: Nicolin Chen <nicolinc@nvidia.com>
Cc: jgg@nvidia.com, will@kernel.org, robin.murphy@arm.com,
joro@8bytes.org, bhelgaas@google.com, baolu.lu@linux.intel.com,
kevin.tian@intel.com, miko.lenczewski@arm.com,
linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
dan.j.williams@intel.com, jonathan.cameron@huawei.com,
vsethi@nvidia.com, linux-cxl@vger.kernel.org, nirmoyd@nvidia.com
Subject: Re: [PATCH v6 3/3] iommu/arm-smmu-v3: Allow ATS to be always on
Date: Thu, 28 May 2026 15:24:40 +0000 [thread overview]
Message-ID: <ahheOF8L0aGMttcI@google.com> (raw)
In-Reply-To: <18bb6f421b3be891caa8f1fb50f3a4d56b52d5be.1779392420.git.nicolinc@nvidia.com>
On Thu, May 21, 2026 at 01:34:22PM -0700, Nicolin Chen wrote:
> When a device's default substream attaches to an identity domain, the SMMU
> driver currently sets the device's STE between two modes:
>
> Mode 1: Cfg=Translate, S1DSS=Bypass, EATS=1
> Mode 2: Cfg=bypass (EATS is ignored by HW)
>
> When there is an active PASID (non-default substream), mode 1 is used. And
> when there is no PASID support or no active PASID, mode 2 is used.
>
> The driver will also downgrade an STE from mode 1 to mode 2, when the last
> active substream becomes inactive.
>
> However, there are PCIe devices that demand ATS to be always on. For these
> devices, their STEs have to use the mode 1 as HW ignores EATS with mode 2.
>
> Change the driver accordingly:
> - always use the mode 1
> - never downgrade to mode 2
> - allocate and retain a CD table (see note below)
>
> Note that these devices might not support PASID, i.e. doing non-PASID ATS.
> In such a case, the ssid_bits is set to 0. However, s1cdmax must be set to
> a !0 value in order to keep the S1DSS field effective. Thus, when a master
> requires ats_always_on, set its s1cdmax to at least 1, meaning that the CD
> table will have a dummy entry (SSID=1) that will never be used.
>
> Now for these devices, arm_smmu_cdtab_allocated() will always return true,
> v.s. false prior to this change. When its default substream is attached to
> an IDENTITY domain, its first CD is NULL in the table, which is a totally
> valid case. Thus, add "!master->ats_always_on" to the condition.
>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Tested-by: Nirmoy Das <nirmoyd@nvidia.com>
> Acked-by: Nirmoy Das <nirmoyd@nvidia.com>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 1 +
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 81 ++++++++++++++++++---
> 2 files changed, 73 insertions(+), 9 deletions(-)
>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
>
> +static int arm_smmu_master_prepare_ats(struct arm_smmu_master *master)
> +{
> + bool s1p = master->smmu->features & ARM_SMMU_FEAT_TRANS_S1;
> + unsigned int stu = __ffs(master->smmu->pgsize_bitmap);
> + struct pci_dev *pdev;
> + int ret;
> +
> + if (!dev_is_pci(master->dev))
> + return 0;
> + pdev = to_pci_dev(master->dev);
> +
> + if (!arm_smmu_ats_supported(master)) {
> + if (pci_ats_required(pdev)) {
> + dev_err_once(master->dev, "SMMU doesn't support ATS\n");
> + return -EOPNOTSUPP;
> + }
> + return 0;
> + }
> +
> + ret = pci_prepare_ats(pdev, stu);
> + if (ret || !pci_ats_required(pdev))
> + return ret;
> +
> + /*
> + * 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_err_once(master->dev,
> + "SMMU doesn't support ATS to be always on\n");
> + return -EOPNOTSUPP;
> + }
> +
> + master->ats_always_on = true;
> +
> + return arm_smmu_alloc_cd_tables(master);
Nit: I'm not sure if I'm getting this right, are we saying we *need* to
allocate CDs for CXL.cache cases in the probe itself because STE.EATS
requires Config=Translate with S1DSS in bypass?
Does this imply that active transactions can be occurring *before* the
first domain attach? Are
Thanks,
Praan
next prev parent reply other threads:[~2026-05-28 15:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 20:34 [PATCH v6 0/3] Allow ATS to be always on for certain ATS-capable devices Nicolin Chen
2026-05-21 20:34 ` [PATCH v6 1/3] PCI: Add pci_ats_required() for CXL.cache capable devices Nicolin Chen
2026-05-21 20:57 ` Bjorn Helgaas
2026-05-21 21:07 ` Nicolin Chen
2026-05-21 21:31 ` Bjorn Helgaas
2026-05-21 21:59 ` Nicolin Chen
2026-05-22 9:19 ` Yi Liu
2026-05-21 20:34 ` [PATCH v6 2/3] PCI: Allow ATS to be always on for pre-CXL devices Nicolin Chen
2026-05-22 9:17 ` Yi Liu
2026-05-21 20:34 ` [PATCH v6 3/3] iommu/arm-smmu-v3: Allow ATS to be always on Nicolin Chen
2026-05-28 15:24 ` Pranjal Shrivastava [this message]
2026-05-28 15:29 ` Jason Gunthorpe
2026-05-28 16:32 ` Pranjal Shrivastava
2026-05-28 18:00 ` Jason Gunthorpe
2026-05-28 18:14 ` Pranjal Shrivastava
2026-05-28 18:20 ` Nicolin Chen
2026-05-28 20:04 ` Jason Gunthorpe
2026-05-28 20:39 ` Pranjal Shrivastava
2026-05-28 7:35 ` [PATCH v6 0/3] Allow ATS to be always on for certain ATS-capable devices Jörg Rödel
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=ahheOF8L0aGMttcI@google.com \
--to=praan@google.com \
--cc=baolu.lu@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=jonathan.cameron@huawei.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=miko.lenczewski@arm.com \
--cc=nicolinc@nvidia.com \
--cc=nirmoyd@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=vsethi@nvidia.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