aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2008-04-03 20:24:37 -0300
committerAvi Kivity <avi@qumranet.com>2008-04-05 00:22:20 +0300
commit67ff4b3c7e1ff23afe378eac193b596633580436 (patch)
tree8b7d39cdd1a39d96b3c2f8f8f12117ae50491388
parent69d4cbe4444a5b2e8e234e17d3146ebe7937ab18 (diff)
Make kvm_arch_load_regs() aware of in kernel APICkvm-65rc1kvm-65
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 <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r--qemu-kvm-x86.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 35fb53542..3d3878a06 100644
--- a/qemu-kvm-x86.c
+++ b/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);