From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: QEMU/KVM: make kvm_arch_load_regs() aware of in kernel APIC Date: Thu, 3 Apr 2008 20:24:37 -0300 Message-ID: <20080403232437.GA24568@dmt> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel To: Anthony Liguori , Avi Kivity Return-path: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org 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 diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c index 78490c5..401fbc6 100644 --- a/qemu/qemu-kvm-x86.c +++ b/qemu/qemu-kvm-x86.c @@ -250,9 +250,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); ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace