Virtuozzo QEMU development (svt-core@virtuozzo.com)
 help / color / mirror / Atom feed
* [PATCH hci-8.1 1/1] target/i386/kvm: fix latched INIT lost in kvm_put_vcpu_events() #VSTOR-153069
@ 2026-11-03 18:18 Denis V. Lunev
  2026-11-03 18:20 ` no-reply
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Denis V. Lunev @ 2026-11-03 18:18 UTC (permalink / raw)
  To: andrey.drobyshev; +Cc: svt-core, den

From: Denis V. Lunev <den@openvz.org>

CPU_INTERRUPT_INIT is 0x0400, while kvm_vcpu_events.smi.latched_init
is a __u8. The assignment truncates the masked value to 0, so every
KVM_SET_VCPU_EVENTS tells KVM to clear an INIT it has latched for a
vCPU in SMM. smi.pending survives only because CPU_INTERRUPT_SMI is
0x0040; normalize both with !! like the neighbouring fields.

Fixes: fc12d72e1082 ("target-i386: add support for SMBASE MSR and SMIs")
Cc: qemu-stable@nongnu.org
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
 target/i386/kvm/kvm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 8dc0f134990..6efe0e6b308 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -5124,8 +5124,9 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level)
             /* As soon as these are moved to the kernel, remove them
              * from cs->interrupt_request.
              */
-            events.smi.pending = cs->interrupt_request & CPU_INTERRUPT_SMI;
-            events.smi.latched_init = cs->interrupt_request & CPU_INTERRUPT_INIT;
+            events.smi.pending = !!(cs->interrupt_request & CPU_INTERRUPT_SMI);
+            events.smi.latched_init =
+                !!(cs->interrupt_request & CPU_INTERRUPT_INIT);
             cs->interrupt_request &= ~(CPU_INTERRUPT_INIT | CPU_INTERRUPT_SMI);
         } else {
             /* Keep these in cs->interrupt_request.  */
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-04 11:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 18:18 [PATCH hci-8.1 1/1] target/i386/kvm: fix latched INIT lost in kvm_put_vcpu_events() #VSTOR-153069 Denis V. Lunev
2026-11-03 18:20 ` no-reply
2026-11-03 21:28 ` Denis V. Lunev
2026-11-04 11:58 ` Andrey Drobyshev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox