mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
machine: Add wakeup method to MachineClass
Waking from suspend is not logically a machine reset on all machines, particularly in the paravirtualized case rather than hardware emulated. The ppc spapr machine for example just invokes hypervisor to suspend, and expects that call to return with the machine in the same state (modulo some possible migration and reconfiguration details). Implement a machine ->wakeup method and use that if it exists. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Message-Id: <20190722053215.20808-2-npiggin@gmail.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
c5e760e0f2
commit
4b5e06c946
2 changed files with 18 additions and 1 deletions
18
vl.c
18
vl.c
|
@ -1557,6 +1557,22 @@ void qemu_system_reset(ShutdownCause reason)
|
|||
cpu_synchronize_all_post_reset();
|
||||
}
|
||||
|
||||
/*
|
||||
* Wake the VM after suspend.
|
||||
*/
|
||||
static void qemu_system_wakeup(void)
|
||||
{
|
||||
MachineClass *mc;
|
||||
|
||||
mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;
|
||||
|
||||
if (mc && mc->wakeup) {
|
||||
mc->wakeup(current_machine);
|
||||
} else {
|
||||
qemu_system_reset(SHUTDOWN_CAUSE_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
void qemu_system_guest_panicked(GuestPanicInformation *info)
|
||||
{
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "Guest crashed");
|
||||
|
@ -1765,7 +1781,7 @@ static bool main_loop_should_exit(void)
|
|||
}
|
||||
if (qemu_wakeup_requested()) {
|
||||
pause_all_vcpus();
|
||||
qemu_system_reset(SHUTDOWN_CAUSE_NONE);
|
||||
qemu_system_wakeup();
|
||||
notifier_list_notify(&wakeup_notifiers, &wakeup_reason);
|
||||
wakeup_reason = QEMU_WAKEUP_REASON_NONE;
|
||||
resume_all_vcpus();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue