Skip to content

Commit 4191db2

Browse files
schnhrrbonzini
authored andcommitted
KVM: x86: Update APICv on APIC reset
In kvm_apic_set_state() we update the hardware virtualized APIC after the full APIC state has been overwritten. Do the same, when the full APIC state has been reset in kvm_lapic_reset(). This updates some hardware state that was previously forgotten, as far as I can tell. Also, this allows removing some APIC-related reset code from vmx_vcpu_reset(). Signed-off-by: Jan H. Schönherr <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent a488848 commit 4191db2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

arch/x86/kvm/lapic.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,6 +1992,11 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event)
19921992
vcpu->arch.apic_base | MSR_IA32_APICBASE_BSP);
19931993
vcpu->arch.pv_eoi.msr_val = 0;
19941994
apic_update_ppr(apic);
1995+
if (vcpu->arch.apicv_active) {
1996+
kvm_x86_ops->apicv_post_state_restore(vcpu);
1997+
kvm_x86_ops->hwapic_irr_update(vcpu, -1);
1998+
kvm_x86_ops->hwapic_isr_update(vcpu, -1);
1999+
}
19952000

19962001
vcpu->arch.apic_arb_prio = 0;
19972002
vcpu->arch.apic_attention = 0;

arch/x86/kvm/vmx.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5619,11 +5619,6 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
56195619

56205620
kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu);
56215621

5622-
if (kvm_vcpu_apicv_active(vcpu)) {
5623-
pi_clear_on(&vmx->pi_desc);
5624-
memset(vmx->pi_desc.pir, 0, sizeof(vmx->pi_desc.pir));
5625-
}
5626-
56275622
if (vmx->vpid != 0)
56285623
vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
56295624

0 commit comments

Comments
 (0)