RE: [ANNOUNCE] kvm-73 release

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Avi 
   A updated version. Please review again. Thanks.
Xiantao
>From 689bdb4c0506a1b6b24e9c481634593052ee2cc0 Mon Sep 17 00:00:00 2001
From: Xiantao Zhang <xiantao.zhang@xxxxxxxxx>
Date: Tue, 26 Aug 2008 19:20:03 +0800
Subject: [PATCH] KVM: external module: keep kvm/ia64 compatible with
Linux-2.6.26 and newer version.

Add some compatibility hack for Linux-2.6.26 and newer versions for ia64
Signed-off-by: Xiantao Zhang <xiantao.zhang@xxxxxxxxx>
---
 kernel/Makefile                           |    4 ++--
 kernel/external-module-compat-comm.h      |    1 -
 kernel/{x86 => }/external-module-compat.c |    0 
 kernel/ia64/Kbuild                        |    3 ++-
 kernel/ia64/external-module-compat.h      |   16 ++++++++++++++++
 kernel/ia64/hack-module.awk               |   14 ++++++++++++++
 kernel/x86/Kbuild                         |    6 +++---
 kernel/x86/external-module-compat.h       |    1 +
 kernel/{ => x86}/hack-module.awk          |    0 
 9 files changed, 38 insertions(+), 7 deletions(-)
 rename kernel/{x86 => }/external-module-compat.c (100%)
 create mode 100644 kernel/ia64/hack-module.awk
 rename kernel/{ => x86}/hack-module.awk (100%)

diff --git a/kernel/Makefile b/kernel/Makefile
index 6f8cc9d..3f5f6da 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -19,7 +19,7 @@ LINUX = ../linux-2.6
 version = $(shell cd $(LINUX); git describe)
 
 _hack = mv $1 $1.orig && \
-	gawk -v version=$(version) -f hack-module.awk $1.orig \
+	gawk -v version=$(version) -f $(ARCH_DIR)/hack-module.awk
$1.orig \
 	    | sed '/\#include/! s/\blapic\b/l_apic/g' > $1 && rm $1.orig
 
 unifdef = mv $1 $1.orig && \
@@ -29,7 +29,7 @@ unifdef = mv $1 $1.orig && \
 hack = $(call _hack,$T/$(strip $1))
 
 hack-files-x86 = kvm_main.c mmu.c vmx.c svm.c x86.c irq.h lapic.c
i8254.c
-hack-files-ia64 =
+hack-files-ia64 = kvm_main.c kvm_fw.c
 
 hack-files = $(hack-files-$(ARCH_DIR))
 
diff --git a/kernel/external-module-compat-comm.h
b/kernel/external-module-compat-comm.h
index 97e921b..2e87c57 100644
--- a/kernel/external-module-compat-comm.h
+++ b/kernel/external-module-compat-comm.h
@@ -17,7 +17,6 @@
 #include <asm/processor.h>
 #include <linux/hrtimer.h>
 #include <asm/bitops.h>
-#include <asm/msr.h>
 
 /*
  * 2.6.16 does not have GFP_NOWAIT
diff --git a/kernel/x86/external-module-compat.c
b/kernel/external-module-compat.c
similarity index 100%
rename from kernel/x86/external-module-compat.c
rename to kernel/external-module-compat.c
diff --git a/kernel/ia64/Kbuild b/kernel/ia64/Kbuild
index 764a493..8561476 100644
--- a/kernel/ia64/Kbuild
+++ b/kernel/ia64/Kbuild
@@ -1,6 +1,7 @@
 obj-m := kvm.o kvm-intel.o
 
-kvm-objs := kvm_main.o ioapic.o coalesced_mmio.o kvm-ia64.o kvm_fw.o
+kvm-objs := kvm_main.o ioapic.o coalesced_mmio.o kvm-ia64.o kvm_fw.o \
+	../anon_inodes.o ../external-module-compat.o
 
 EXTRA_CFLAGS_vcpu.o += -mfixed-range=f2-f5,f12-f127
 kvm-intel-objs := vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o
mmio.o \
diff --git a/kernel/ia64/external-module-compat.h
b/kernel/ia64/external-module-compat.h
index 3c4001c..2a11d39 100644
--- a/kernel/ia64/external-module-compat.h
+++ b/kernel/ia64/external-module-compat.h
@@ -2,8 +2,11 @@
  * Compatibility header for building as an external module.
  */
 
+#ifndef __ASSEMBLY__
 #include <linux/version.h>
 
+#include "../external-module-compat-comm.h"
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
 #error "KVM/IA-64 Can't be compiled if kernel version < 2.6.26"
 #endif
@@ -13,3 +16,16 @@
   TODO: Implement it later! */
 #error "KVM/IA-64 depends on preempt notifiers in kernel."
 #endif
+
+/* smp_call_function() lost an argument in 2.6.27. */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
+
+#define kvm_smp_call_function(func, info, wait) smp_call_function(func,
info, 0, wait)
+
+#else
+
+#define kvm_smp_call_function(func, info, wait) smp_call_function(func,
info, wait)
+
+#endif
+
+#endif
diff --git a/kernel/ia64/hack-module.awk b/kernel/ia64/hack-module.awk
new file mode 100644
index 0000000..b9b24c0
--- /dev/null
+++ b/kernel/ia64/hack-module.awk
@@ -0,0 +1,14 @@
+BEGIN { split("INIT_WORK on_each_cpu smp_call_function" , compat_apis);
}
+
+/MODULE_AUTHOR/ {
+    printf("MODULE_INFO(version, \"%s\");\n", version)
+}
+
+{
+    for (i in compat_apis) {
+	ident = compat_apis[i]
+	sub("\\<" ident "\\>", "kvm_" ident)
+    }
+}
+
+{ print }
diff --git a/kernel/x86/Kbuild b/kernel/x86/Kbuild
index ee81a1e..8dc0483 100644
--- a/kernel/x86/Kbuild
+++ b/kernel/x86/Kbuild
@@ -1,11 +1,11 @@
 obj-m := kvm.o kvm-intel.o kvm-amd.o
 kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o ../anon_inodes.o irq.o
i8259.o \
 	 lapic.o ioapic.o preempt.o i8254.o coalesced_mmio.o \
-	 external-module-compat.o
+	 ../external-module-compat.o
 ifeq ($(CONFIG_KVM_TRACE),y)
 kvm-objs += kvm_trace.o
 endif
-kvm-intel-objs := vmx.o vmx-debug.o external-module-compat.o
-kvm-amd-objs := svm.o external-module-compat.o
+kvm-intel-objs := vmx.o vmx-debug.o ../external-module-compat.o
+kvm-amd-objs := svm.o ../external-module-compat.o
 
 CFLAGS_kvm_main.o = -DKVM_MAIN
diff --git a/kernel/x86/external-module-compat.h
b/kernel/x86/external-module-compat.h
index f6e3e34..0b70a53 100644
--- a/kernel/x86/external-module-compat.h
+++ b/kernel/x86/external-module-compat.h
@@ -5,6 +5,7 @@
 
 #include <linux/compiler.h>
 #include <linux/version.h>
+#include <asm/msr.h>
 
 #include "../external-module-compat-comm.h"
 
diff --git a/kernel/hack-module.awk b/kernel/x86/hack-module.awk
similarity index 100%
rename from kernel/hack-module.awk
rename to kernel/x86/hack-module.awk
-- 
1.5.1

Zhang, Xiantao wrote:
> Avi Kivity wrote:
>> Avi Kivity wrote:
>>> Zhang, Xiantao wrote:
>>>> Hi, Avi    Since ia64 has supported userspace's build, could we
>>>> include ia64 bits in next release?
>>> 
>>> I updated my scripts.  I'll send you a test tarball via private mail
>>> to see I hadn't missed any files.
>>> 
>> 
>> Better a link: http://userweb.kernel.org/~avi/test.tar.gz
> Hi, Avi
>      You may need to apply this patch, and regenerate the package
> again to keep kvm/ia64 compatible with Linux-2.6.26 and newer
> versions. :) Thannks
> Xiantao
> 

Attachment: 0001-KVM-external-module-keep-kvm-ia64-compatible-with.patch
Description: 0001-KVM-external-module-keep-kvm-ia64-compatible-with.patch


[Index of Archives]     [Linux KVM Devel]     [Linux Virtualization]     [Big List of Linux Books]     [Linux SCSI]     [Yosemite Forum]

  Powered by Linux