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 >From e552da3b1e7d2d30bcd09982d313ebf74c348be1 Mon Sep 17 00:00:00 2001 From: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> Date: Fri, 22 Aug 2008 11:07:37 +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 | 13 ------------- kernel/ia64/Kbuild | 2 +- kernel/ia64/external-module-compat.h | 34 ++++++++++++++++++++++++++++++++++ kernel/ia64/hack-module.awk | 14 ++++++++++++++ kernel/x86/external-module-compat.h | 14 ++++++++++++++ kernel/{ => x86}/hack-module.awk | 0 7 files changed, 65 insertions(+), 16 deletions(-) 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..fcffb1f 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 @@ -40,18 +39,6 @@ #define prof_on 4321 #endif -/* - * smp_call_function_single() is not exported below 2.6.20, and has different - * semantics below 2.6.23. The 'nonatomic' argument was removed in 2.6.27. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) - -int kvm_smp_call_function_single(int cpu, void (*func)(void *info), - void *info, int wait); - -#define smp_call_function_single kvm_smp_call_function_single - -#endif /* on_each_cpu() lost an argument in 2.6.27. */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) diff --git a/kernel/ia64/Kbuild b/kernel/ia64/Kbuild index 764a493..50af491 100644 --- a/kernel/ia64/Kbuild +++ b/kernel/ia64/Kbuild @@ -1,6 +1,6 @@ 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 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..1f8dc9b 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,34 @@ TODO: Implement it later! */ #error "KVM/IA-64 depends on preempt notifiers in kernel." #endif + +/* on_each_cpu() 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 + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + +/* The 'nonatomic' argument was removed in 2.6.27. */ + +#undef smp_call_function_single + +#include <linux/smp.h> + +static inline int kvm_smp_call_function_single(int cpu, void (*func)(void *info), + void *info, int wait) +{ + return smp_call_function_single(cpu, func, info, 0, wait); +} + +#define smp_call_function_single kvm_smp_call_function_single + +#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/external-module-compat.h b/kernel/x86/external-module-compat.h index f6e3e34..8ab8f26 100644 --- a/kernel/x86/external-module-compat.h +++ b/kernel/x86/external-module-compat.h @@ -5,9 +5,23 @@ #include <linux/compiler.h> #include <linux/version.h> +#include <asm/msr.h> #include "../external-module-compat-comm.h" +/* + * smp_call_function_single() is not exported below 2.6.20, and has different + * semantics below 2.6.23. The 'nonatomic' argument was removed in 2.6.27. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + +int kvm_smp_call_function_single(int cpu, void (*func)(void *info), + void *info, int wait); + +#define smp_call_function_single kvm_smp_call_function_single + +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) #ifndef _EFER_SCE 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
Attachment:
0002-KVM-external-module-keep.patch
Description: 0002-KVM-external-module-keep.patch