diff options
-rw-r--r-- | hw/acpi/core.c | 6 | ||||
-rw-r--r-- | hw/i386/xen/xen-hvm.c | 5 | ||||
-rw-r--r-- | include/sysemu/sysemu.h | 1 | ||||
-rw-r--r-- | qapi/misc.json | 24 | ||||
-rw-r--r-- | vl.c | 19 |
5 files changed, 55 insertions, 0 deletions
diff --git a/hw/acpi/core.c b/hw/acpi/core.c index aafdc61648..52e18d7810 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -617,6 +617,12 @@ void acpi_pm1_cnt_init(ACPIREGS *ar, MemoryRegion *parent, ar->pm1.cnt.s4_val = s4_val; ar->wakeup.notify = acpi_notify_wakeup; qemu_register_wakeup_notifier(&ar->wakeup); + + /* + * Register wake-up support in QMP query-current-machine API + */ + qemu_register_wakeup_support(); + memory_region_init_io(&ar->pm1.cnt.io, memory_region_owner(parent), &acpi_pm_cnt_ops, ar, "acpi-cnt", 2); memory_region_add_subregion(parent, 4, &ar->pm1.cnt.io); diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 935a3676c8..2143d33b18 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -1405,6 +1405,11 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory) state->wakeup.notify = xen_wakeup_notifier; qemu_register_wakeup_notifier(&state->wakeup); + /* + * Register wake-up support in QMP query-current-machine API + */ + qemu_register_wakeup_support(); + rc = xen_map_ioreq_server(state); if (rc < 0) { goto err; diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index f83522c7e7..d9cabb34bd 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -57,6 +57,7 @@ void qemu_register_suspend_notifier(Notifier *notifier); void qemu_system_wakeup_request(WakeupReason reason); void qemu_system_wakeup_enable(WakeupReason reason, bool enabled); void qemu_register_wakeup_notifier(Notifier *notifier); +void qemu_register_wakeup_support(void); void qemu_system_shutdown_request(ShutdownCause reason); void qemu_system_powerdown_request(void); void qemu_register_powerdown_notifier(Notifier *notifier); diff --git a/qapi/misc.json b/qapi/misc.json index 8325e0dc9c..c4696ef150 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -2013,6 +2013,30 @@ { 'command': 'query-machines', 'returns': ['MachineInfo'] } ## +# @CurrentMachineParams: +# +# Information describing the running machine parameters. +# +# @wakeup-suspend-support: true if the machine supports wake up from +# suspend +# +# Since: 4.0 +## +{ 'struct': 'CurrentMachineParams', + 'data': { 'wakeup-suspend-support': 'bool'} } + +## +# @query-current-machine: +# +# Return information on the current virtual machine. +# +# Returns: CurrentMachineParams +# +# Since: 4.0 +## +{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' } + +## # @CpuDefinitionInfo: # # Virtual CPU definition. @@ -192,6 +192,7 @@ bool boot_strict; uint8_t *boot_splash_filedata; size_t boot_splash_filedata_size; uint8_t qemu_extra_params_fw[2]; +bool wakeup_suspend_enabled; int icount_align_option; @@ -1780,6 +1781,24 @@ void qemu_register_wakeup_notifier(Notifier *notifier) notifier_list_add(&wakeup_notifiers, notifier); } +void qemu_register_wakeup_support(void) +{ + wakeup_suspend_enabled = true; +} + +static bool qemu_wakeup_suspend_enabled(void) +{ + return wakeup_suspend_enabled; +} + +CurrentMachineParams *qmp_query_current_machine(Error **errp) +{ + CurrentMachineParams *params = g_malloc0(sizeof(*params)); + params->wakeup_suspend_support = qemu_wakeup_suspend_enabled(); + + return params; +} + void qemu_system_killed(int signal, pid_t pid) { shutdown_signal = signal; |