From: Ben Hutchings Date: Tue, 20 Aug 2019 23:32:16 +0000 (+0100) Subject: intel-iommu: Add Kconfig option to exclude iGPU by default X-Git-Tag: archive/raspbian/5.2.17-1+rpi1^2~89 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0f4e8baeed82e377abac6e7e5d9a85014e8db287;p=linux.git intel-iommu: Add Kconfig option to exclude iGPU by default There is still laptop firmware that touches the integrated GPU behind the operating system's back, and doesn't say so in the RMRR table. Enabling the IOMMU for all devices causes breakage. Replace CONFIG_INTEL_IOMMU_DEFAULT_ON with a 3-way choice corresponding to "on", "off", and "on,intgpu_off". Signed-off-by: Ben Hutchings Gbp-Pq: Topic features/x86 Gbp-Pq: Name intel-iommu-add-kconfig-option-to-exclude-igpu-by-default.patch --- diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 83664db5221..af376b14b0f 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -212,14 +212,28 @@ config INTEL_IOMMU_SVM to access DMA resources through process address space by means of a Process Address Space ID (PASID). -config INTEL_IOMMU_DEFAULT_ON - def_bool y - prompt "Enable Intel DMA Remapping Devices by default" - depends on INTEL_IOMMU +if INTEL_IOMMU + +choice + prompt "Default state of Intel DMA Remapping Devices" + default INTEL_IOMMU_DEFAULT_ON help - Selecting this option will enable a DMAR device at boot time if - one is found. If this option is not selected, DMAR support can - be enabled by passing intel_iommu=on to the kernel. + Choose whether Intel DMA Remapping Devices should be enabled + by default. This can be overridden at boot time using the + intel_iommu= kernel parameter. + +config INTEL_IOMMU_DEFAULT_ON + bool "Enable" + +config INTEL_IOMMU_DEFAULT_ON_INTGPU_OFF + bool "Enable, excluding integrated GPU" + +config INTEL_IOMMU_DEFAULT_OFF + bool "Disable" + +endchoice + +endif config INTEL_IOMMU_BROKEN_GFX_WA bool "Workaround broken graphics drivers (going away soon)" diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index c0ef6493033..bf0131e7470 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -346,17 +346,13 @@ static void domain_context_clear(struct intel_iommu *iommu, static int domain_detach_iommu(struct dmar_domain *domain, struct intel_iommu *iommu); -#ifdef CONFIG_INTEL_IOMMU_DEFAULT_ON -int dmar_disabled = 0; -#else -int dmar_disabled = 1; -#endif /*CONFIG_INTEL_IOMMU_DEFAULT_ON*/ +int dmar_disabled = IS_ENABLED(CONFIG_INTEL_IOMMU_DEFAULT_OFF); int intel_iommu_enabled = 0; EXPORT_SYMBOL_GPL(intel_iommu_enabled); static int dmar_map_gfx = 1; -static int dmar_map_intgpu = 1; +static int dmar_map_intgpu = IS_ENABLED(CONFIG_INTEL_IOMMU_DEFAULT_ON); static int dmar_forcedac; static int intel_iommu_strict; static int intel_iommu_superpage = 1; @@ -437,6 +433,7 @@ static int __init intel_iommu_setup(char *str) while (*str) { if (!strncmp(str, "on", 2)) { dmar_disabled = 0; + dmar_map_intgpu = 1; pr_info("IOMMU enabled\n"); } else if (!strncmp(str, "off", 3)) { dmar_disabled = 1;