return;
}
+ qemu_mutex_lock_iothread();
/* If the evtchn_upcall_pending flag is cleared, turn the GSI off. */
- if (!vi->evtchn_upcall_pending) {
- qemu_mutex_lock_iothread();
- X86_CPU(cs)->env.xen_callback_asserted = false;
- xen_evtchn_set_callback_level(0);
- qemu_mutex_unlock_iothread();
+ if (X86_CPU(cs)->env.xen_callback_asserted &&
+ !vi->evtchn_upcall_pending) {
+ if (!vi->evtchn_upcall_pending) {
+ X86_CPU(cs)->env.xen_callback_asserted = false;
+ xen_evtchn_set_callback_level(0);
+ }
}
+ qemu_mutex_unlock_iothread();
}
void kvm_xen_set_callback_asserted(void)