iommu/vt-d: Allow devices with RMRRs to use identity domain
PATCH 1/2 iommu/vt-d: Allow devices with RMRRs to use identity domain
Since commit ea2447f700cab ("intel-iommu: Prevent devices with RMRRs from being placed into SI Domain"), the Intel IOMMU driver doesn't allow any devices with RMRR locked to use the identity domain. This was added to to fix the issue where the RMRR info for devices being placed in and out of the identity domain gets lost. This identity maps all RMRRs when setting up the identity domain, so that devices with RMRRs could also use it.
--- drivers/iommu/intel-iommu.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/iommu/intel-iommu.c +2 -13
@@ -2893,10 +2893,8 @@ static int __init si_domain_init(int hw) }/* -* Normally we use DMA domains for devices which have RMRRs. But we -* loose this requirement for graphic and usb devices. Identity map -* the RMRRs for graphic and USB devices so that they could use the -* si_domain. +* Identity map the RMRRs so that devices with RMRRs could also use +* the si_domain. */ for_each_rmrr_units (rmrr) { for_each_active_dev_scope(rmrr->devices, rmrr->devices_cnt,
@@ -2904,9 +2902,6 @@ static int __init si_domain_init(int hw)unsigned long long start = rmrr->base_address;unsigned long long end = rmrr->end_address; -if (device_is_rmrr_locked (dev)) -continue ; -if (WARN_ON (end < start || end >>agaw_to_width (si_domain->agaw)))continue ;
@@ -3045,9 +3040,6 @@ static int device_def_domain_type(struct device *dev)if (dev_is_pci (dev)) {struct pci_dev *pdev =to_pci_dev (dev); -if (device_is_rmrr_locked (dev)) -return IOMMU_DOMAIN_DMA ; -/* * Prevent any device marked as untrusted from getting * placed into the statically identity mapping domain.
@@ -3085,9 +3077,6 @@ static int device_def_domain_type(struct device *dev)return IOMMU_DOMAIN_DMA ; }else if (pci_pcie_type (pdev) ==PCI_EXP_TYPE_PCI_BRIDGE )return IOMMU_DOMAIN_DMA ; - }else { -if (device_has_rmrr (dev)) -return IOMMU_DOMAIN_DMA ; } return (iommu_identity_mapping & IDENTMAP_ALL) ?
Signature · 1 line
2.17.1
PATCH 2/2 iommu/vt-d: Unnecessary to handle default identity domain
The iommu default domain framework has been designed to take care of setting identity default domain type. It's unnecessary to handle this again in the VT-d driver. Hence, remove it.
--- drivers/iommu/intel-iommu.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/iommu/intel-iommu.c +2 -7
@@ -387,7 +387,6 @@ static int intel_iommu_superpage = 1;static int iommu_identity_mapping;static int intel_no_bounce; -#define IDENTMAP_ALL 1#define IDENTMAP_GFX 2#define IDENTMAP_AZALIA 4
@@ -3079,8 +3078,7 @@ static int device_def_domain_type(struct device *dev)return IOMMU_DOMAIN_DMA ; } -return (iommu_identity_mapping &IDENTMAP_ALL ) ? -IOMMU_DOMAIN_IDENTITY :0 ; +return 0 ; }static void intel_iommu_init_qi (struct intel_iommu *iommu)
@@ -3424,9 +3422,6 @@ static int __init init_dmars(void) iommu->flush.flush_iotlb (iommu,0 ,0 ,0 ,DMA_TLB_GLOBAL_FLUSH ); } -if (iommu_default_passthrough ()) - iommu_identity_mapping |=IDENTMAP_ALL ; -#ifdef CONFIG_INTEL_IOMMU_BROKEN_GFX_WA dmar_map_gfx =0 ;#endif
@@ -5017,7 +5012,7 @@ static int __init platform_optin_force_iommu(void)* map for all devices except those marked as being untrusted. */ if (dmar_disabled) - iommu_identity_mapping |=IDENTMAP_ALL ; +iommu_set_default_passthrough (false); dmar_disabled =0 ; no_iommu =0 ;
Signature · 1 line
2.17.1