KVM: SVM: WARN if an invalid posted interrupt IRTE entry is added

Now that the AMD IOMMU doesn't signal success incorrectly, WARN if KVM
attempts to track an AMD IRTE entry without metadata.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-ID: <20250404193923.1413163-8-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by Sean Christopherson and committed by Paolo Bonzini 268cbfe6 aae251a3

+4 -1
+4 -1
arch/x86/kvm/svm/avic.c
··· 796 struct amd_svm_iommu_ir *ir; 797 u64 entry; 798 799 /** 800 * In some cases, the existing irte is updated and re-set, 801 * so we need to check here if it's already been * added 802 * to the ir_list. 803 */ 804 - if (pi->ir_data && (pi->prev_ga_tag != 0)) { 805 struct kvm *kvm = svm->vcpu.kvm; 806 u32 vcpu_id = AVIC_GATAG_TO_VCPUID(pi->prev_ga_tag); 807 struct kvm_vcpu *prev_vcpu = kvm_get_vcpu_by_id(kvm, vcpu_id);
··· 796 struct amd_svm_iommu_ir *ir; 797 u64 entry; 798 799 + if (WARN_ON_ONCE(!pi->ir_data)) 800 + return -EINVAL; 801 + 802 /** 803 * In some cases, the existing irte is updated and re-set, 804 * so we need to check here if it's already been * added 805 * to the ir_list. 806 */ 807 + if (pi->prev_ga_tag) { 808 struct kvm *kvm = svm->vcpu.kvm; 809 u32 vcpu_id = AVIC_GATAG_TO_VCPUID(pi->prev_ga_tag); 810 struct kvm_vcpu *prev_vcpu = kvm_get_vcpu_by_id(kvm, vcpu_id);