From: Avi Kivity Subject: [PATCH] kvm: clear vapic after reset Date: Tue, 16 Nov 2010 16:33:51 +0200 Message-ID: <1289918031-27546-1-git-send-email-avi@redhat.com> To: kvm@vger.kernel.org, Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:61064 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933174Ab0KPOdy (ORCPT ); Tue, 16 Nov 2010 09:33:54 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAGEXrWf018131 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 16 Nov 2010 09:33:53 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oAGEXqK2015968 for ; Tue, 16 Nov 2010 09:33:53 -0500 Sender: kvm-owner@vger.kernel.org List-ID: Clear the vapic address immediately after reset. This allows dual-boot guests to work efficiently, and more importantly, works around the bios using 'rep insb' to read in the option rom and confusing the vapic machinery. Signed-off-by: Avi Kivity --- target-i386/kvm.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index b7b2430..95e5d02 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -439,8 +439,20 @@ int kvm_arch_init_vcpu(CPUState *env) return kvm_vcpu_ioctl(env, KVM_SET_CPUID2, &cpuid_data); } +static void kvm_clear_vapic(CPUState *env) +{ +#ifdef KVM_SET_VAPIC_ADDR + struct kvm_vapic_addr va = { + .vapic_addr = 0, + }; + + kvm_vcpu_ioctl(env, KVM_SET_VAPIC_ADDR, &va); +#endif +} + void kvm_arch_reset_vcpu(CPUState *env) { + kvm_clear_vapic(env); env->exception_injected = -1; env->interrupt_injected = -1; env->nmi_injected = 0; -- 1.7.3.1