kvm: nVMX: fix entry with pending interrupt if APICv is enabled
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 3 Oct 2018 11:44:26 +0000 (13:44 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 4 Oct 2018 15:10:40 +0000 (17:10 +0200)
commit7e7126846c95a34f98a1524d5c473af1f0783735
tree7bc04aa69fde69d85d83112eee7c17993dd948b3
parent2cf7ea9f40fabee0f8b40db4eb2d1e85cc6c0a95
kvm: nVMX: fix entry with pending interrupt if APICv is enabled

Commit b5861e5cf2fcf83031ea3e26b0a69d887adf7d21 introduced a check on
the interrupt-window and NMI-window CPU execution controls in order to
inject an external interrupt vmexit before the first guest instruction
executes.  However, when APIC virtualization is enabled the host does not
need a vmexit in order to inject an interrupt at the next interrupt window;
instead, it just places the interrupt vector in RVI and the processor will
inject it as soon as possible.  Therefore, on machines with APICv it is
not enough to check the CPU execution controls: the same scenario can also
happen if RVI>vPPR.

Fixes: b5861e5cf2fcf83031ea3e26b0a69d887adf7d21
Reviewed-by: Nikita Leshchenko <nikita.leshchenko@oracle.com>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Liran Alon <liran.alon@oracle.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c