]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: VMX: Prepare VMCS setting for posted interrupt enabling when APICv is available
authorZeng Guang <guang.zeng@intel.com>
Tue, 15 Mar 2022 14:58:36 +0000 (22:58 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 2 Apr 2022 09:41:19 +0000 (05:41 -0400)
Currently KVM setup posted interrupt VMCS only depending on
per-vcpu APICv activation status at the vCPU creation time.
However, this status can be toggled dynamically under some
circumstance. So potentially, later posted interrupt enabling
may be problematic without VMCS readiness.

To fix this, always settle the VMCS setting for posted interrupt
as long as APICv is available and lapic locates in kernel.

Signed-off-by: Zeng Guang <guang.zeng@intel.com>
Message-Id: <20220315145836.9910-1-guang.zeng@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.c

index 04d170c4b61eb48688b85d60b961d5b539509cb4..c654c9d76e09bbd7e8f12992d0440c7617d69799 100644 (file)
@@ -4380,7 +4380,7 @@ static void init_vmcs(struct vcpu_vmx *vmx)
        if (cpu_has_secondary_exec_ctrls())
                secondary_exec_controls_set(vmx, vmx_secondary_exec_control(vmx));
 
-       if (kvm_vcpu_apicv_active(&vmx->vcpu)) {
+       if (enable_apicv && lapic_in_kernel(&vmx->vcpu)) {
                vmcs_write64(EOI_EXIT_BITMAP0, 0);
                vmcs_write64(EOI_EXIT_BITMAP1, 0);
                vmcs_write64(EOI_EXIT_BITMAP2, 0);