iommu: Fix compilation without CONFIG_IOMMU_INTEL
authorBert Karwatzki <spasswolf@web.de>
Thu, 7 Mar 2024 19:44:19 +0000 (20:44 +0100)
committerJoerg Roedel <jroedel@suse.de>
Fri, 8 Mar 2024 08:03:18 +0000 (09:03 +0100)
When the kernel is comiled with CONFIG_IRQ_REMAP=y but without
CONFIG_IOMMU_INTEL compilation fails since commit def054b01a8678 with an
undefined reference to device_rbtree_find(). This patch makes sure that
intel specific code is only compiled with CONFIG_IOMMU_INTEL=y.

Signed-off-by: Bert Karwatzki <spasswolf@web.de>
Fixes: 80a9b50c0b9e ("iommu/vt-d: Improve ITE fault handling if target device isn't present")
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20240307194419.15801-1-spasswolf@web.de
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/Kconfig
drivers/iommu/intel/Makefile
drivers/iommu/irq_remapping.c

index 9a29d742617e3d34e3c9a28d25857230b06d2a68..9dbb55e745bd93468f3fa5b9e5870dd72f995ddb 100644 (file)
@@ -196,7 +196,7 @@ source "drivers/iommu/iommufd/Kconfig"
 config IRQ_REMAP
        bool "Support for Interrupt Remapping"
        depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI
-       select DMAR_TABLE
+       select DMAR_TABLE if INTEL_IOMMU
        help
          Supports Interrupt remapping for IO-APIC and MSI devices.
          To use x2apic mode in the CPU's which support x2APIC enhancements or
index 5dabf081a779353b2efead1db02918f3a7c9f91a..5402b699a1229ba0299a05c01470cd1c3ec25144 100644 (file)
@@ -5,5 +5,7 @@ obj-$(CONFIG_DMAR_TABLE) += trace.o cap_audit.o
 obj-$(CONFIG_DMAR_PERF) += perf.o
 obj-$(CONFIG_INTEL_IOMMU_DEBUGFS) += debugfs.o
 obj-$(CONFIG_INTEL_IOMMU_SVM) += svm.o
+ifdef CONFIG_INTEL_IOMMU
 obj-$(CONFIG_IRQ_REMAP) += irq_remapping.o
+endif
 obj-$(CONFIG_INTEL_IOMMU_PERF_EVENTS) += perfmon.o
index 83314b9d8f38bfcf63652ddb63e5c4c05d4c7f93..ee59647c20501ec29792a19b381b0d133313cac8 100644 (file)
@@ -99,7 +99,8 @@ int __init irq_remapping_prepare(void)
        if (disable_irq_remap)
                return -ENOSYS;
 
-       if (intel_irq_remap_ops.prepare() == 0)
+       if (IS_ENABLED(CONFIG_INTEL_IOMMU) &&
+           intel_irq_remap_ops.prepare() == 0)
                remap_ops = &intel_irq_remap_ops;
        else if (IS_ENABLED(CONFIG_AMD_IOMMU) &&
                 amd_iommu_irq_ops.prepare() == 0)