* [PATCH v8 1/4] PCI/ATS: Ensure pci_ats_supported() is PF-aware for VFs
2026-06-04 18:21 [PATCH v8 0/4] iommu: Standardize ATS robustness and state tracking Pranjal Shrivastava
@ 2026-06-04 18:21 ` Pranjal Shrivastava
2026-06-12 14:34 ` Bjorn Helgaas
2026-06-04 18:21 ` [PATCH v8 2/4] PCI/ATS: Validate STU for VFs in pci_prepare_ats() Pranjal Shrivastava
` (2 subsequent siblings)
3 siblings, 1 reply; 12+ messages in thread
From: Pranjal Shrivastava @ 2026-06-04 18:21 UTC (permalink / raw)
To: iommu, linux-pci, linux-kernel
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Baolu Lu,
Jason Gunthorpe, Kevin Tian, Bjorn Helgaas, Samiullah Khawaja,
Pranjal Shrivastava, Nicolin Chen
Update pci_ats_supported() to additionally check the associated PF's
status when called on a VF. This ensures that PF-level quirks and
untrusted status are correctly propagated to VFs, providing a robust
support check that aligns with the kernel's PF-centric ATS configuration
model and is immune to the timing of VF-specific fixups.
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Pranjal Shrivastava <praan@google.com>
---
drivers/pci/ats.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
index 96efa00d9743..679a3c3c1d54 100644
--- a/drivers/pci/ats.c
+++ b/drivers/pci/ats.c
@@ -40,10 +40,13 @@ void pci_ats_init(struct pci_dev *dev)
*/
bool pci_ats_supported(struct pci_dev *dev)
{
- if (!dev->ats_cap)
+ if (!dev->ats_cap || dev->untrusted)
return false;
- return (dev->untrusted == 0);
+ if (dev->is_virtfn)
+ return pci_ats_supported(pci_physfn(dev));
+
+ return true;
}
EXPORT_SYMBOL_GPL(pci_ats_supported);
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v8 1/4] PCI/ATS: Ensure pci_ats_supported() is PF-aware for VFs
2026-06-04 18:21 ` [PATCH v8 1/4] PCI/ATS: Ensure pci_ats_supported() is PF-aware for VFs Pranjal Shrivastava
@ 2026-06-12 14:34 ` Bjorn Helgaas
0 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2026-06-12 14:34 UTC (permalink / raw)
To: Pranjal Shrivastava
Cc: iommu, linux-pci, linux-kernel, Joerg Roedel, Will Deacon,
Robin Murphy, Baolu Lu, Jason Gunthorpe, Kevin Tian,
Bjorn Helgaas, Samiullah Khawaja, Nicolin Chen
On Thu, Jun 04, 2026 at 06:21:13PM +0000, Pranjal Shrivastava wrote:
> Update pci_ats_supported() to additionally check the associated PF's
> status when called on a VF. This ensures that PF-level quirks and
> untrusted status are correctly propagated to VFs, providing a robust
> support check that aligns with the kernel's PF-centric ATS configuration
> model and is immune to the timing of VF-specific fixups.
>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Pranjal Shrivastava <praan@google.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
This series looks like material for the IOMMU tree? Let me know if
you prefer merging these via PCI.
> ---
> drivers/pci/ats.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
> index 96efa00d9743..679a3c3c1d54 100644
> --- a/drivers/pci/ats.c
> +++ b/drivers/pci/ats.c
> @@ -40,10 +40,13 @@ void pci_ats_init(struct pci_dev *dev)
> */
> bool pci_ats_supported(struct pci_dev *dev)
> {
> - if (!dev->ats_cap)
> + if (!dev->ats_cap || dev->untrusted)
> return false;
>
> - return (dev->untrusted == 0);
> + if (dev->is_virtfn)
> + return pci_ats_supported(pci_physfn(dev));
> +
> + return true;
> }
> EXPORT_SYMBOL_GPL(pci_ats_supported);
>
> --
> 2.54.0.1032.g2f8565e1d1-goog
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v8 2/4] PCI/ATS: Validate STU for VFs in pci_prepare_ats()
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 ` Pranjal Shrivastava
2026-06-12 14:34 ` Bjorn Helgaas
2026-06-04 18:21 ` [PATCH v8 3/4] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting Pranjal Shrivastava
2026-06-04 18:21 ` [PATCH v8 4/4] iommu/vt-d: Fail probe on ATS configuration failure Pranjal Shrivastava
3 siblings, 1 reply; 12+ messages in thread
From: Pranjal Shrivastava @ 2026-06-04 18:21 UTC (permalink / raw)
To: iommu, linux-pci, linux-kernel
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Baolu Lu,
Jason Gunthorpe, Kevin Tian, Bjorn Helgaas, Samiullah Khawaja,
Pranjal Shrivastava, Nicolin Chen
While every PCI Function that implements ATS has an independent ATS
Extended Capability structure with a Read/Write Smallest Translation
Unit (STU) field, the kernel manages SR-IOV ATS by requiring the IOMMU
driver to configure the STU on the Physical Function (PF) before any
any Virtual Functions (VFs) are created.
Currently, pci_prepare_ats() bails out early for VFs, assuming that the
PF has already been correctly prepared. However, this creates a potential
mismatch if a VF is subsequently prepared with a different page shift.
Update pci_prepare_ats() to validate that the requested page shift (ps)
matches the STU already configured in the associated PF. This ensures
early detection of incompatible configurations and maintains the kernel's
policy of consistent STU sizing across all functions associated with a
given SMMU.
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Pranjal Shrivastava <praan@google.com>
---
drivers/pci/ats.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
index 679a3c3c1d54..9cb23780093d 100644
--- a/drivers/pci/ats.c
+++ b/drivers/pci/ats.c
@@ -73,8 +73,12 @@ int pci_prepare_ats(struct pci_dev *dev, int ps)
if (ps < PCI_ATS_MIN_STU)
return -EINVAL;
- if (dev->is_virtfn)
+ if (dev->is_virtfn) {
+ if (pci_physfn(dev)->ats_stu != ps)
+ return -EINVAL;
+
return 0;
+ }
dev->ats_stu = ps;
ctrl = PCI_ATS_CTRL_STU(dev->ats_stu - PCI_ATS_MIN_STU);
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v8 2/4] PCI/ATS: Validate STU for VFs in pci_prepare_ats()
2026-06-04 18:21 ` [PATCH v8 2/4] PCI/ATS: Validate STU for VFs in pci_prepare_ats() Pranjal Shrivastava
@ 2026-06-12 14:34 ` Bjorn Helgaas
0 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2026-06-12 14:34 UTC (permalink / raw)
To: Pranjal Shrivastava
Cc: iommu, linux-pci, linux-kernel, Joerg Roedel, Will Deacon,
Robin Murphy, Baolu Lu, Jason Gunthorpe, Kevin Tian,
Bjorn Helgaas, Samiullah Khawaja, Nicolin Chen
On Thu, Jun 04, 2026 at 06:21:14PM +0000, Pranjal Shrivastava wrote:
> While every PCI Function that implements ATS has an independent ATS
> Extended Capability structure with a Read/Write Smallest Translation
> Unit (STU) field, the kernel manages SR-IOV ATS by requiring the IOMMU
> driver to configure the STU on the Physical Function (PF) before any
> any Virtual Functions (VFs) are created.
>
> Currently, pci_prepare_ats() bails out early for VFs, assuming that the
> PF has already been correctly prepared. However, this creates a potential
> mismatch if a VF is subsequently prepared with a different page shift.
>
> Update pci_prepare_ats() to validate that the requested page shift (ps)
> matches the STU already configured in the associated PF. This ensures
> early detection of incompatible configurations and maintains the kernel's
> policy of consistent STU sizing across all functions associated with a
> given SMMU.
>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Pranjal Shrivastava <praan@google.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> drivers/pci/ats.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
> index 679a3c3c1d54..9cb23780093d 100644
> --- a/drivers/pci/ats.c
> +++ b/drivers/pci/ats.c
> @@ -73,8 +73,12 @@ int pci_prepare_ats(struct pci_dev *dev, int ps)
> if (ps < PCI_ATS_MIN_STU)
> return -EINVAL;
>
> - if (dev->is_virtfn)
> + if (dev->is_virtfn) {
> + if (pci_physfn(dev)->ats_stu != ps)
> + return -EINVAL;
> +
> return 0;
> + }
>
> dev->ats_stu = ps;
> ctrl = PCI_ATS_CTRL_STU(dev->ats_stu - PCI_ATS_MIN_STU);
> --
> 2.54.0.1032.g2f8565e1d1-goog
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v8 3/4] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting
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 ` Pranjal Shrivastava
2026-06-04 20:33 ` Nicolin Chen
` (2 more replies)
2026-06-04 18:21 ` [PATCH v8 4/4] iommu/vt-d: Fail probe on ATS configuration failure Pranjal Shrivastava
3 siblings, 3 replies; 12+ messages in thread
From: Pranjal Shrivastava @ 2026-06-04 18:21 UTC (permalink / raw)
To: iommu, linux-pci, linux-kernel
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Baolu Lu,
Jason Gunthorpe, Kevin Tian, Bjorn Helgaas, Samiullah Khawaja,
Pranjal Shrivastava
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.
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Pranjal Shrivastava <praan@google.com>
---
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
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 a10affb483a4..0494c68daa19 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2956,7 +2956,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.
+ */
+ if (WARN_ON(pci_enable_ats(pdev, stu)))
dev_err(master->dev, "Failed to enable ATS (STU %zu)\n", stu);
}
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v8 3/4] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting
2026-06-04 18:21 ` [PATCH v8 3/4] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting Pranjal Shrivastava
@ 2026-06-04 20:33 ` Nicolin Chen
2026-06-05 16:18 ` Samiullah Khawaja
2026-06-12 13:36 ` Jason Gunthorpe
2 siblings, 0 replies; 12+ messages in thread
From: Nicolin Chen @ 2026-06-04 20:33 UTC (permalink / raw)
To: Pranjal Shrivastava
Cc: iommu, linux-pci, linux-kernel, Joerg Roedel, Will Deacon,
Robin Murphy, Baolu Lu, Jason Gunthorpe, Kevin Tian,
Bjorn Helgaas, Samiullah Khawaja
On Thu, Jun 04, 2026 at 06:21:15PM +0000, Pranjal Shrivastava wrote:
> 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.
>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Pranjal Shrivastava <praan@google.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v8 3/4] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting
2026-06-04 18:21 ` [PATCH v8 3/4] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting Pranjal Shrivastava
2026-06-04 20:33 ` Nicolin Chen
@ 2026-06-05 16:18 ` Samiullah Khawaja
2026-06-12 13:36 ` Jason Gunthorpe
2 siblings, 0 replies; 12+ messages in thread
From: Samiullah Khawaja @ 2026-06-05 16:18 UTC (permalink / raw)
To: Pranjal Shrivastava
Cc: iommu, linux-pci, linux-kernel, Joerg Roedel, Will Deacon,
Robin Murphy, Baolu Lu, Jason Gunthorpe, Kevin Tian,
Bjorn Helgaas
On Thu, Jun 04, 2026 at 06:21:15PM +0000, Pranjal Shrivastava wrote:
>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.
>
>Reviewed-by: Kevin Tian <kevin.tian@intel.com>
>Signed-off-by: Pranjal Shrivastava <praan@google.com>
>---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
>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 a10affb483a4..0494c68daa19 100644
>--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
>+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
>@@ -2956,7 +2956,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.
>+ */
>+ if (WARN_ON(pci_enable_ats(pdev, stu)))
> dev_err(master->dev, "Failed to enable ATS (STU %zu)\n", stu);
> }
>
>--
>2.54.0.1032.g2f8565e1d1-goog
>
Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v8 3/4] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting
2026-06-04 18:21 ` [PATCH v8 3/4] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting Pranjal Shrivastava
2026-06-04 20:33 ` Nicolin Chen
2026-06-05 16:18 ` Samiullah Khawaja
@ 2026-06-12 13:36 ` Jason Gunthorpe
2 siblings, 0 replies; 12+ messages in thread
From: Jason Gunthorpe @ 2026-06-12 13:36 UTC (permalink / raw)
To: Pranjal Shrivastava
Cc: iommu, linux-pci, linux-kernel, Joerg Roedel, Will Deacon,
Robin Murphy, Baolu Lu, Kevin Tian, Bjorn Helgaas,
Samiullah Khawaja
On Thu, Jun 04, 2026 at 06:21:15PM +0000, Pranjal Shrivastava wrote:
> 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.
>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Pranjal Shrivastava <praan@google.com>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> + /*
> + * Since pci_prepare_ats() has already verified the HW capability
> + * and programmed the STE, pci_enable_ats() should not fail here.
> + */
> + if (WARN_ON(pci_enable_ats(pdev, stu)))
> dev_err(master->dev, "Failed to enable ATS (STU %zu)\n", stu);
> }
I would fold the dev_err string into the WARN though
Jason
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v8 4/4] iommu/vt-d: Fail probe on ATS configuration failure
2026-06-04 18:21 [PATCH v8 0/4] iommu: Standardize ATS robustness and state tracking Pranjal Shrivastava
` (2 preceding siblings ...)
2026-06-04 18:21 ` [PATCH v8 3/4] iommu/arm-smmu-v3: Standardize ATS enablement failure reporting Pranjal Shrivastava
@ 2026-06-04 18:21 ` Pranjal Shrivastava
2026-06-05 16:20 ` Samiullah Khawaja
2026-06-12 13:39 ` Jason Gunthorpe
3 siblings, 2 replies; 12+ messages in thread
From: Pranjal Shrivastava @ 2026-06-04 18:21 UTC (permalink / raw)
To: iommu, linux-pci, linux-kernel
Cc: Joerg Roedel, Will Deacon, Robin Murphy, Baolu Lu,
Jason Gunthorpe, Kevin Tian, Bjorn Helgaas, Samiullah Khawaja,
Pranjal Shrivastava
Update the Intel VT-d driver to handle ATS configuration and enablement
more strictly. Specifically, update the device probe to fail if
pci_prepare_ats() returns an error. This ensures that any ATS-capable
master reaching the attach phase is guaranteed to have a valid config.
Additionally, update iommu_enable_pci_ats() to WARN() if pci_enable_ats
fails. Since earlier checks in the probe phase preclude config-related
failures, any failure during hardware enablement is considered a kernel
bug.
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Pranjal Shrivastava <praan@google.com>
---
drivers/iommu/intel/iommu.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 849d06dfe1ae..f39451323553 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -876,8 +876,14 @@ static void iommu_enable_pci_ats(struct device_domain_info *info)
if (!pci_ats_page_aligned(pdev))
return;
- if (!pci_enable_ats(pdev, VTD_PAGE_SHIFT))
- info->ats_enabled = 1;
+ /*
+ * pci_enable_ats() should not fail here because earlier checks
+ * have already verified support and configuration.
+ */
+ if (WARN_ON(pci_enable_ats(pdev, VTD_PAGE_SHIFT)))
+ return;
+
+ info->ats_enabled = 1;
}
static void iommu_disable_pci_ats(struct device_domain_info *info)
@@ -3292,7 +3298,10 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
dev_iommu_priv_set(dev, info);
if (pdev && pci_ats_supported(pdev)) {
- pci_prepare_ats(pdev, VTD_PAGE_SHIFT);
+ ret = pci_prepare_ats(pdev, VTD_PAGE_SHIFT);
+ if (ret)
+ goto free;
+
ret = device_rbtree_insert(iommu, info);
if (ret)
goto free;
--
2.54.0.1032.g2f8565e1d1-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v8 4/4] iommu/vt-d: Fail probe on ATS configuration failure
2026-06-04 18:21 ` [PATCH v8 4/4] iommu/vt-d: Fail probe on ATS configuration failure Pranjal Shrivastava
@ 2026-06-05 16:20 ` Samiullah Khawaja
2026-06-12 13:39 ` Jason Gunthorpe
1 sibling, 0 replies; 12+ messages in thread
From: Samiullah Khawaja @ 2026-06-05 16:20 UTC (permalink / raw)
To: Pranjal Shrivastava
Cc: iommu, linux-pci, linux-kernel, Joerg Roedel, Will Deacon,
Robin Murphy, Baolu Lu, Jason Gunthorpe, Kevin Tian,
Bjorn Helgaas
On Thu, Jun 04, 2026 at 06:21:16PM +0000, Pranjal Shrivastava wrote:
>Update the Intel VT-d driver to handle ATS configuration and enablement
>more strictly. Specifically, update the device probe to fail if
>pci_prepare_ats() returns an error. This ensures that any ATS-capable
>master reaching the attach phase is guaranteed to have a valid config.
>
>Additionally, update iommu_enable_pci_ats() to WARN() if pci_enable_ats
>fails. Since earlier checks in the probe phase preclude config-related
>failures, any failure during hardware enablement is considered a kernel
>bug.
>
>Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
>Reviewed-by: Kevin Tian <kevin.tian@intel.com>
>Signed-off-by: Pranjal Shrivastava <praan@google.com>
>---
> drivers/iommu/intel/iommu.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
>index 849d06dfe1ae..f39451323553 100644
>--- a/drivers/iommu/intel/iommu.c
>+++ b/drivers/iommu/intel/iommu.c
>@@ -876,8 +876,14 @@ static void iommu_enable_pci_ats(struct device_domain_info *info)
> if (!pci_ats_page_aligned(pdev))
> return;
>
>- if (!pci_enable_ats(pdev, VTD_PAGE_SHIFT))
>- info->ats_enabled = 1;
>+ /*
>+ * pci_enable_ats() should not fail here because earlier checks
>+ * have already verified support and configuration.
>+ */
>+ if (WARN_ON(pci_enable_ats(pdev, VTD_PAGE_SHIFT)))
>+ return;
>+
>+ info->ats_enabled = 1;
> }
>
> static void iommu_disable_pci_ats(struct device_domain_info *info)
>@@ -3292,7 +3298,10 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
>
> dev_iommu_priv_set(dev, info);
> if (pdev && pci_ats_supported(pdev)) {
>- pci_prepare_ats(pdev, VTD_PAGE_SHIFT);
>+ ret = pci_prepare_ats(pdev, VTD_PAGE_SHIFT);
>+ if (ret)
>+ goto free;
>+
> ret = device_rbtree_insert(iommu, info);
> if (ret)
> goto free;
>--
>2.54.0.1032.g2f8565e1d1-goog
>
Reviewed-by: Samiullah Khawaja <skhawaja@google.com>
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH v8 4/4] iommu/vt-d: Fail probe on ATS configuration failure
2026-06-04 18:21 ` [PATCH v8 4/4] iommu/vt-d: Fail probe on ATS configuration failure Pranjal Shrivastava
2026-06-05 16:20 ` Samiullah Khawaja
@ 2026-06-12 13:39 ` Jason Gunthorpe
1 sibling, 0 replies; 12+ messages in thread
From: Jason Gunthorpe @ 2026-06-12 13:39 UTC (permalink / raw)
To: Pranjal Shrivastava
Cc: iommu, linux-pci, linux-kernel, Joerg Roedel, Will Deacon,
Robin Murphy, Baolu Lu, Kevin Tian, Bjorn Helgaas,
Samiullah Khawaja
On Thu, Jun 04, 2026 at 06:21:16PM +0000, Pranjal Shrivastava wrote:
> Update the Intel VT-d driver to handle ATS configuration and enablement
> more strictly. Specifically, update the device probe to fail if
> pci_prepare_ats() returns an error. This ensures that any ATS-capable
> master reaching the attach phase is guaranteed to have a valid config.
>
> Additionally, update iommu_enable_pci_ats() to WARN() if pci_enable_ats
> fails. Since earlier checks in the probe phase preclude config-related
> failures, any failure during hardware enablement is considered a kernel
> bug.
>
> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Pranjal Shrivastava <praan@google.com>
> ---
> drivers/iommu/intel/iommu.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Jason
^ permalink raw reply [flat|nested] 12+ messages in thread