aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/intel-iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r--drivers/pci/intel-iommu.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index ae5ccdf8b19f..5ee8305257ea 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -2127,16 +2127,18 @@ static int iommu_prepare_static_identity_mapping(void)
2127 return -EFAULT; 2127 return -EFAULT;
2128 2128
2129 for_each_pci_dev(pdev) { 2129 for_each_pci_dev(pdev) {
2130 printk(KERN_INFO "IOMMU: identity mapping for device %s\n", 2130 if (iommu_identity_mapping == 1 || IS_GFX_DEVICE(pdev)) {
2131 pci_name(pdev)); 2131 printk(KERN_INFO "IOMMU: identity mapping for device %s\n",
2132 pci_name(pdev));
2132 2133
2133 ret = domain_context_mapping(si_domain, pdev, 2134 ret = domain_context_mapping(si_domain, pdev,
2134 CONTEXT_TT_MULTI_LEVEL); 2135 CONTEXT_TT_MULTI_LEVEL);
2135 if (ret) 2136 if (ret)
2136 return ret; 2137 return ret;
2137 ret = domain_add_dev_info(si_domain, pdev); 2138 ret = domain_add_dev_info(si_domain, pdev);
2138 if (ret) 2139 if (ret)
2139 return ret; 2140 return ret;
2141 }
2140 } 2142 }
2141 2143
2142 return 0; 2144 return 0;
@@ -2291,6 +2293,10 @@ int __init init_dmars(void)
2291 * identity mapping if iommu_identity_mapping is set. 2293 * identity mapping if iommu_identity_mapping is set.
2292 */ 2294 */
2293 if (!iommu_pass_through) { 2295 if (!iommu_pass_through) {
2296#ifdef CONFIG_DMAR_BROKEN_GFX_WA
2297 if (!iommu_identity_mapping)
2298 iommu_identity_mapping = 2;
2299#endif
2294 if (iommu_identity_mapping) 2300 if (iommu_identity_mapping)
2295 iommu_prepare_static_identity_mapping(); 2301 iommu_prepare_static_identity_mapping();
2296 /* 2302 /*
@@ -2444,7 +2450,10 @@ static int iommu_dummy(struct pci_dev *pdev)
2444 2450
2445static int iommu_should_identity_map(struct pci_dev *pdev) 2451static int iommu_should_identity_map(struct pci_dev *pdev)
2446{ 2452{
2447 return pdev->dma_mask > DMA_BIT_MASK(32); 2453 if (iommu_identity_mapping == 2)
2454 return IS_GFX_DEVICE(pdev);
2455 else
2456 return pdev->dma_mask > DMA_BIT_MASK(32);
2448} 2457}
2449 2458
2450/* Check if the pdev needs to go through non-identity map and unmap process.*/ 2459/* Check if the pdev needs to go through non-identity map and unmap process.*/