From: Bert Karwatzki <spasswolf@web.de>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Bert Karwatzki <spasswolf@web.de>,
haifeng.zhao@linux.intel.com, iommu@lists.linux.dev,
jgg@ziepe.ca, jiaqing.huang@intel.com, joro@8bytes.org,
kevin.tian@intel.com, linux-kernel@vger.kernel.org,
robin.murphy@arm.com, will@kernel.org
Subject: [PATCH] iommu: fix compilation without CONFIG_IOMMU_INTEL
Date: Thu, 7 Mar 2024 20:44:19 +0100 [thread overview]
Message-ID: <20240307194419.15801-1-spasswolf@web.de> (raw)
In-Reply-To: 20240220065939.121116-3-baolu.lu@linux.intel.com
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.
Fixes: def054b01a8678 ("iommu/vt-d: Use device rbtree in iopf reporting path")
Signed-off-by: Bert Karwatzki <spasswolf@web.de>
---
drivers/iommu/Kconfig | 2 +-
drivers/iommu/intel/Makefile | 2 ++
drivers/iommu/irq_remapping.c | 3 ++-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index e0796fa84227..0af39bbbe3a3 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -199,7 +199,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
diff --git a/drivers/iommu/intel/Makefile b/drivers/iommu/intel/Makefile
index 5dabf081a779..5402b699a122 100644
--- a/drivers/iommu/intel/Makefile
+++ b/drivers/iommu/intel/Makefile
@@ -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
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
index 83314b9d8f38..ee59647c2050 100644
--- a/drivers/iommu/irq_remapping.c
+++ b/drivers/iommu/irq_remapping.c
@@ -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)
--
2.39.2
Since commit def054b01a8678 compilation fails on x86_64 without
CONFIG_IOMMU_INTEL=y with an undefined reference to device_rbtree_find()
when linking drivers/iommu/intel/dmar.o. Even though this file is intel
specific it is compile because CONFIG_IRQ_REMAP unconditionally selects
CONFIG_DMAR_TABLE. This patch fixes this by only compiling intel
specific files when CONFIG_IOMMU_INTEL=y.
Bert Karwatzki
next reply other threads:[~2024-03-07 19:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 19:44 Bert Karwatzki [this message]
2024-03-08 1:40 ` [PATCH] iommu: fix compilation without CONFIG_IOMMU_INTEL Baolu Lu
2024-03-08 8:04 ` Joerg Roedel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240307194419.15801-1-spasswolf@web.de \
--to=spasswolf@web.de \
--cc=baolu.lu@linux.intel.com \
--cc=haifeng.zhao@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=jiaqing.huang@intel.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.