Skip to content

Commit 8e2b499

Browse files
committed
KVM: SVM: Process ICR on AVIC IPI delivery failure due to invalid target
jira LE-1907 Rebuild_History Non-Buildable kernel-5.14.0-284.30.1.el9_2 commit-author Sean Christopherson <[email protected]> commit 5aede75 Emulate ICR writes on AVIC IPI failures due to invalid targets using the same logic as failures due to invalid types. AVIC acceleration fails if _any_ of the targets are invalid, and crucially VM-Exits before sending IPIs to targets that _are_ valid. In logical mode, the destination is a bitmap, i.e. a single IPI can target multiple logical IDs. Doing nothing causes KVM to drop IPIs if at least one target is valid and at least one target is invalid. Fixes: 18f40c5 ("svm: Add VMEXIT handlers for AVIC") Cc: [email protected] Reviewed-by: Paolo Bonzini <[email protected]> Reviewed-by: Maxim Levitsky <[email protected]> Signed-off-by: Sean Christopherson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> (cherry picked from commit 5aede75) Signed-off-by: Jonathan Maple <[email protected]>
1 parent d852c4e commit 8e2b499

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

arch/x86/kvm/svm/avic.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -502,14 +502,18 @@ int avic_incomplete_ipi_interception(struct kvm_vcpu *vcpu)
502502
trace_kvm_avic_incomplete_ipi(vcpu->vcpu_id, icrh, icrl, id, index);
503503

504504
switch (id) {
505+
case AVIC_IPI_FAILURE_INVALID_TARGET:
505506
case AVIC_IPI_FAILURE_INVALID_INT_TYPE:
506507
/*
507508
* Emulate IPIs that are not handled by AVIC hardware, which
508-
* only virtualizes Fixed, Edge-Triggered INTRs. The exit is
509-
* a trap, e.g. ICR holds the correct value and RIP has been
510-
* advanced, KVM is responsible only for emulating the IPI.
511-
* Sadly, hardware may sometimes leave the BUSY flag set, in
512-
* which case KVM needs to emulate the ICR write as well in
509+
* only virtualizes Fixed, Edge-Triggered INTRs, and falls over
510+
* if _any_ targets are invalid, e.g. if the logical mode mask
511+
* is a superset of running vCPUs.
512+
*
513+
* The exit is a trap, e.g. ICR holds the correct value and RIP
514+
* has been advanced, KVM is responsible only for emulating the
515+
* IPI. Sadly, hardware may sometimes leave the BUSY flag set,
516+
* in which case KVM needs to emulate the ICR write as well in
513517
* order to clear the BUSY flag.
514518
*/
515519
if (icrl & APIC_ICR_BUSY)
@@ -525,8 +529,6 @@ int avic_incomplete_ipi_interception(struct kvm_vcpu *vcpu)
525529
*/
526530
avic_kick_target_vcpus(vcpu->kvm, apic, icrl, icrh, index);
527531
break;
528-
case AVIC_IPI_FAILURE_INVALID_TARGET:
529-
break;
530532
case AVIC_IPI_FAILURE_INVALID_BACKING_PAGE:
531533
WARN_ONCE(1, "Invalid backing page\n");
532534
break;

0 commit comments

Comments
 (0)