[PATCH] KVM: SVM: Set V_IGN_TPR when enabling a dummy V_IRQ for an IRQ window
From: Jim Mattson
Date: Wed Nov 18 2026 - 18:37:31 EST
Per the APM, the processor takes a virtual INTR interrupt only if
V_INTR_PRIO is *strictly* greater than V_TPR, unless V_IGN_TPR is set to
bypass the priority comparison.
In svm_set_vintr(), KVM injects a dummy V_IRQ with V_INTR_PRIO=0xf to
trigger #VMEXIT(VINTR) as soon as an interrupt window opens, but it does
not set V_IGN_TPR. If V_TPR is 0xf when the window opens--e.g. when
CR8=0xf (in L1, or in L2 with V_INTR_MASKING=0) while a TPR-independent
ExtINT or userspace IRQ-window request is pending, or in L2 with
V_INTR_MASKING=1, INTERCEPT_INTR=0, and vmcb12.int_ctl.V_TPR=0xf--the
priority comparison (0xf > 0xf) fails, and hardware masks the dummy
V_IRQ indefinitely (also stranding any VM-wide AVIC IRQ-window inhibit).
Set V_IRQ_INJECTION_BITS_MASK (which includes V_IRQ_MASK,
V_INTR_PRIO_MASK, and V_IGN_TPR_MASK) in svm_set_vintr(). Note that
svm_clear_vintr() already clears and restores V_IRQ_INJECTION_BITS_MASK.
Fixes: 649d68643ebf ("KVM: SVM: sync TPR value to V_TPR field in the VMCB")
Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
---
arch/x86/kvm/svm/svm.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index e30ee80624b7..2c60413597ae 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -1622,9 +1622,7 @@ static void svm_set_vintr(struct vcpu_svm *svm)
*/
control = &svm->vmcb->control;
control->int_vector = 0x0;
- control->int_ctl &= ~V_INTR_PRIO_MASK;
- control->int_ctl |= V_IRQ_MASK |
- ((/*control->int_vector >> 4*/ 0xf) << V_INTR_PRIO_SHIFT);
+ control->int_ctl |= V_IRQ_INJECTION_BITS_MASK;
vmcb_mark_dirty(svm->vmcb, VMCB_INTR);
}
--
2.56.1.708.g77570a6a1d-goog