From 36597756e589622ee6c6628efb47c1b130d5ee85 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Fri, 20 May 2011 01:18:01 +0200 Subject: x86: kvm: fix KVM build + enable auto-detection. This patch fixes the build of KVM support in the x86 emulator by copying official Ubuntu Lucid KVM headers into android/config/linux-*/ This removes the need to rely on the build machine's versions of these headers, which caused various issues. Also, by default, the emulator will now probe the system to see if it can start in KVM mode automatically. See android-kvm.c for details. You can see the result of the probing with the -verbose option. IMPORTANT NOTE: It looks like there is a bug in the KVM code when the emulator is built as a 32-bit binary, running on a 64-bit kernel, so we explicitely disable KVM when we detect this case. It's hard to tell whether this is a bug in QEMU or some versions of the KVM driver. As such, KVM only works when building the emulator as a 64-bit program. For now, this is only possible with "android-configure.sh --try-64", not the Android build system. + Add a new QEMU option (-disable-kvm) to explicitely disable KVM if needed. This is an addition to -enable-kvm which already exists (and forces usage of KVM). Change-Id: I6a397cae29ab62b1c56fce95c1ee75a4664d6688 --- target-i386/kvm.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'target-i386') diff --git a/target-i386/kvm.c b/target-i386/kvm.c index c4fd484..4b135b1 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -16,6 +16,8 @@ #include #include +#undef __user +#define __xuser /* nothing */ #include #include "qemu-common.h" @@ -117,6 +119,10 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, int reg) #endif +#ifndef KVM_MP_STATE_RUNNABLE +#define KVM_MP_STATE_RUNNABLE 0 +#endif + int kvm_arch_init_vcpu(CPUState *env) { struct { -- cgit v1.1