Skip to contentSkip to conversation

iommu/vt-d: PRS isn't usable if PDS isn't supported

PATCH In review Lu Baolu 2 participants 5 messages Sep 15, 2025 – Sep 19, 2025

Subsystems (3)
lore
Share & tools
lore

Lu Baolu

author maintainer
#0 lore raw

PATCH 1/1 iommu/vt-d: PRS isn't usable if PDS isn't supported

The specification, Section 7.10, "Software Steps to Drain Page Requests & Responses," requires software to submit an Invalidation Wait Descriptor (inv_wait_dsc) with the Page-request Drain (PD=1) flag set, along with the Invalidation Wait Completion Status Write flag (SW=1). It then waits for the Invalidation Wait Descriptor's completion.

However, the PD field in the Invalidation Wait Descriptor is optional, as stated in Section 6.5.2.9, "Invalidation Wait Descriptor":

"Page-request Drain (PD): Remapping hardware implementations reporting
Page-request draining as not supported (PDS = 0 in ECAP_REG) treat this field as reserved."

This implies that if the IOMMU doesn't support the PDS capability, software can't drain page requests and group responses as expected.

Do not enable PCI/PRI if the IOMMU doesn't support PDS.

Fixes 66ac4db36f4c ("iommu/vt-d: Add page request draining support")
---
 drivers/iommu/intel/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/iommu.c +1 -1
index 9c3ab9d9f69a..92759a8f8330 100644
@@ -3812,7 +3812,7 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
 			}
 
 			if (info->ats_supported && ecap_prs(iommu->ecap) &&
-			    pci_pri_supported(pdev))
+			    ecap_pds(iommu->ecap) && pci_pri_supported(pdev))
 				info->pri_supported = 1;
 		}
 	}
Signature · 1 line
2.43.0
#1 lore raw
Quoted 9 lines · Lu Baolu

The specification, Section 7.10, "Software Steps to Drain Page Requests & Responses," requires software to submit an Invalidation Wait Descriptor (inv_wait_dsc) with the Page-request Drain (PD=1) flag set, along with the Invalidation Wait Completion Status Write flag (SW=1). It then waits for the Invalidation Wait Descriptor's completion.

However, the PD field in the Invalidation Wait Descriptor is optional, as stated in Section 6.5.2.9, "Invalidation Wait Descriptor":

Quoted 8 lines

"Page-request Drain (PD): Remapping hardware implementations reporting
Page-request draining as not supported (PDS = 0 in ECAP_REG) treat this field as reserved."

This implies that if the IOMMU doesn't support the PDS capability, software can't drain page requests and group responses as expected.

Do not enable PCI/PRI if the IOMMU doesn't support PDS.

After giving the spec another look, this is probably the way to go. However the PDS also mentions that DT must be set. Should we check ecap_dev_iotlb_support(iommu->ecap) as well?

Quoted 15 lines
Fixes 66ac4db36f4c ("iommu/vt-d: Add page request draining support")
---
 drivers/iommu/intel/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/iommu.c +0 -0
index 9c3ab9d9f69a..92759a8f8330 100644

drivers/iommu/intel/iommu.c static struct iommu_device *intel_iommu_probe_device(struct device *dev) · line 3815

Quoted 5 lines
drivers/iommu/intel/iommu.c +1 -1
@@ -3812,7 +3812,7 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
 			}
 
 			if (info->ats_supported && ecap_prs(iommu->ecap) &&
-			    pci_pri_supported(pdev))
+			    ecap_pds(iommu->ecap) && pci_pri_supported(pdev))

Should this be
+ ecap_dev_iotlb_support(iommu->ecap) && ecap_pds(iommu->ecap) && pci_pri_supported(pdev))

???

best

Signature · 1 line
Joel Granados
author maintainer
#2 lore raw
Quoted 14 lines · Joel Granados
Quoted 13 lines · Lu Baolu

The specification, Section 7.10, "Software Steps to Drain Page Requests & Responses," requires software to submit an Invalidation Wait Descriptor (inv_wait_dsc) with the Page-request Drain (PD=1) flag set, along with the Invalidation Wait Completion Status Write flag (SW=1). It then waits for the Invalidation Wait Descriptor's completion.

However, the PD field in the Invalidation Wait Descriptor is optional, as stated in Section 6.5.2.9, "Invalidation Wait Descriptor":

"Page-request Drain (PD): Remapping hardware implementations reporting
Page-request draining as not supported (PDS = 0 in ECAP_REG) treat this field as reserved."

Quoted 8 lines
Quoted 4 lines

This implies that if the IOMMU doesn't support the PDS capability, software can't drain page requests and group responses as expected.

Do not enable PCI/PRI if the IOMMU doesn't support PDS.

After giving the spec another look, this is probably the way to go. However the PDS also mentions that DT must be set. Should we check ecap_dev_iotlb_support(iommu->ecap) as well?

It has already been checked.

Quoted 17 lines
Quoted 17 lines
Fixes 66ac4db36f4c ("iommu/vt-d: Add page request draining support")
---
  drivers/iommu/intel/iommu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/iommu.c +0 -0
index 9c3ab9d9f69a..92759a8f8330 100644
@@ -3812,7 +3812,7 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
  			}
 
Quoted 7 lines

drivers/iommu/intel/iommu.c static struct iommu_device *intel_iommu_probe_device(struct device *dev) · line 3815

Quoted 3 lines
drivers/iommu/intel/iommu.c +1 -1
  			if (info->ats_supported && ecap_prs(iommu->ecap) &&
-			    pci_pri_supported(pdev))
+			    ecap_pds(iommu->ecap) && pci_pri_supported(pdev))

Should this be
+ ecap_dev_iotlb_support(iommu->ecap) && ecap_pds(iommu->ecap) && pci_pri_supported(pdev))

???

ecap_dev_iotlb_support() has already been checked as it's part of the info->ats_supported check. The dependency chain is:
ecap_dev_iotlb_support() -> ats_support -> pri_support.

Thanks,
baolu

#3 lore raw
Quoted 18 lines · Baolu Lu
Quoted 17 lines · Joel Granados
Quoted 16 lines · Lu Baolu

The specification, Section 7.10, "Software Steps to Drain Page Requests & Responses," requires software to submit an Invalidation Wait Descriptor (inv_wait_dsc) with the Page-request Drain (PD=1) flag set, along with the Invalidation Wait Completion Status Write flag (SW=1). It then waits for the Invalidation Wait Descriptor's completion.

However, the PD field in the Invalidation Wait Descriptor is optional, as stated in Section 6.5.2.9, "Invalidation Wait Descriptor":

"Page-request Drain (PD): Remapping hardware implementations reporting
Page-request draining as not supported (PDS = 0 in ECAP_REG) treat this field as reserved."

This implies that if the IOMMU doesn't support the PDS capability, software can't drain page requests and group responses as expected.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Do not enable PCI/PRI if the IOMMU doesn't support PDS.

After giving the spec another look, this is probably the way to go. However the PDS also mentions that DT must be set. Should we check ecap_dev_iotlb_support(iommu->ecap) as well?

It has already been checked.

Yes. In intel_iommu_probe_device. Thx for the clarification.

Best

Signature · 1 line
Joel Granados
author maintainer
#4 lore raw
In reply to Lu Baolu
Quoted 18 lines · Lu Baolu

The specification, Section 7.10, "Software Steps to Drain Page Requests & Responses," requires software to submit an Invalidation Wait Descriptor (inv_wait_dsc) with the Page-request Drain (PD=1) flag set, along with the Invalidation Wait Completion Status Write flag (SW=1). It then waits for the Invalidation Wait Descriptor's completion.

However, the PD field in the Invalidation Wait Descriptor is optional, as stated in Section 6.5.2.9, "Invalidation Wait Descriptor":

"Page-request Drain (PD): Remapping hardware implementations reporting
Page-request draining as not supported (PDS = 0 in ECAP_REG) treat this field as reserved."

This implies that if the IOMMU doesn't support the PDS capability, software can't drain page requests and group responses as expected.

Do not enable PCI/PRI if the IOMMU doesn't support PDS.

Quoted 8 lines
Fixes 66ac4db36f4c ("iommu/vt-d: Add page request draining support")
---
  drivers/iommu/intel/iommu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Queued for v6.18.