From 48f79c6c86b38f9b6506eeef0d9ca2e03b6be6fe Mon Sep 17 00:00:00 2001 From: Sean Christopherson Date: Wed, 11 Jun 2025 15:45:50 -0700 Subject: [PATCH] KVM: SVM: Process all IRTEs on affinity change even if one update fails When updating IRTE GA fields, keep processing all other IRTEs if an update fails, as not updating later entries risks making a bad situation worse. Link: https://lore.kernel.org/r/20250611224604.313496-49-seanjc@google.com Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/avic.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c index 31bf202e0026..6ecbd7984975 100644 --- a/arch/x86/kvm/svm/avic.c +++ b/arch/x86/kvm/svm/avic.c @@ -850,12 +850,10 @@ static inline int avic_update_iommu_vcpu_affinity(struct kvm_vcpu *vcpu, int cpu if (list_empty(&svm->ir_list)) return 0; - list_for_each_entry(irqfd, &svm->ir_list, vcpu_list) { + list_for_each_entry(irqfd, &svm->ir_list, vcpu_list) ret = amd_iommu_update_ga(cpu, irqfd->irq_bypass_data); - if (ret) - return ret; - } - return 0; + + return ret; } void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu) -- 2.47.2