aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2009-07-04 05:59:46 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-07-04 05:59:46 -0400
commit62edf5dc4a524e4cb525e6020b955a1ad593d9ba (patch)
treee811a942b7661fc9e97f1611ee75e7f125d51365
parent40e4aa34324bff3938a900014254f88943d05e15 (diff)
intel-iommu: Restore DMAR_BROKEN_GFX_WA option for broken graphics drivers
We need to give people a little more time to fix the broken drivers. Re-introduce this, but tied in properly with the 'iommu=pt' support this time. Change the config option name and make it default to 'no' too. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--arch/x86/Kconfig12
-rw-r--r--drivers/pci/intel-iommu.c29
2 files changed, 31 insertions, 10 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index c07f72205909..738bdc6b0f8b 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1913,6 +1913,18 @@ config DMAR_DEFAULT_ON
1913 recommended you say N here while the DMAR code remains 1913 recommended you say N here while the DMAR code remains
1914 experimental. 1914 experimental.
1915 1915
1916config DMAR_BROKEN_GFX_WA
1917 def_bool n
1918 prompt "Workaround broken graphics drivers (going away soon)"
1919 depends on DMAR
1920 ---help---
1921 Current Graphics drivers tend to use physical address
1922 for DMA and avoid using DMA APIs. Setting this config
1923 option permits the IOMMU driver to set a unity map for
1924 all the OS-visible memory. Hence the driver can continue
1925 to use physical addresses for DMA, at least until this
1926 option is removed in the 2.6.32 kernel.
1927
1916config DMAR_FLOPPY_WA 1928config DMAR_FLOPPY_WA
1917 def_bool y 1929 def_bool y
1918 depends on DMAR 1930 depends on DMAR
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.*/