All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] userspace: fix module load errors with kernel 2.6.27 and DMAR enabled
@ 2008-12-15 13:54 Joerg Roedel
  2008-12-15 13:54 ` [PATCH 2/2] userspace: enable build with IOMMU_API enabled Joerg Roedel
  2009-01-21 18:12 ` [PATCH 1/2] userspace: fix module load errors with kernel 2.6.27 and DMAR enabled Joerg Roedel
  0 siblings, 2 replies; 3+ messages in thread
From: Joerg Roedel @ 2008-12-15 13:54 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm, Joerg Roedel

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] userspace: enable build with IOMMU_API enabled
  2008-12-15 13:54 [PATCH 1/2] userspace: fix module load errors with kernel 2.6.27 and DMAR enabled Joerg Roedel
@ 2008-12-15 13:54 ` Joerg Roedel
  2009-01-21 18:12 ` [PATCH 1/2] userspace: fix module load errors with kernel 2.6.27 and DMAR enabled Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2008-12-15 13:54 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm, Joerg Roedel

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 kernel/x86/Kbuild |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/kernel/x86/Kbuild b/kernel/x86/Kbuild
index faee1e7..c0776f5 100644
--- a/kernel/x86/Kbuild
+++ b/kernel/x86/Kbuild
@@ -9,7 +9,9 @@ kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o ../anon_inodes.o irq.o i8259.o
 ifeq ($(EXT_CONFIG_KVM_TRACE),y)
 kvm-objs += kvm_trace.o
 endif
-ifeq ($(CONFIG_DMAR),y)
+ifeq ($(CONFIG_IOMMU_API),y)
+kvm-objs += iommu.o
+else ifeq ($(CONFIG_DMAR),y)
 ifeq ($(KVM_USE_VTD_IOMMU),y)
 kvm-objs += vtd.o
 endif
-- 
1.5.6.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] userspace: fix module load errors with kernel 2.6.27 and DMAR enabled
  2008-12-15 13:54 [PATCH 1/2] userspace: fix module load errors with kernel 2.6.27 and DMAR enabled Joerg Roedel
  2008-12-15 13:54 ` [PATCH 2/2] userspace: enable build with IOMMU_API enabled Joerg Roedel
@ 2009-01-21 18:12 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2009-01-21 18:12 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

Hi Avi,

what about these patches?

On Mon, Dec 15, 2008 at 02:54:53PM +0100, Joerg Roedel wrote:
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> ---
>  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
> 

-- 
           | Advanced Micro Devices GmbH
 Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
 System    | 
 Research  | Geschäftsführer: Jochen Polster, Thomas M. McCoy, Giuliano Meroni
 Center    | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
           | Registergericht München, HRB Nr. 43632


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-21 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-15 13:54 [PATCH 1/2] userspace: fix module load errors with kernel 2.6.27 and DMAR enabled Joerg Roedel
2008-12-15 13:54 ` [PATCH 2/2] userspace: enable build with IOMMU_API enabled Joerg Roedel
2009-01-21 18:12 ` [PATCH 1/2] userspace: fix module load errors with kernel 2.6.27 and DMAR enabled Joerg Roedel

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.