From: Liam Ni Date: Tue, 30 Jul 2024 13:59:41 +0000 (+0800) Subject: KVM: x86: Wake vCPU for PIC interrupt injection iff a valid IRQ was found X-Git-Tag: v6.15-rc1~195^2~10^2~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4cad9f87876a943d018ad73ec3919215fb756d2d;p=thirdparty%2Fkernel%2Flinux.git KVM: x86: Wake vCPU for PIC interrupt injection iff a valid IRQ was found When updating the emulated PIC IRQ status, set "wakeup_needed" if and only if a new interrupt was found, i.e. if the incoming level is non-zero and an IRQ is being raised. The bug is relatively benign, as KVM will signal a spurious wakeup, e.g. set KVM_REQ_EVENT and kick target vCPUs, but KVM will never actually inject a spurious IRQ as kvm_cpu_has_extint() cares only about the "output" field. Fixes: 7049467b5383 ("KVM: remove isr_ack logic from PIC") Signed-off-by: Liam Ni Link: https://lore.kernel.org/r/CACZJ9cX2R_=qgvLdaqbB_DUJhv08c674b67Ln_Qb9yyVwgE16w@mail.gmail.com [sean: reconstruct patch, rewrite changelog] Signed-off-by: Sean Christopherson --- diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index 8dec646e764b6..a8fb199409756 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c @@ -567,7 +567,7 @@ static void pic_irq_request(struct kvm *kvm, int level) { struct kvm_pic *s = kvm->arch.vpic; - if (!s->output) + if (!s->output && level) s->wakeup_needed = true; s->output = level; }