Skip to content

Commit 6560aff

Browse files
sean-jcbonzini
authored andcommitted
KVM: SVM: Don't update IRTEs if APICv/AVIC is disabled
Skip IRTE updates if AVIC is disabled/unsupported, as forcing the IRTE into remapped mode (kvm_vcpu_apicv_active() will never be true) is unnecessary and wasteful. The IOMMU driver is responsible for putting IRTEs into remapped mode when an IRQ is allocated by a device, long before that device is assigned to a VM. I.e. the kernel as a whole has major issues if the IRTE isn't already in remapped mode. Opportunsitically kvm_arch_has_irq_bypass() to query for APICv/AVIC, so so that all checks in KVM x86 incorporate the same information. Cc: Yosry Ahmed <yosry.ahmed@linux.dev> Cc: Jim Mattson <jmattson@google.com> Signed-off-by: Sean Christopherson <seanjc@google.com> Message-ID: <20250401161804.842968-3-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 5f9e169 commit 6560aff

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/x86/kvm/svm/avic.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,8 +898,7 @@ int avic_pi_update_irte(struct kvm *kvm, unsigned int host_irq,
898898
struct kvm_irq_routing_table *irq_rt;
899899
int idx, ret = 0;
900900

901-
if (!kvm_arch_has_assigned_device(kvm) ||
902-
!irq_remapping_cap(IRQ_POSTING_CAP))
901+
if (!kvm_arch_has_assigned_device(kvm) || !kvm_arch_has_irq_bypass())
903902
return 0;
904903

905904
pr_debug("SVM: %s: host_irq=%#x, guest_irq=%#x, set=%#x\n",

0 commit comments

Comments
 (0)