Skip to contentSkip to conversation

kvm: clear vapic after reset

PATCH New Avi Kivity 1 participant 1 message Nov 16, 2010 KVM

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 kvm: clear vapic after reset

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.

---
 target-i386/kvm.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
target-i386/kvm.c +12 -0
index b7b2430..95e5d02 100644
@@ -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;
Signature · 1 line
1.7.3.1