Skip to contentSkip to conversation

iommu/vt-d: Decouple PASID & PRI enabling from SVA

PATCH In review Lu Baolu 2 participants 2 messages Sep 15, 2022

Subsystems (2)
lore
Share & tools
lore

Lu Baolu

author maintainer
#0 lore raw

PATCH v2 1/1 iommu/vt-d: Decouple PASID & PRI enabling from SVA

Previously the PCI PASID and PRI capabilities are enabled in the path of iommu device probe only if INTEL_IOMMU_SVM is configured and the device supports ATS. As we've already decoupled the I/O page fault handler from SVA, we could also decouple PASID and PRI enabling from it to make room for growth of new features like kernel DMA with PASID, SIOV and nested translation.

At the same time, the iommu_enable_dev_iotlb() helper is also called in iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_SVA) path. It's unnecessary and duplicate. This cleanups this helper to make the code neat.

---
 drivers/iommu/intel/iommu.h |  1 -
 drivers/iommu/intel/iommu.c | 78 ++++++++-----------------------------
 drivers/iommu/intel/Kconfig |  5 +--
 3 files changed, 18 insertions(+), 66 deletions(-)

Changelog:
v2:
- Rephrase the commit message to make it accurate.
- Rename iommu_enable_dev_iotlb().

v1: https://lore.kernel.org/linux-iommu/[email protected]/

drivers/iommu/intel/iommu.h +0 -1
index 352f05e92f6f..b11069a71640 100644
@@ -740,7 +740,6 @@ extern int dmar_ir_support(void);
 void *alloc_pgtable_page(int node);
 void free_pgtable_page(void *vaddr);
 void iommu_flush_write_buffer(struct intel_iommu *iommu);
-int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct device *dev);
 struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn);
 
 #ifdef CONFIG_INTEL_IOMMU_SVM
drivers/iommu/intel/iommu.c +16 -62

161 lines not on this page · raw message

drivers/iommu/intel/Kconfig +2 -3
index c48005147ac5..b7dff5092fd2 100644
@@ -20,6 +20,8 @@ config INTEL_IOMMU
 	select SWIOTLB
 	select IOASID
 	select PCI_ATS
+	select PCI_PRI
+	select PCI_PASID
 	help
 	  DMA remapping (DMAR) devices support enables independent address
 	  translations for Direct Memory Access (DMA) from devices.
@@ -47,10 +49,7 @@ config INTEL_IOMMU_DEBUGFS
 config INTEL_IOMMU_SVM
 	bool "Support for Shared Virtual Memory with Intel IOMMU"
 	depends on X86_64
-	select PCI_PASID
-	select PCI_PRI
 	select MMU_NOTIFIER
-	select IOASID
 	select IOMMU_SVA
 	help
 	  Shared Virtual Memory (SVM) provides a facility for devices
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines

From: Lu Baolu <[email protected]>
Sent: Thursday, September 15, 2022 4:58 PM

Previously the PCI PASID and PRI capabilities are enabled in the path of iommu device probe only if INTEL_IOMMU_SVM is configured and the device supports ATS. As we've already decoupled the I/O page fault handler from SVA, we could also decouple PASID and PRI enabling from it to make room for growth of new features like kernel DMA with PASID, SIOV and nested translation.

Quoted 6 lines

At the same time, the iommu_enable_dev_iotlb() helper is also called in iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_SVA) path. It's unnecessary
and duplicate. This cleanups this helper to make the code neat.