From: Marcelo Tosatti <[EMAIL PROTECTED]>

kvm_arch_load_regs() might load APIC base and APIC TPR from the
uninitialized userspace APIC emulation.

This happened when running X11 on SMP guest in my case, disabling the
APIC for vcpu3:

vcpu not ready for apic_round_robin
vcpu not ready for apic_round_robin
vcpu not ready for apic_round_robin
...

Signed-off-by: Marcelo Tosatti <[EMAIL PROTECTED]>
Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>

diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 35fb535..3d3878a 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -248,9 +248,15 @@ void kvm_arch_load_regs(CPUState *env)
     sregs.cr3 = env->cr[3];
     sregs.cr4 = env->cr[4];
 
-    sregs.apic_base = cpu_get_apic_base(env);
+    if (kvm_irqchip_in_kernel(kvm_context)) {
+        sregs.cr8 = kvm_get_cr8(kvm_context, env->cpu_index);
+        sregs.apic_base = kvm_get_apic_base(kvm_context, env->cpu_index);
+    } else {
+        sregs.cr8 = cpu_get_apic_tpr(env);
+        sregs.apic_base = cpu_get_apic_base(env);
+    }
+
     sregs.efer = env->efer;
-    sregs.cr8 = cpu_get_apic_tpr(env);
 
     kvm_set_sregs(kvm_context, env->cpu_index, &sregs);
 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-commits mailing list
kvm-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-commits

Reply via email to