[PATCH 50/67] KVM: SVM: WARN if (de)activating guest mode in IOMMU fails
From: Sean Christopherson
Date: Fri Apr 04 2025 - 15:46:51 EST
WARN if (de)activating "guest mode" for an IRTE entry fails as modifying
an IRTE should only fail if KVM is buggy, e.g. has stale metadata.
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/svm/avic.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index 620772e07993..5f5022d12b1b 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -733,10 +733,9 @@ void avic_apicv_post_state_restore(struct kvm_vcpu *vcpu)
avic_handle_ldr_update(vcpu);
}
-static int avic_set_pi_irte_mode(struct kvm_vcpu *vcpu, bool activate)
+static void avic_set_pi_irte_mode(struct kvm_vcpu *vcpu, bool activate)
{
int apic_id = kvm_cpu_get_apicid(vcpu->cpu);
- int ret = 0;
unsigned long flags;
struct amd_svm_iommu_ir *ir;
struct vcpu_svm *svm = to_svm(vcpu);
@@ -752,15 +751,12 @@ static int avic_set_pi_irte_mode(struct kvm_vcpu *vcpu, bool activate)
list_for_each_entry(ir, &svm->ir_list, node) {
if (activate)
- ret = amd_iommu_activate_guest_mode(ir->data, apic_id);
+ WARN_ON_ONCE(amd_iommu_activate_guest_mode(ir->data, apic_id));
else
- ret = amd_iommu_deactivate_guest_mode(ir->data);
- if (ret)
- break;
+ WARN_ON_ONCE(amd_iommu_deactivate_guest_mode(ir->data));
}
out:
spin_unlock_irqrestore(&svm->ir_list_lock, flags);
- return ret;
}
static void svm_ir_list_del(struct kvm_kernel_irqfd *irqfd)
--
2.49.0.504.g3bcea36a83-goog