aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/lapic.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kvm/lapic.c')
-rw-r--r--arch/x86/kvm/lapic.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 924ac8ce9d50..391dda8d43b7 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -2002,14 +2002,13 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
2002 2002
2003void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event) 2003void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event)
2004{ 2004{
2005 struct kvm_lapic *apic; 2005 struct kvm_lapic *apic = vcpu->arch.apic;
2006 int i; 2006 int i;
2007 2007
2008 apic_debug("%s\n", __func__); 2008 if (!apic)
2009 return;
2009 2010
2010 ASSERT(vcpu); 2011 apic_debug("%s\n", __func__);
2011 apic = vcpu->arch.apic;
2012 ASSERT(apic != NULL);
2013 2012
2014 /* Stop the timer in case it's a reset to an active apic */ 2013 /* Stop the timer in case it's a reset to an active apic */
2015 hrtimer_cancel(&apic->lapic_timer.timer); 2014 hrtimer_cancel(&apic->lapic_timer.timer);
@@ -2165,7 +2164,6 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu)
2165 */ 2164 */
2166 vcpu->arch.apic_base = MSR_IA32_APICBASE_ENABLE; 2165 vcpu->arch.apic_base = MSR_IA32_APICBASE_ENABLE;
2167 static_key_slow_inc(&apic_sw_disabled.key); /* sw disabled at reset */ 2166 static_key_slow_inc(&apic_sw_disabled.key); /* sw disabled at reset */
2168 kvm_lapic_reset(vcpu, false);
2169 kvm_iodevice_init(&apic->dev, &apic_mmio_ops); 2167 kvm_iodevice_init(&apic->dev, &apic_mmio_ops);
2170 2168
2171 return 0; 2169 return 0;
@@ -2569,7 +2567,6 @@ void kvm_apic_accept_events(struct kvm_vcpu *vcpu)
2569 2567
2570 pe = xchg(&apic->pending_events, 0); 2568 pe = xchg(&apic->pending_events, 0);
2571 if (test_bit(KVM_APIC_INIT, &pe)) { 2569 if (test_bit(KVM_APIC_INIT, &pe)) {
2572 kvm_lapic_reset(vcpu, true);
2573 kvm_vcpu_reset(vcpu, true); 2570 kvm_vcpu_reset(vcpu, true);
2574 if (kvm_vcpu_is_bsp(apic->vcpu)) 2571 if (kvm_vcpu_is_bsp(apic->vcpu))
2575 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; 2572 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;