iommu/vt-d: Decouple PASID & PRI enabling from SVA
Subsystems (2)
Lu Baolu
maintainerPATCH 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
@@ -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
@@ -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
Quoted 10 lines
From: Lu Baolu <[email protected]>
Sent: Thursday, September 15, 2022 4:58 PMPreviously the PCI PASID and PRI capabilities are enabled in the path of iommu device probe only if
INTEL_IOMMU_SVMis 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 iniommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_SVA)path. It's unnecessary
and duplicate. This cleanups this helper to make the code neat.Signed-off-by Lu Baolu <[email protected]>