KVM: x86: Move delivery of non-APICv interrupt into vendor code
authorSean Christopherson <seanjc@google.com>
Fri, 28 Jan 2022 00:51:48 +0000 (00:51 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 1 Feb 2022 11:03:41 +0000 (06:03 -0500)
commit57dfd7b53dec740afe402135fdd1c5708ec337f0
tree7743ef4097baba4cafd05bcafd9a20d56aa7c774
parentf6c6804c43fa18d3cee64b55490dfbd3bef1363a
KVM: x86: Move delivery of non-APICv interrupt into vendor code

Handle non-APICv interrupt delivery in vendor code, even though it means
VMX and SVM will temporarily have duplicate code.  SVM's AVIC has a race
condition that requires KVM to fall back to legacy interrupt injection
_after_ the interrupt has been logged in the vIRR, i.e. to fix the race,
SVM will need to open code the full flow anyways[*].  Refactor the code
so that the SVM bug without introducing other issues, e.g. SVM would
return "success" and thus invoke trace_kvm_apicv_accept_irq() even when
delivery through the AVIC failed, and to opportunistically prepare for
using KVM_X86_OP to fill each vendor's kvm_x86_ops struct, which will
rely on the vendor function matching the kvm_x86_op pointer name.

No functional change intended.

[*] https://lore.kernel.org/all/20211213104634.199141-4-mlevitsk@redhat.com

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220128005208.4008533-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm-x86-ops.h
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/lapic.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/vmx.c