Signed-off-by: Joerg Roedel <[email protected]>
---
configure | 7 +++++++
kernel/x86/Kbuild | 2 ++
kernel/x86/external-module-compat.h | 8 ++++++++
kernel/x86/hack-module.awk | 2 ++
4 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
index 4e88961..f7c0534 100755
--- a/configure
+++ b/configure
@@ -15,6 +15,7 @@ qemu_opts=()
cross_prefix=
arch=`uname -m`
target_exec=
+kvm_vtd_iommu="n"
# don't use uname if kerneldir is set
no_uname=
depmod_version=
@@ -111,6 +112,11 @@ case $arch in
;;
esac
+# test for IOMMU support in the kernel we build for
+if [ -f "$kernelsourcedir/virt/kvm/vtd.c" ]; then
+ kvm_vtd_iommu="y"
+fi
+
processor=${arch#*-}
arch=${arch%%-*}
@@ -170,4 +176,5 @@ EOF
cat <<EOF > kernel/config.kbuild
EXT_CONFIG_KVM_TRACE=$kvm_trace
+KVM_USE_VTD_IOMMU=$kvm_vtd_iommu
EOF
diff --git a/kernel/x86/Kbuild b/kernel/x86/Kbuild
index c4723b1..faee1e7 100644
--- a/kernel/x86/Kbuild
+++ b/kernel/x86/Kbuild
@@ -10,8 +10,10 @@ ifeq ($(EXT_CONFIG_KVM_TRACE),y)
kvm-objs += kvm_trace.o
endif
ifeq ($(CONFIG_DMAR),y)
+ifeq ($(KVM_USE_VTD_IOMMU),y)
kvm-objs += vtd.o
endif
+endif
kvm-intel-objs := vmx.o vmx-debug.o ../external-module-compat.o
kvm-amd-objs := svm.o ../external-module-compat.o
diff --git a/kernel/x86/external-module-compat.h
b/kernel/x86/external-module-compat.h
index b5e11e2..ac78b81 100644
--- a/kernel/x86/external-module-compat.h
+++ b/kernel/x86/external-module-compat.h
@@ -335,6 +335,14 @@ struct kvm_desc_ptr {
#define FEATURE_CONTROL_VMXON_ENABLED (1<<2)
#endif
+#if defined(CONFIG_DMAR) || defined(CONFIG_IOMMU_API)
+#define KVM_IOMMU_SUPPORT 1
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
+#undef KVM_IOMMU_SUPPORT
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
struct mtrr_var_range {
diff --git a/kernel/x86/hack-module.awk b/kernel/x86/hack-module.awk
index 2ad0951..8d2806f 100644
--- a/kernel/x86/hack-module.awk
+++ b/kernel/x86/hack-module.awk
@@ -75,6 +75,8 @@ BEGIN { split("INIT_WORK tsc_khz desc_struct ldttss_desc64
desc_ptr " \
/\kvm_.*_fops\.owner = module;/ { $0 = "IF_ANON_INODES_DOES_REFCOUNTS(" $0 ")"
}
+{sub(/CONFIG_DMAR/, "KVM_IOMMU_SUPPORT");}
+
{ print }
/kvm_x86_ops->run/ {
--
1.5.6.4
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html