]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
KVM: x86: ignore APICv if LAPIC is not enabled
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 17 Nov 2021 12:35:44 +0000 (07:35 -0500)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:49:07 +0000 (09:49 +0100)
BugLink: https://bugs.launchpad.net/bugs/1953731
commit 78311a514099932cd8434d5d2194aa94e56ab67c upstream.

Synchronize the two calls to kvm_x86_sync_pir_to_irr.  The one
in the reenter-guest fast path invoked the callback unconditionally
even if LAPIC is present but disabled.  In this case, there are
no interrupts to deliver, and therefore posted interrupts can
be ignored.

Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
arch/x86/kvm/x86.c

index 9ec102ad0822877f17162bf3c4a4b71af945cd14..7d3a87c3bb539b9454b274043d7d07020ce49ad6 100644 (file)
@@ -9723,7 +9723,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
                if (likely(exit_fastpath != EXIT_FASTPATH_REENTER_GUEST))
                        break;
 
-               if (vcpu->arch.apicv_active)
+               if (kvm_lapic_enabled(vcpu) && vcpu->arch.apicv_active)
                        static_call(kvm_x86_sync_pir_to_irr)(vcpu);
 
                if (unlikely(kvm_vcpu_exit_request(vcpu))) {