Skip to contentSkip to conversation

iommu/vt-d: Disable SVM when ATS/PRI/PASID are not enabled in the device

PATCH In review Kyung Min Park 3 participants 3 messages Mar 14, 2021 – Mar 18, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/vt-d: Disable SVM when ATS/PRI/PASID are not enabled in the device

Currently, the Intel VT-d supports Shared Virtual Memory (SVM) only when IO page fault is supported. Otherwise, shared memory pages can not be swapped out and need to be pinned. The device needs the Address Translation Service (ATS), Page Request Interface (PRI) and Process Address Space Identifier (PASID) capabilities to be enabled to support IO page fault.

Disable SVM when ATS, PRI and PASID are not enabled in the device.

---
 drivers/iommu/intel/iommu.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/iommu/intel/iommu.c +3 -0
index ee0932307d64..956a02eb40b4 100644
@@ -5380,6 +5380,9 @@ intel_iommu_dev_enable_feat(struct device *dev, enum iommu_dev_features feat)
 		if (!info)
 			return -EINVAL;
 
+		if (!info->pasid_enabled || !info->pri_enabled || !info->ats_enabled)
+			return -EINVAL;
+
 		if (info->iommu->flags & VTD_FLAG_SVM_CAPABLE)
 			return 0;
 	}
Signature · 6 lines
2.17.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Kyung Min Park

Currently, the Intel VT-d supports Shared Virtual Memory (SVM) only when IO page fault is supported. Otherwise, shared memory pages can not be swapped out and need to be pinned. The device needs the Address Translation Service (ATS), Page Request Interface (PRI) and Process Address Space Identifier (PASID) capabilities to be enabled to support IO page fault.

Disable SVM when ATS, PRI and PASID are not enabled in the device.

---
  drivers/iommu/intel/iommu.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/iommu/intel/iommu.c +0 -0
index ee0932307d64..956a02eb40b4 100644

drivers/iommu/intel/iommu.c intel_iommu_dev_enable_feat(struct device *dev, enum iommu_dev_features feat) · line 5388

Quoted 9 lines
drivers/iommu/intel/iommu.c +3 -0
@@ -5380,6 +5380,9 @@ intel_iommu_dev_enable_feat(struct device *dev, enum iommu_dev_features feat)
  		if (!info)
  			return -EINVAL;
 
+		if (!info->pasid_enabled || !info->pri_enabled || !info->ats_enabled)
+			return -EINVAL;
+
  		if (info->iommu->flags & VTD_FLAG_SVM_CAPABLE)
  			return 0;
  	}

Thanks for the patch.

Best regards,
baolu
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

maintainer
#2 lore raw
In reply to Kyung Min Park
Quoted 9 lines · Kyung Min Park

Currently, the Intel VT-d supports Shared Virtual Memory (SVM) only when IO page fault is supported. Otherwise, shared memory pages can not be swapped out and need to be pinned. The device needs the Address Translation Service (ATS), Page Request Interface (PRI) and Process Address Space Identifier (PASID) capabilities to be enabled to support IO page fault.

Disable SVM when ATS, PRI and PASID are not enabled in the device.

Applied, thanks.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu