Skip to content

Commit 0b2e990

Browse files
committed
KVM: x86: move LAPIC initialization after VMCS creation
The initial reset of the local APIC is performed before the VMCS has been created, but it tries to do a vmwrite: vmwrite error: reg 810 value 4a00 (err 18944) CPU: 54 PID: 38652 Comm: qemu-kvm Tainted: G W I 4.16.0-0.rc2.git0.1.fc28.x86_64 #1 Hardware name: Intel Corporation S2600CW/S2600CW, BIOS SE5C610.86B.01.01.0003.090520141303 09/05/2014 Call Trace: vmx_set_rvi [kvm_intel] vmx_hwapic_irr_update [kvm_intel] kvm_lapic_reset [kvm] kvm_create_lapic [kvm] kvm_arch_vcpu_init [kvm] kvm_vcpu_init [kvm] vmx_create_vcpu [kvm_intel] kvm_vm_ioctl [kvm] Move it later, after the VMCS has been created. Fixes: 4191db2 ("KVM: x86: Update APICv on APIC reset") Cc: [email protected] Cc: Liran Alon <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent ee1a15e commit 0b2e990

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

arch/x86/kvm/lapic.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2165,7 +2165,6 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu)
21652165
*/
21662166
vcpu->arch.apic_base = MSR_IA32_APICBASE_ENABLE;
21672167
static_key_slow_inc(&apic_sw_disabled.key); /* sw disabled at reset */
2168-
kvm_lapic_reset(vcpu, false);
21692168
kvm_iodevice_init(&apic->dev, &apic_mmio_ops);
21702169

21712170
return 0;

arch/x86/kvm/x86.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7975,6 +7975,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
79757975
kvm_vcpu_mtrr_init(vcpu);
79767976
vcpu_load(vcpu);
79777977
kvm_vcpu_reset(vcpu, false);
7978+
kvm_lapic_reset(vcpu, false);
79787979
kvm_mmu_setup(vcpu);
79797980
vcpu_put(vcpu);
79807981
return 0;

0 commit comments

Comments
 (0)