[PATCH 51/67] KVM: SVM: Process all IRTEs on affinity change even if one update fails
From: Sean Christopherson
Date: Fri Apr 04 2025 - 15:47:03 EST
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.
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
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 5f5022d12b1b..5544e8e88926 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -857,12 +857,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(ir, &svm->ir_list, node) {
+ list_for_each_entry(ir, &svm->ir_list, node)
ret = amd_iommu_update_ga(cpu, ir->data);
- if (ret)
- return ret;
- }
- return 0;
+
+ return ret;
}
void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
--
2.49.0.504.g3bcea36a83-goog