From: David Woodhouse The callback_via GSI (or PCI INTx) and the per-vCPU upcall vector are mutually exclusive delivery mechanisms for Xen event channel upcalls. Xen itself will never assert the callback GSI for a vCPU which has a per-vCPU upcall vector configured. When the interrupt is acked, QEMU's resampling logic reasserts the GSI if evtchn_upcall_pending is still set. If the guest has configured a per-vCPU upcall vector, events are delivered through that vector and the GSI is unexpected; a guest which receives both the vector upcall and a spurious GSI interrupt for the same event can crash. This was observed in production with Windows guests on a different VMM which implements the same resampling logic. If a per-vCPU upcall vector is configured, don't resample the GSI; just deassert it. Fixes: ddf0fd9ae1fd ("hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback") Signed-off-by: David Woodhouse --- target/i386/kvm/xen-emu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c index 29364a92797..7337561b159 100644 --- a/target/i386/kvm/xen-emu.c +++ b/target/i386/kvm/xen-emu.c @@ -435,6 +435,13 @@ void kvm_xen_maybe_deassert_callback(CPUState *cs) return; } + if (env->xen_vcpu_callback_vector) { + BQL_LOCK_GUARD(); + env->xen_callback_asserted = false; + xen_evtchn_set_callback_level(0); + return; + } + /* If the evtchn_upcall_pending flag is cleared, turn the GSI off. */ if (!vi->evtchn_upcall_pending) { bql_lock(); -- 2.43.0