From: Jim Mattson <jmattson@google.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: Yosry Ahmed <yosry@kernel.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Jim Mattson <jmattson@google.com>
Subject: [PATCH] KVM: SVM: Set V_IGN_TPR when enabling a dummy V_IRQ for an IRQ window
Date: Wed, 18 Nov 2026 15:37:19 -0800 [thread overview]
Message-ID: <20261118233719.2101265-1-jmattson@google.com> (raw)
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@google.com>
---
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
reply other threads:[~2026-11-18 23:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261118233719.2101265-1-jmattson@google.com \
--to=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=yosry@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®