From: Uri Lublin <[EMAIL PROTECTED]>

Moved lm_capable_kernel initialization to kvm_arch_qemu_create_context() from
do_cpuid_ent():
1. Its a (static) global variable which does not depend on env.
2. It affects loadvm (what MSRs will be loaded to KVM).

With this change, 64bit guests do no longer crash after migration.

Signed-off-by: Uri Lublin <[EMAIL PROTECTED]>
Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>

diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index d1838f1..39c5336 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -27,6 +27,11 @@ static int lm_capable_kernel;
 int kvm_arch_qemu_create_context(void)
 {
     int i;
+    struct utsname utsname;
+
+    uname(&utsname);
+    lm_capable_kernel = strcmp(utsname.machine, "x86_64") == 0;
+
     if (kvm_shadow_memory)
         kvm_set_shadow_pages(kvm_context, kvm_shadow_memory);
 
@@ -472,11 +477,8 @@ static void do_cpuid_ent(struct kvm_cpuid_entry *e, 
uint32_t function,
     e->edx = env->regs[R_EDX];
     if (function == 0x80000001) {
        uint32_t h_eax, h_edx;
-       struct utsname utsname;
 
        host_cpuid(function, &h_eax, NULL, NULL, &h_edx);
-       uname(&utsname);
-       lm_capable_kernel = strcmp(utsname.machine, "x86_64") == 0;
 
        // long mode
        if ((h_edx & 0x20000000) == 0 || !lm_capable_kernel)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-commits mailing list
kvm-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-commits

Reply via email to