qemu-patch-raspberry4/include/sysemu
Daniel Henrique Barboza fb06411210 qmp hmp: Make system_wakeup check wake-up support and run state
The qmp/hmp command 'system_wakeup' is simply a direct call to
'qemu_system_wakeup_request' from vl.c. This function verifies if
runstate is SUSPENDED and if the wake up reason is valid before
proceeding. However, no error or warning is thrown if any of those
pre-requirements isn't met. There is no way for the caller to
differentiate between a successful wakeup or an error state caused
when trying to wake up a guest that wasn't suspended.

This means that system_wakeup is silently failing, which can be
considered a bug. Adding error handling isn't an API break in this
case - applications that didn't check the result will remain broken,
the ones that check it will have a chance to deal with it.

Adding to that, the commit before previous created a new QMP API called
query-current-machine, with a new flag called wakeup-suspend-support,
that indicates if the guest has the capability of waking up from suspended
state. Although such guest will never reach SUSPENDED state and erroring
it out in this scenario would suffice, it is more informative for the user
to differentiate between a failure because the guest isn't suspended versus
a failure because the guest does not have support for wake up at all.

All this considered, this patch changes qmp_system_wakeup to check if
the guest is capable of waking up from suspend, and if it is suspended.
After this patch, this is the output of system_wakeup in a guest that
does not have wake-up from suspend support (ppc64):

(qemu) system_wakeup
wake-up from suspend is not supported by this guest
(qemu)

And this is the output of system_wakeup in a x86 guest that has the
support but isn't suspended:

(qemu) system_wakeup
Unable to wake up: guest is not in suspended state
(qemu)

Reported-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20181205194701.17836-4-danielhb413@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-12-18 07:55:47 +01:00
..
accel.h AccelClass: Introduce accel_setup_post 2018-04-26 16:29:50 +01:00
arch_init.h RISC-V Build Infrastructure 2018-03-07 08:30:28 +13:00
balloon.h qapi: Empty out qapi-schema.json 2018-03-02 13:45:50 -06:00
block-backend.h block: change some function return type to bool 2018-11-05 15:09:54 +01:00
blockdev.h blockdev: Convert drive_new() to Error 2018-10-19 14:51:34 +02:00
bt.h Clean up header guards that don't match their file name 2016-07-12 16:19:16 +02:00
cpus.h migration: Mark CPU states dirty before incoming migration/loadvm 2017-06-06 08:53:24 +10:00
cryptodev-vhost-user.h cryptodev-vhost-user: set the key length 2018-03-01 18:26:17 +02:00
cryptodev-vhost.h cryptodev: add vhost-user as a new cryptodev backend 2018-03-01 18:26:17 +02:00
cryptodev.h cryptodev: add vhost support 2018-03-01 18:26:17 +02:00
device_tree.h device_tree: Add qemu_fdt_node_unit_path 2018-06-29 15:11:01 +01:00
dma.h Make address_space_access_valid() take a MemTxAttrs argument 2018-05-31 16:32:35 +01:00
dump-arch.h dump: allow target to set the physical base 2016-01-15 14:40:25 +00:00
dump.h qapi: Empty out qapi-schema.json 2018-03-02 13:45:50 -06:00
hax.h hax: Support guest RAM sizes of 4GB or more 2018-02-13 11:44:13 +01:00
hostmem.h hostmem: drop error variable from host_memory_backend_get_memory() 2018-06-28 19:05:33 +02:00
hvf.h i386: hvf: Remove hvf_disabled 2018-10-19 13:44:12 +02:00
hw_accel.h Add the WHPX acceleration enlightenments 2018-02-07 14:09:26 +01:00
iothread.h vl: introduce vm_shutdown() 2018-03-08 17:38:51 +00:00
kvm.h kvm: Add support to KVM_GET_MSR_FEATURE_INDEX_LIST and KVM_GET_MSRS system ioctl 2018-10-30 21:14:43 -03:00
kvm_int.h kvm: Delete the slot if and only if the KVM_MEM_READONLY flag is changed 2018-06-28 19:05:31 +02:00
memory_mapping.h Use scripts/clean-includes to drop redundant qemu/typedefs.h 2016-03-22 22:20:16 +01:00
numa.h numa: Match struct to typedef name 2018-12-11 15:45:22 -02:00
os-posix.h util: drop old utimensat() compat code 2017-05-25 10:30:14 +02:00
os-win32.h log: Add locking to large logging blocks 2016-11-01 10:29:03 -06:00
qtest.h include: Clean up includes 2016-02-23 12:43:05 +00:00
replay.h replay: pass raw icount value to replay_save_clock 2018-10-19 13:44:15 +02:00
reset.h hw: move reset handlers from vl.c to hw/core 2017-01-16 17:52:35 +01:00
rng-random.h rng-random: rename RndRandom to RngRandom 2016-05-23 12:18:43 +05:30
rng.h rng: switch request queue to QSIMPLEQ 2016-03-08 12:54:14 +05:30
seccomp.h sandbox: disable -sandbox if CONFIG_SECCOMP undefined 2018-06-01 13:44:15 +02:00
sev.h kvm: introduce memory encryption APIs 2018-03-13 12:04:03 +01:00
sysemu.h qmp hmp: Make system_wakeup check wake-up support and run state 2018-12-18 07:55:47 +01:00
tpm.h qom: make interface types abstract 2018-12-11 15:45:22 -02:00
tpm_backend.h Drop superfluous includes of qapi-types.h and test-qapi-types.h 2018-02-09 05:05:11 +01:00
watchdog.h Include less of the generated modular QAPI headers 2018-03-02 13:45:50 -06:00
whpx.h Add the WHPX vcpu API 2018-02-07 14:09:26 +01:00
xen-mapcache.h xen/hvm: correct reporting of modified memory under physmap during migration 2018-05-31 12:04:54 -07:00