intel-iommu: Add Kconfig option to exclude iGPU by default
authorBen Hutchings <ben@decadent.org.uk>
Tue, 20 Aug 2019 23:32:16 +0000 (00:32 +0100)
committerSalvatore Bonaccorso <carnil@debian.org>
Mon, 8 May 2023 20:16:50 +0000 (21:16 +0100)
Bug-Debian: https://bugs.debian.org/935270
Bug-Kali: https://bugs.kali.org/view.php?id=5644

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 <ben@decadent.org.uk>
Gbp-Pq: Topic features/x86
Gbp-Pq: Name intel-iommu-add-kconfig-option-to-exclude-igpu-by-default.patch

drivers/iommu/intel/Kconfig
drivers/iommu/intel/iommu.c

index b7dff5092fd21c06bd73e293548d3af95c7072f6..a22e816c7e6d19de0bf6d49e0fde647f5df152fe 100644 (file)
@@ -56,14 +56,25 @@ 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
-       bool "Enable Intel DMA Remapping Devices by default"
-       default y
+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
 config INTEL_IOMMU_BROKEN_GFX_WA
        bool "Workaround broken graphics drivers (going away soon)"
        depends on BROKEN && X86
index b4298212840982c406a0c32829f3b376ed5ccf09..d7361b0f110786c6a92ffbbdcc2060124bdae1ec 100644 (file)
@@ -282,14 +282,14 @@ static LIST_HEAD(dmar_satc_units);
 
 static void dmar_remove_one_dev_info(struct device *dev);
 
-int dmar_disabled = !IS_ENABLED(CONFIG_INTEL_IOMMU_DEFAULT_ON);
+int dmar_disabled = IS_ENABLED(CONFIG_INTEL_IOMMU_DEFAULT_OFF);
 int intel_iommu_sm = IS_ENABLED(CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON);
 
 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 intel_iommu_superpage = 1;
 static int iommu_identity_mapping;
 static int iommu_skip_te_disable;
@@ -327,6 +327,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;