KVM: nVMX: Fold requested virtual interrupt check into has_nested_events()
authorSean Christopherson <seanjc@google.com>
Fri, 7 Jun 2024 17:26:08 +0000 (10:26 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 28 Jun 2024 15:59:06 +0000 (08:59 -0700)
commit321ef62b0c5f6f57bb8500a2ca5986052675abbf
tree5aa8d3c048009b9988a0f071a4d3d3983febe3a1
parent27c4fa42b11af780d49ce704f7fa67b3c2544df4
KVM: nVMX: Fold requested virtual interrupt check into has_nested_events()

Check for a Requested Virtual Interrupt, i.e. a virtual interrupt that is
pending delivery, in vmx_has_nested_events() and drop the one-off
kvm_x86_ops.guest_apic_has_interrupt() hook.

In addition to dropping a superfluous hook, this fixes a bug where KVM
would incorrectly treat virtual interrupts _for L2_ as always enabled due
to kvm_arch_interrupt_allowed(), by way of vmx_interrupt_blocked(),
treating IRQs as enabled if L2 is active and vmcs12 is configured to exit
on IRQs, i.e. KVM would treat a virtual interrupt for L2 as a valid wake
event based on L1's IRQ blocking status.

Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240607172609.3205077-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/kvm-x86-ops.h
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/vmx/main.c
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/x86_ops.h
arch/x86/kvm/x86.c