linux/arch/x86/kvm/svm
Paolo Bonzini 37c4dbf337 KVM: x86: check PIR even for vCPUs with disabled APICv
The IRTE for an assigned device can trigger a POSTED_INTR_VECTOR even
if APICv is disabled on the vCPU that receives it.  In that case, the
interrupt will just cause a vmexit and leave the ON bit set together
with the PIR bit corresponding to the interrupt.

Right now, the interrupt would not be delivered until APICv is re-enabled.
However, fixing this is just a matter of always doing the PIR->IRR
synchronization, even if the vCPU has temporarily disabled APICv.

This is not a problem for performance, or if anything it is an
improvement.  First, in the common case where vcpu->arch.apicv_active is
true, one fewer check has to be performed.  Second, static_call_cond will
elide the function call if APICv is not present or disabled.  Finally,
in the case for AMD hardware we can remove the sync_pir_to_irr callback:
it is only needed for apic_has_interrupt_for_ppr, and that function
already has a fallback for !APICv.

Cc: stable@vger.kernel.org
Co-developed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: David Matlack <dmatlack@google.com>
Message-Id: <20211123004311.2954158-4-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-11-30 03:52:39 -05:00
..
avic.c KVM: x86: inhibit APICv when KVM_GUESTDBG_BLOCKIRQ active 2021-11-11 10:56:20 -05:00
nested.c nSVM: Check for reserved encodings of TLB_CONTROL in nested VMCB 2021-10-01 03:44:57 -04:00
pmu.c kvm: x86: Convert return type of *is_valid_rdpmc_ecx() to bool 2021-11-11 10:56:19 -05:00
sev.c Merge branch 'kvm-5.16-fixes' into kvm-master 2021-11-18 02:11:57 -05:00
svm_onhyperv.c KVM: SVM: hyper-v: Direct Virtual Flush support 2021-06-17 13:09:38 -04:00
svm_onhyperv.h KVM: SVM: delay svm_vcpu_init_msrpm after svm->vmcb is initialized 2021-07-27 16:59:00 -04:00
svm_ops.h x86/kvm: Always inline vmload() / vmsave() 2021-09-15 15:51:45 +02:00
svm.c KVM: x86: check PIR even for vCPUs with disabled APICv 2021-11-30 03:52:39 -05:00
svm.h Merge branch 'kvm-5.16-fixes' into kvm-master 2021-11-18 02:11:57 -05:00
vmenter.S KVM/SVM: Move vmenter.S exception fixups out of line 2021-03-15 04:43:56 -04:00