event: Add source information to SHUTDOWN
Subsystems (2)
v6 cover event: Add source information to SHUTDOWN
v2 was here:
https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg03185.html
v3 and v4 were dead on arrival
v5 was here:
https://lists.gnu.org/archive/html/qemu-devel/2017-04/msg05564.html
Since then:
- rework the enum to be internal only
- add a 'none' slot to the enum, so that we are back to comparison to 0 rather than -1 as the no-request-yet state
- drop the RFC patch that would expose the reasons through QAPI (Dan's take, at least on IRC, is that even with finer-grained reasons from qemu, the most libvirt would do is log the reason and then still just expose a boolean higher up). We can revive that patch if desired, but doing so also implies adding a 'query-shutdown' command, and I didn't think it was worth it for now (no need to over-engineer until we know we have a client that wants it)
- fix replay to preserve status
- split the patches slightly differently, so that internal wiring and event additions are separated
Eric Blake (5):
shutdown: Simplify shutdown_signal
shutdown: Prepare for use of an enum in reset/shutdown_request
shutdown: Add source information to SHUTDOWN and RESET
shutdown: Preserve shutdown cause through replay
shutdown: Expose bool cause in SHUTDOWN and RESET events
qapi/event.json | 17 ++++++++--- include/sysemu/replay.h | 3 +- include/sysemu/sysemu.h | 27 ++++++++++++++---- replay/replay-internal.h | 3 +- vl.c | 69 +++++++++++++++++++++++++++------------------ hw/acpi/core.c | 4 +-- hw/arm/highbank.c | 4 +-- hw/arm/integratorcp.c | 2 +- hw/arm/musicpal.c | 2 +- hw/arm/omap1.c | 10 ++++--- hw/arm/omap2.c | 2 +- hw/arm/spitz.c | 2 +- hw/arm/stellaris.c | 2 +- hw/arm/tosa.c | 2 +- hw/i386/pc.c | 2 +- hw/i386/xen/xen-hvm.c | 9 ++++-- hw/input/pckbd.c | 4 +-- hw/ipmi/ipmi.c | 4 +-- hw/isa/lpc_ich9.c | 2 +- hw/mips/boston.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_r4k.c | 4 +-- hw/misc/arm_sysctl.c | 8 +++--- hw/misc/cbus.c | 2 +- hw/misc/macio/cuda.c | 4 +-- hw/misc/slavio_misc.c | 4 +-- hw/misc/zynq_slcr.c | 2 +- hw/pci-host/apb.c | 4 +-- hw/pci-host/bonito.c | 2 +- hw/pci-host/piix.c | 2 +- hw/ppc/e500.c | 2 +- hw/ppc/mpc8544_guts.c | 2 +- hw/ppc/ppc.c | 2 +- hw/ppc/ppc405_uc.c | 2 +- hw/ppc/spapr_hcall.c | 2 +- hw/ppc/spapr_rtas.c | 4 +-- hw/s390x/ipl.c | 2 +- hw/sh4/r2d.c | 2 +- hw/timer/etraxfs_timer.c | 2 +- hw/timer/m48t59.c | 4 +-- hw/timer/milkymist-sysctl.c | 4 +-- hw/timer/pxa2xx_timer.c | 2 +- hw/watchdog/watchdog.c | 2 +- hw/xenpv/xen_domainbuild.c | 2 +- hw/xtensa/xtfpga.c | 2 +- kvm-all.c | 6 ++-- migration/colo.c | 2 +- migration/savevm.c | 2 +- os-win32.c | 2 +- qmp.c | 4 +-- replay/replay.c | 9 +++--- target/alpha/sys_helper.c | 4 +-- target/arm/psci.c | 4 +-- target/i386/excp_helper.c | 2 +- target/i386/hax-all.c | 6 ++-- target/i386/helper.c | 2 +- target/i386/kvm.c | 2 +- target/s390x/helper.c | 2 +- target/s390x/kvm.c | 4 +-- target/s390x/misc_helper.c | 4 +-- target/sparc/int32_helper.c | 2 +- ui/sdl.c | 2 +- ui/sdl2.c | 4 +-- tests/qemu-iotests/071.out | 4 +-- tests/qemu-iotests/081.out | 2 +- tests/qemu-iotests/087.out | 12 ++++---- tests/qemu-iotests/094.out | 2 +- tests/qemu-iotests/117.out | 2 +- tests/qemu-iotests/119.out | 2 +- tests/qemu-iotests/120.out | 2 +- tests/qemu-iotests/140.out | 2 +- tests/qemu-iotests/143.out | 2 +- tests/qemu-iotests/156.out | 2 +- trace-events | 2 +- ui/cocoa.m | 2 +- 75 files changed, 194 insertions(+), 147 deletions(-)
Signature · 1 line
2.9.3
PATCH v6 1/5 shutdown: Simplify shutdown_signal
There is no signal 0 (kill(pid, 0) has special semantics to probe whether a process is alive), rather than actually sending a signal 0). So we can use the simpler 0, instead of -1, for our sentinel of whether a shutdown request due to a signal has happened.
---
v4-v6: no change
v3: new patch
--- vl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
vl.c +3 -3
@@ -1598,7 +1598,7 @@ void vm_state_notify(int running, RunState state) }static int reset_requested; -static int shutdown_requested, shutdown_signal =-1 ; +static int shutdown_requested, shutdown_signal;static pid_t shutdown_pid;static int powerdown_requested;static int debug_requested;
@@ -1629,7 +1629,7 @@ static int qemu_shutdown_requested(void)static void qemu_kill_report (void ) { -if (!qtest_driver () && shutdown_signal !=-1 ) { +if (!qtest_driver () && shutdown_signal) {if (shutdown_pid ==0 ) {/* This happens for eg ^C at the terminal, so it's worth * avoiding printing an odd message in that case.
@@ -1643,7 +1643,7 @@ static void qemu_kill_report(void) shutdown_cmd ? shutdown_cmd : "<unknown process>");g_free (shutdown_cmd); } - shutdown_signal =-1 ; + shutdown_signal =0 ; } }
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH v6 1/5] shutdown: Simplify shutdown_signal
Quoted 8 lines · Eric Blake
There is no signal 0 (
kill(pid, 0)has special semantics to probe whether a process is alive), rather than actually sending a signal 0). So we can use the simpler 0, instead of -1, for our sentinel of whether a shutdown request due to a signal has happened.Suggested-by Markus Armbruster <[email protected]>Signed-off-by Eric Blake <[email protected]>Reviewed-by Markus Armbruster <[email protected]>
Thanks,
Alistair
Quoted 43 lines
---
v4-v6: no change
v3: new patch--- vl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)vl.c +3
-4@@ -1598,7 +1598,7 @@ void vm_state_notify(int running, RunState state) }static int reset_requested; -static int shutdown_requested, shutdown_signal =-1 ; +static int shutdown_requested, shutdown_signal;static pid_t shutdown_pid;static int powerdown_requested;static int debug_requested;@@ -1629,7 +1629,7 @@ static int qemu_shutdown_requested(void)static void qemu_kill_report (void ) { -if (!qtest_driver () && shutdown_signal !=-1 ) { +if (!qtest_driver () && shutdown_signal) {if (shutdown_pid ==0 ) {/* This happens for eg ^C at the terminal, so it's worth * avoiding printing an odd message in that case. @@ -1643,7 +1643,7 @@ static void qemu_kill_report(void) shutdown_cmd ? shutdown_cmd : "<unknown process>");g_free (shutdown_cmd); } - shutdown_signal =-1 ; + shutdown_signal =0 ; } } --2.9.3
PATCH v6 2/5 shutdown: Prepare for use of an enum in reset/shutdown_request
In reply to Eric BlakeWe want to track why a guest was shutdown; in particular, being able to tell the difference between a guest request (such as ACPI request) and host request (such as SIGINT) will prove useful to libvirt. Since all requests eventually end up changing shutdown_requested in vl.c, the logical change is to make that value track the reason, rather than its current 0/1 contents.
Since command-line options control whether a reset request is turned into a shutdown request instead, the same treatment is given to reset_requested.
This patch adds an internal enum ShutdownCause that describes reasons that a shutdown can be requested, and changes qemu_system_reset() to pass the reason through, although for now it is not reported. The enum could be exported via QAPI at a later date, if deemed necessary, but for now, there has not been a request to expose that much detail to end clients.
For now, we only populate the reason with HOST_ERROR, along with FIXME comments that describe our plans for how to pass an actual correct reason. The next patches will then actually wire things up to modify events to report data based on the reason, and to pass the correct enum value in from various call-sites that can trigger a reset/shutdown (big enough that it was worth splitting from this patch).
---
v6: make ShutdownCause internal-only, add SHUTDOWN_CAUSE_NONE so that comparison to 0 still works, tweak initial FIXME values
v5: no change
v4: s/ShutdownType/ShutdownCause/, no thanks to mingw header pollution
v3: new patch
--- include/sysemu/sysemu.h | 22 ++++++++++++++++++--- vl.c | 51 +++++++++++++++++++++++++++++++------------------ hw/i386/xen/xen-hvm.c | 7 +++++-- migration/colo.c | 2 +- migration/savevm.c | 2 +- 5 files changed, 58 insertions(+), 26 deletions(-)
include/sysemu/sysemu.h +19 -3
@@ -36,6 +36,22 @@ void vm_state_notify(int running, RunState state);#define VMRESET_SILENT false#define VMRESET_REPORT true +/* Enumeration of various causes for shutdown. */ +typedef enum ShutdownCause ShutdownCause ; +enum ShutdownCause { +SHUTDOWN_CAUSE_NONE ,/* No shutdown requested yet */ +SHUTDOWN_CAUSE_HOST_QMP ,/* Reaction to a QMP command, like 'quit' */ +SHUTDOWN_CAUSE_HOST_SIGNAL ,/* Reaction to a signal, such as SIGINT */ +SHUTDOWN_CAUSE_HOST_UI ,/* Reaction to UI event, like window close */ +SHUTDOWN_CAUSE_HOST_ERROR ,/* An error prevents further use of guest */ +SHUTDOWN_CAUSE_GUEST_SHUTDOWN ,/* Guest requested shutdown, such as via +ACPI or other hardware-specific means */ +SHUTDOWN_CAUSE_GUEST_RESET ,/* Guest requested reset, and command line +turns that into a shutdown */ +SHUTDOWN_CAUSE_GUEST_PANIC ,/* Guest panicked, and command line turns +that into a shutdown */ +}; +void vm_start (void );int vm_prepare_start (void );int vm_stop (RunState state);
@@ -62,10 +78,10 @@ void qemu_system_debug_request(void);void qemu_system_vmstop_request (RunState reason);void qemu_system_vmstop_request_prepare (void );bool qemu_vmstop_requested (RunState *r); -int qemu_shutdown_requested_get (void ); -int qemu_reset_requested_get (void ); +ShutdownCause qemu_shutdown_requested_get (void ); +ShutdownCause qemu_reset_requested_get (void );void qemu_system_killed (int signal,pid_t pid); -void qemu_system_reset (bool report); +void qemu_system_reset (bool report,ShutdownCause reason);void qemu_system_guest_panicked (GuestPanicInformation *info);size_t qemu_target_page_size (void );
vl.c +32 -19
145 lines not on this page · raw message
hw/i386/xen/xen-hvm.c +5 -2
@@ -1089,11 +1089,14 @@ static void cpu_handle_ioreq(void *opaque)* causes Xen to powerdown the domain. */ if (runstate_is_running ()) { +ShutdownCause request; +if (qemu_shutdown_requested_get ()) {destroy_hvm_domain (false); } -if (qemu_reset_requested_get ()) { -qemu_system_reset (VMRESET_REPORT ); + request =qemu_reset_requested_get (); +if (request) { +qemu_system_reset (VMRESET_REPORT , request);destroy_hvm_domain (true); } }
migration/colo.c +1 -1
@@ -623,7 +623,7 @@ void *colo_process_incoming_thread(void *opaque) }qemu_mutex_lock_iothread (); -qemu_system_reset (VMRESET_SILENT ); +qemu_system_reset (VMRESET_SILENT ,SHUTDOWN_CAUSE_NONE ); vmstate_loading = true;if (qemu_loadvm_state (fb) <0 ) {error_report ("COLO: loadvm failed" );
migration/savevm.c +1 -1
@@ -2300,7 +2300,7 @@ int load_vmstate(const char *name)return -EINVAL ; } -qemu_system_reset (VMRESET_SILENT ); +qemu_system_reset (VMRESET_SILENT ,SHUTDOWN_CAUSE_NONE ); mis->from_src_file = f;aio_context_acquire (aio_context);
Signature · 7 lines
2.9.3 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v6 2/5] shutdown: Prepare for use of an enum in reset/shutdown_request
Quoted 18 lines · Eric Blake
We want to track why a guest was shutdown; in particular, being able to tell the difference between a guest request (such as ACPI request) and host request (such as SIGINT) will prove useful to libvirt. Since all requests eventually end up changing
shutdown_requestedinvl.c, the logical change is to make that value track the reason, rather than its current 0/1 contents.Since command-line options control whether a reset request is turned into a shutdown request instead, the same treatment is given to
reset_requested.This patch adds an internal enum ShutdownCause that describes reasons that a shutdown can be requested, and changes
qemu_system_reset()to pass the reason through, although for now it is not reported. The enum could be exported via QAPI at a later date, if deemed necessary, but for now, there has not been a request to expose that much detail to end clients.
Quoted 3 lines
For now, we only populate the reason with
HOST_ERROR, along with FIXME comments that describe our plans for how to pass an actual correct reason.
In other words, replacing 0 by SHUTDOWN_CAUSE_NONE, and 1 by SHUTDOWN_CAUSE_HOST_ERROR. Makes sense.
Quoted 26 lines
The next patches will then actually wire things up to modify
events to report data based on the reason, and to pass the correct enum value in from various call-sites that can trigger a reset/shutdown (big enough that it was worth splitting from this patch).Signed-off-by Eric Blake <[email protected]>---
v6: make ShutdownCause internal-only, addSHUTDOWN_CAUSE_NONEso that comparison to 0 still works, tweak initial FIXME values
v5: no change
v4: s/ShutdownType/ShutdownCause/, no thanks to mingw header pollution
v3: new patch--- include/sysemu/sysemu.h | 22 ++++++++++++++++++--- vl.c | 51 +++++++++++++++++++++++++++++++------------------ hw/i386/xen/xen-hvm.c | 7 +++++-- migration/colo.c | 2 +- migration/savevm.c | 2 +- 5 files changed, 58 insertions(+), 26 deletions(-)include/sysemu/sysemu.h +0
-0
include/sysemu/sysemu.h void vm_state_notify(int running, RunState state); · line 41
Quoted 6 lines
include/sysemu/sysemu.h +3
-0@@ -36,6 +36,22 @@ void vm_state_notify(int running, RunState state);#define VMRESET_SILENT false#define VMRESET_REPORT true +/* Enumeration of various causes for shutdown. */ +typedef enum ShutdownCause ShutdownCause ; +enum ShutdownCause {
Why define the typedef separately here? What's wrong with
typedef enum ShutdownCause {
...
} ShutdownCause;?
include/sysemu/sysemu.h void vm_state_notify(int running, RunState state); · line 42
Quoted 1 line
include/sysemu/sysemu.h +1
-0+ SHUTDOWN_CAUSE_NONE, /* No shutdown requested yet */
Comment is fine. Possible alternative: /* No shutdown request pending */
Quoted 69 lines
include/sysemu/sysemu.h +15
-3+SHUTDOWN_CAUSE_HOST_QMP ,/* Reaction to a QMP command, like 'quit' */ +SHUTDOWN_CAUSE_HOST_SIGNAL ,/* Reaction to a signal, such as SIGINT */ +SHUTDOWN_CAUSE_HOST_UI ,/* Reaction to UI event, like window close */ +SHUTDOWN_CAUSE_HOST_ERROR ,/* An error prevents further use of guest */ +SHUTDOWN_CAUSE_GUEST_SHUTDOWN ,/* Guest requested shutdown, such as via +ACPI or other hardware-specific means */ +SHUTDOWN_CAUSE_GUEST_RESET ,/* Guest requested reset, and command line +turns that into a shutdown */ + SHUTDOWN_CAUSE_GUEST_PANIC, /* Guest panicked, and command line turns + that into a shutdown */ +}; +void vm_start (void );int vm_prepare_start (void );int vm_stop (RunState state);@@ -62,10 +78,10 @@ void qemu_system_debug_request(void);void qemu_system_vmstop_request (RunState reason);void qemu_system_vmstop_request_prepare (void );bool qemu_vmstop_requested (RunState *r); -int qemu_shutdown_requested_get (void ); -int qemu_reset_requested_get (void ); +ShutdownCause qemu_shutdown_requested_get (void ); +ShutdownCause qemu_reset_requested_get (void );void qemu_system_killed (int signal,pid_t pid); -void qemu_system_reset (bool report); +void qemu_system_reset (bool report,ShutdownCause reason);void qemu_system_guest_panicked (GuestPanicInformation *info);size_t qemu_target_page_size (void );vl.c +6
-5@@ -1597,8 +1597,9 @@ void vm_state_notify(int running, RunState state) } } -static int reset_requested; -static int shutdown_requested, shutdown_signal; +static ShutdownCause reset_requested; +static ShutdownCause shutdown_requested; +static int shutdown_signal;static pid_t shutdown_pid;static int powerdown_requested;static int debug_requested;@@ -1612,19 +1613,19 @@ static NotifierList wakeup_notifiers =NOTIFIER_LIST_INITIALIZER (wakeup_notifiers);static uint32_t wakeup_reason_mask = ~(1 <<QEMU_WAKEUP_REASON_NONE ); -int qemu_shutdown_requested_get (void ) +ShutdownCause qemu_shutdown_requested_get (void ) {return shutdown_requested; } -int qemu_reset_requested_get (void ) +ShutdownCause qemu_reset_requested_get (void ) {return reset_requested; }static int qemu_shutdown_requested (void ) { -return atomic_xchg (&shutdown_requested,0 ); +return atomic_xchg (&shutdown_requested,SHUTDOWN_CAUSE_NONE ); }static void qemu_kill_report (void )
vl.c static void qemu_kill_report(void) · line 1653
Quoted 8 lines
vl.c +2
-2@@ -1647,14 +1648,14 @@ static void qemu_kill_report(void) } } -static int qemu_reset_requested (void ) +static ShutdownCause qemu_reset_requested (void ) { -int r = reset_requested; +ShutdownCause r = reset_requested;
Good opportunity to insert a blank line here.
Quoted 11 lines
vl.c +2
-2if (r &&replay_checkpoint (CHECKPOINT_RESET_REQUESTED )) { - reset_requested =0 ; + reset_requested =SHUTDOWN_CAUSE_NONE ;return r; } -return false; +return SHUTDOWN_CAUSE_NONE ; }static int qemu_suspend_requested (void )
vl.c static int qemu_debug_requested(void) · line 1694
Quoted 9 lines
vl.c +5
-1@@ -1686,7 +1687,12 @@ static int qemu_debug_requested(void)return r; } -void qemu_system_reset (bool report) +/* +* Reset the VM. If @report is VMRESET_REPORT, issue an event, using +* the @reason interpreted as ShutdownCause for details. Otherwise, +* @report is VMRESET_SILENT and @reason is ignored. +*/
"interpreted as ShutdownCause"? It *is* a ShutdownCause. Leftover?
vl.c void qemu_system_reset(bool report) · line 1712
Quoted 12 lines
vl.c +2
-0+void qemu_system_reset (bool report,ShutdownCause reason) {MachineClass *mc;@@ -1700,6 +1706,7 @@ void qemu_system_reset(bool report)qemu_devices_reset (); }if (report) { +assert (reason);qapi_event_send_reset (&error_abort); }cpu_synchronize_all_post_reset ();
Looks like we're not using @reason "for details" just yet.
Quoted 14 lines
vl.c +3
-2@@ -1738,9 +1745,10 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)void qemu_system_reset_request (void ) {if (no_reboot) { - shutdown_requested =1 ; +/* FIXME - add a parameter to allow callers to specify reason */ + shutdown_requested =SHUTDOWN_CAUSE_HOST_ERROR ; }else { - reset_requested =1 ; + reset_requested =SHUTDOWN_CAUSE_HOST_ERROR ; }cpu_stop_current ();qemu_notify_event ();
vl.c void qemu_system_killed(int signal, pid_t pid) · line 1818
Quoted 5 lines
vl.c +1
-1@@ -1807,7 +1815,7 @@ void qemu_system_killed(int signal, pid_t pid)/* Cannot call qemu_system_shutdown_request directly because * we are in a signal handler. */ - shutdown_requested =1 ; + shutdown_requested =SHUTDOWN_CAUSE_HOST_SIGNAL ;
Should this be SHUTDOWN_CAUSE_HOST_ERROR, to be updated in the next patch? Alternatively, tweak this patch's commit message?
Quoted 21 lines
vl.c +4
-1qemu_notify_event (); }@@ -1815,7 +1823,8 @@ void qemu_system_shutdown_request(void) {trace_qemu_system_shutdown_request ();replay_shutdown_request (); - shutdown_requested =1 ; +/* FIXME - add a parameter to allow callers to specify reason */ + shutdown_requested =SHUTDOWN_CAUSE_HOST_ERROR ;qemu_notify_event (); }@@ -1846,13 +1855,16 @@ void qemu_system_debug_request(void)static bool main_loop_should_exit (void ) {RunState r; +ShutdownCause request; +if (qemu_debug_requested ()) {vm_stop (RUN_STATE_DEBUG );
vl.c void qemu_system_debug_request(void) · line 1870
Quoted 10 lines
vl.c +2
-1}if (qemu_suspend_requested ()) {qemu_system_suspend (); } -if (qemu_shutdown_requested ()) { + request =qemu_shutdown_requested (); +if (request) {qemu_kill_report ();qapi_event_send_shutdown (&error_abort);if (no_shutdown) {
The detour through @request appears isn't necessary here. Perhaps you do it for consistency with the next hunk. Do you? Just asking to make sure I get what you're doing.
Hmm, there's another one in xen-hvm.c, but consistency hardly applies there. If later patches add more uses, you might want delay the change until then.
Quoted 70 lines
vl.c +5
-4@@ -1861,9 +1873,10 @@ static bool main_loop_should_exit(void)return true; } } -if (qemu_reset_requested ()) { + request =qemu_reset_requested (); +if (request) {pause_all_vcpus (); -qemu_system_reset (VMRESET_REPORT ); +qemu_system_reset (VMRESET_REPORT , request);resume_all_vcpus ();if (!runstate_check (RUN_STATE_RUNNING ) && !runstate_check (RUN_STATE_INMIGRATE )) {@@ -1872,7 +1885,7 @@ static bool main_loop_should_exit(void) }if (qemu_wakeup_requested ()) {pause_all_vcpus (); -qemu_system_reset (VMRESET_SILENT ); +qemu_system_reset (VMRESET_SILENT ,SHUTDOWN_CAUSE_NONE );notifier_list_notify (&wakeup_notifiers, &wakeup_reason); wakeup_reason =QEMU_WAKEUP_REASON_NONE ;resume_all_vcpus ();@@ -4686,7 +4699,7 @@ int main(int argc, char **argv, char **envp)reading from the other reads, because timer polling functions query clock values from the log. */ replay_checkpoint (CHECKPOINT_RESET ); -qemu_system_reset (VMRESET_SILENT ); +qemu_system_reset (VMRESET_SILENT ,SHUTDOWN_CAUSE_NONE );register_global_state ();if (replay_mode !=REPLAY_MODE_NONE ) {replay_vmstate_init ();hw/i386/xen/xen-hvm.c +5
-2@@ -1089,11 +1089,14 @@ static void cpu_handle_ioreq(void *opaque)* causes Xen to powerdown the domain. */ if (runstate_is_running ()) { +ShutdownCause request; +if (qemu_shutdown_requested_get ()) {destroy_hvm_domain (false); } -if (qemu_reset_requested_get ()) { -qemu_system_reset (VMRESET_REPORT ); + request =qemu_reset_requested_get (); +if (request) { +qemu_system_reset (VMRESET_REPORT , request);destroy_hvm_domain (true); } }migration/colo.c +1
-1@@ -623,7 +623,7 @@ void *colo_process_incoming_thread(void *opaque) }qemu_mutex_lock_iothread (); -qemu_system_reset (VMRESET_SILENT ); +qemu_system_reset (VMRESET_SILENT ,SHUTDOWN_CAUSE_NONE ); vmstate_loading = true;if (qemu_loadvm_state (fb) <0 ) {error_report ("COLO: loadvm failed" );migration/savevm.c +0
-0
migration/savevm.c int load_vmstate(const char *name) · line 2306
Quoted 8 lines
migration/savevm.c +1
-1@@ -2300,7 +2300,7 @@ int load_vmstate(const char *name)return -EINVAL ; } -qemu_system_reset (VMRESET_SILENT ); +qemu_system_reset (VMRESET_SILENT ,SHUTDOWN_CAUSE_NONE ); mis->from_src_file = f;aio_context_acquire (aio_context);
You seem to be passing SHUTDOWN_CAUSE_NONE exactly with VMRESET_SILENT. Would it be possible to have SHUTDOWN_CAUSE_NONE imply !report, any other case imply report, and get rid of the first parameter?
Re: [Qemu-devel] [PATCH v6 2/5] shutdown: Prepare for use of an enum in reset/shutdown_request
Quoted 20 lines · Markus Armbruster
Quoted 18 lines · Eric Blake
We want to track why a guest was shutdown; in particular, being able to tell the difference between a guest request (such as ACPI request) and host request (such as SIGINT) will prove useful to libvirt. Since all requests eventually end up changing
shutdown_requestedinvl.c, the logical change is to make that value track the reason, rather than its current 0/1 contents.Since command-line options control whether a reset request is turned into a shutdown request instead, the same treatment is given to
reset_requested.This patch adds an internal enum ShutdownCause that describes reasons that a shutdown can be requested, and changes
qemu_system_reset()to pass the reason through, although for now it is not reported. The enum could be exported via QAPI at a later date, if deemed necessary, but for now, there has not been a request to expose that much detail to end clients.
Quoted 6 lines
Quoted 3 lines
For now, we only populate the reason with
HOST_ERROR, along with FIXME comments that describe our plans for how to pass an actual correct reason.In other words, replacing 0 by
SHUTDOWN_CAUSE_NONE, and 1 bySHUTDOWN_CAUSE_HOST_ERROR. Makes sense.
Maybe I could have ordered HOST_ERROR to actually be 1...
Quoted 11 lines
include/sysemu/sysemu.h void vm_state_notify(int running, RunState state); · line 41
Quoted 3 lines
include/sysemu/sysemu.h +3
-0+/* Enumeration of various causes for shutdown. */ +typedef enum ShutdownCause ShutdownCause ; +enum ShutdownCause {Why define the typedef separately here? What's wrong with
typedef enum ShutdownCause { ... } ShutdownCause;?
That would work too. I don't know if the code base has a strong preference for one form over the other.
Quoted 9 lines
Quoted 2 lines
+
SHUTDOWN_CAUSE_NONE, /* No shutdown requested yet */Comment is fine. Possible alternative: /* No shutdown request pending */
Quoted 4 lines
include/sysemu/sysemu.h +4
-0+SHUTDOWN_CAUSE_HOST_QMP ,/* Reaction to a QMP command, like 'quit' */ +SHUTDOWN_CAUSE_HOST_SIGNAL ,/* Reaction to a signal, such as SIGINT */ +SHUTDOWN_CAUSE_HOST_UI ,/* Reaction to UI event, like window close */ + SHUTDOWN_CAUSE_HOST_ERROR, /* An error prevents further use of guest */
...rather than 4. I don't know that it matters much.
Quoted 8 lines
vl.c static void qemu_kill_report(void) · line 1653
Quoted 5 lines
vl.c +2
-2-static int qemu_reset_requested (void ) +static ShutdownCause qemu_reset_requested (void ) { -int r = reset_requested; +ShutdownCause r = reset_requested;Good opportunity to insert a blank line here.
Sure.
Quoted 14 lines
Quoted 14 lines
if (r && replay_checkpoint(CHECKPOINT_RESET_REQUESTED)) {vl.c +2
-2- reset_requested =0 ; + reset_requested =SHUTDOWN_CAUSE_NONE ;return r; } -return false; +return SHUTDOWN_CAUSE_NONE ; }static int qemu_suspend_requested (void )@@ -1686,7 +1687,12 @@ static int qemu_debug_requested(void)return r; }
Quoted 8 lines
vl.c static int qemu_debug_requested(void) · line 1694
Quoted 6 lines
vl.c +5
-1-void qemu_system_reset (bool report) +/* +* Reset the VM. If @report is VMRESET_REPORT, issue an event, using +* the @reason interpreted as ShutdownCause for details. Otherwise, +* @report is VMRESET_SILENT and @reason is ignored. +*/ "interpreted as ShutdownCause"? It *is* a ShutdownCause. Leftover?
Oh, yeah. In v5, the parameter was 'int'.
Quoted 5 lines
Quoted 5 lines
vl.c +1
-0+void qemu_system_reset (bool report,ShutdownCause reason) {MachineClass *mc;
Quoted 10 lines
vl.c void qemu_system_reset(bool report) · line 1712
Quoted 8 lines
vl.c +1
-0@@ -1700,6 +1706,7 @@ void qemu_system_reset(bool report)qemu_devices_reset (); }if (report) { +assert (reason);qapi_event_send_reset (&error_abort); }cpu_synchronize_all_post_reset ();Looks like we're not using @reason "for details" just yet.
Correct. I can add a FIXME (to be removed in the later patch where it is used) if that is desired.
Quoted 9 lines
vl.c void qemu_system_killed(int signal, pid_t pid) · line 1818
Quoted 6 lines
vl.c +1
-1@@ -1807,7 +1815,7 @@ void qemu_system_killed(int signal, pid_t pid)/* Cannot call qemu_system_shutdown_request directly because * we are in a signal handler. */ - shutdown_requested =1 ; + shutdown_requested =SHUTDOWN_CAUSE_HOST_SIGNAL ;Should this be
SHUTDOWN_CAUSE_HOST_ERROR, to be updated in the next patch? Alternatively, tweak this patch's commit message?
This is the one case that we actually do have a strong cause affiliated with the reason without having to resort to changing function signatures. Commit message tweak is better.
Quoted 14 lines
Quoted 14 lines
vl.c +3
-1@@ -1846,13 +1855,16 @@ void qemu_system_debug_request(void)static bool main_loop_should_exit (void ) {RunState r; +ShutdownCause request; +if (qemu_debug_requested ()) {vm_stop (RUN_STATE_DEBUG ); }if (qemu_suspend_requested ()) {qemu_system_suspend (); } -if (qemu_shutdown_requested ()) { + request =qemu_shutdown_requested ();
Quoted 8 lines
vl.c void qemu_system_debug_request(void) · line 1870
Quoted 4 lines
vl.c +1
-0+if (request) {qemu_kill_report ();qapi_event_send_shutdown (&error_abort);if (no_shutdown) {The detour through @request appears isn't necessary here. Perhaps you do it for consistency with the next hunk. Do you? Just asking to make sure I get what you're doing.
Consistency with the next hunk, AND because a later patch then uses 'request' to pass an additional parameter to qapi_event_send_shutdown().
Quoted 4 lines
Hmm, there's another one in
xen-hvm.c, but consistency hardly applies there. If later patches add more uses, you might want delay the change until then.
Can do, if it makes incremental reviews easier.
Quoted 9 lines
Quoted 9 lines
+++
b/migration/savevm.cmigration/savevm.c +1
-1@@ -2300,7 +2300,7 @@ int load_vmstate(const char *name)return -EINVAL ; } -qemu_system_reset (VMRESET_SILENT ); +qemu_system_reset (VMRESET_SILENT ,SHUTDOWN_CAUSE_NONE ); mis->from_src_file = f;
Quoted 5 lines
migration/savevm.c int load_vmstate(const char *name) · line 2306
Quoted 1 line
migration/savevm.c +0
-0aio_context_acquire (aio_context);You seem to be passing
SHUTDOWN_CAUSE_NONEexactly withVMRESET_SILENT. Would it be possible to haveSHUTDOWN_CAUSE_NONEimply !report, any other case imply report, and get rid of the first parameter?
Indeed, and it would also get rid of the ugly
#define VMRESET_SILENT false
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v6 2/5] shutdown: Prepare for use of an enum in reset/shutdown_request
Quoted 21 lines · Eric Blake
Quoted 20 lines · Markus Armbruster
Quoted 18 lines · Eric Blake
We want to track why a guest was shutdown; in particular, being able to tell the difference between a guest request (such as ACPI request) and host request (such as SIGINT) will prove useful to libvirt. Since all requests eventually end up changing
shutdown_requestedinvl.c, the logical change is to make that value track the reason, rather than its current 0/1 contents.Since command-line options control whether a reset request is turned into a shutdown request instead, the same treatment is given to
reset_requested.This patch adds an internal enum ShutdownCause that describes reasons that a shutdown can be requested, and changes
qemu_system_reset()to pass the reason through, although for now it is not reported. The enum could be exported via QAPI at a later date, if deemed necessary, but for now, there has not been a request to expose that much detail to end clients.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
For now, we only populate the reason with
HOST_ERROR, along with FIXME comments that describe our plans for how to pass an actual correct reason.In other words, replacing 0 by
SHUTDOWN_CAUSE_NONE, and 1 bySHUTDOWN_CAUSE_HOST_ERROR. Makes sense.Maybe I could have ordered
HOST_ERRORto actually be 1...
Might be marginally worthwhile if you can split patches so that the one replacing int by ShutdownCause doesn't change anything but names.
Quoted 6 lines
Quoted 6 lines
include/sysemu/sysemu.h void vm_state_notify(int running, RunState state); · line 41
Quoted 3 lines
include/sysemu/sysemu.h +3
-0+/* Enumeration of various causes for shutdown. */ +typedef enum ShutdownCause ShutdownCause ; +enum ShutdownCause {Why define the typedef separately here? What's wrong with
Quoted 8 lines
Quoted 5 lines
typedef enum ShutdownCause { ... } ShutdownCause;?
That would work too. I don't know if the code base has a strong preference for one form over the other.
I don't have numbers, but I think we use the split form pretty much only when there's a reason for the split, such as defining an incomplete type in a header, and completing it elsewhere.
Quoted 46 lines
Quoted 8 lines
Quoted 1 line
+
SHUTDOWN_CAUSE_NONE, /* No shutdown requested yet */Comment is fine. Possible alternative: /* No shutdown request pending */
Quoted 4 lines
include/sysemu/sysemu.h +4
-0+SHUTDOWN_CAUSE_HOST_QMP ,/* Reaction to a QMP command, like 'quit' */ +SHUTDOWN_CAUSE_HOST_SIGNAL ,/* Reaction to a signal, such as SIGINT */ +SHUTDOWN_CAUSE_HOST_UI ,/* Reaction to UI event, like window close */ + SHUTDOWN_CAUSE_HOST_ERROR, /* An error prevents further use of guest */...rather than 4. I don't know that it matters much.
Quoted 8 lines
vl.c static void qemu_kill_report(void) · line 1653
Quoted 5 lines
vl.c +2
-2-static int qemu_reset_requested (void ) +static ShutdownCause qemu_reset_requested (void ) { -int r = reset_requested; +ShutdownCause r = reset_requested;Good opportunity to insert a blank line here.
Sure.
Quoted 14 lines
Quoted 14 lines
if (r && replay_checkpoint(CHECKPOINT_RESET_REQUESTED)) {vl.c +2
-2- reset_requested =0 ; + reset_requested =SHUTDOWN_CAUSE_NONE ;return r; } -return false; +return SHUTDOWN_CAUSE_NONE ; }static int qemu_suspend_requested (void )@@ -1686,7 +1687,12 @@ static int qemu_debug_requested(void)return r; }Quoted 8 lines
vl.c static int qemu_debug_requested(void) · line 1694
Quoted 6 lines
vl.c +5
-1-void qemu_system_reset (bool report) +/* +* Reset the VM. If @report is VMRESET_REPORT, issue an event, using +* the @reason interpreted as ShutdownCause for details. Otherwise, +* @report is VMRESET_SILENT and @reason is ignored. +*/ "interpreted as ShutdownCause"? It *is* a ShutdownCause. Leftover?
Quoted 1 line
Oh, yeah. In v5, the parameter was 'int'.
Easy enough to clean up :)
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
vl.c +1
-0+void qemu_system_reset (bool report,ShutdownCause reason) {MachineClass *mc;Quoted 10 lines
vl.c void qemu_system_reset(bool report) · line 1712
Quoted 8 lines
vl.c +1
-0@@ -1700,6 +1706,7 @@ void qemu_system_reset(bool report)qemu_devices_reset (); }if (report) { +assert (reason);qapi_event_send_reset (&error_abort); }cpu_synchronize_all_post_reset ();Looks like we're not using @reason "for details" just yet.
Quoted 2 lines
Correct. I can add a FIXME (to be removed in the later patch where it is used) if that is desired.
Not necessary if the function comment refrains from claiming it *is* used.
Quoted 10 lines
Quoted 9 lines
vl.c void qemu_system_killed(int signal, pid_t pid) · line 1818
Quoted 6 lines
vl.c +1
-1@@ -1807,7 +1815,7 @@ void qemu_system_killed(int signal, pid_t pid)/* Cannot call qemu_system_shutdown_request directly because * we are in a signal handler. */ - shutdown_requested =1 ; + shutdown_requested =SHUTDOWN_CAUSE_HOST_SIGNAL ;Should this be
SHUTDOWN_CAUSE_HOST_ERROR, to be updated in the next patch? Alternatively, tweak this patch's commit message?
Quoted 3 lines
This is the one case that we actually do have a strong cause affiliated with the reason without having to resort to changing function signatures. Commit message tweak is better.
Works for me.
Quoted 27 lines
Quoted 14 lines
Quoted 14 lines
vl.c +3
-1@@ -1846,13 +1855,16 @@ void qemu_system_debug_request(void)static bool main_loop_should_exit (void ) {RunState r; +ShutdownCause request; +if (qemu_debug_requested ()) {vm_stop (RUN_STATE_DEBUG ); }if (qemu_suspend_requested ()) {qemu_system_suspend (); } -if (qemu_shutdown_requested ()) { + request =qemu_shutdown_requested ();Quoted 8 lines
vl.c void qemu_system_debug_request(void) · line 1870
Quoted 4 lines
vl.c +1
-0+if (request) {qemu_kill_report ();qapi_event_send_shutdown (&error_abort);if (no_shutdown) {The detour through @request appears isn't necessary here. Perhaps you do it for consistency with the next hunk. Do you? Just asking to make sure I get what you're doing.
Consistency with the next hunk, AND because a later patch then uses 'request' to pass an additional parameter to
qapi_event_send_shutdown().Quoted 1 line
Quoted 5 lines
Quoted 3 lines
Hmm, there's another one in
xen-hvm.c, but consistency hardly applies there. If later patches add more uses, you might want delay the change until then.Can do, if it makes incremental reviews easier.
Use your judgement.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
+++
b/migration/savevm.cmigration/savevm.c +1
-1@@ -2300,7 +2300,7 @@ int load_vmstate(const char *name)return -EINVAL ; } -qemu_system_reset (VMRESET_SILENT ); +qemu_system_reset (VMRESET_SILENT ,SHUTDOWN_CAUSE_NONE ); mis->from_src_file = f;
Quoted 8 lines
Quoted 5 lines
migration/savevm.c int load_vmstate(const char *name) · line 2306
Quoted 1 line
migration/savevm.c +0
-0aio_context_acquire (aio_context);You seem to be passing
SHUTDOWN_CAUSE_NONEexactly withVMRESET_SILENT. Would it be possible to haveSHUTDOWN_CAUSE_NONEimply !report, any other case imply report, and get rid of the first parameter?Indeed, and it would also get rid of the ugly
#defineVMRESET_SILENTfalse
I'd love that.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v6 3/5 shutdown: Add source information to SHUTDOWN and RESET
In reply to Eric BlakeTime to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch.
It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers.
Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests.
Replay adds a FIXME to preserve the cause across the replay stream, that will be tackled in the next patch.
---
v6: defer event additions to later, add reviews of unchanged portions
v5: drop accidental addition of unrelated files
v4: s/ShutdownType/ShutdownCause/, no thanks to mingw header pollution
v3: retitle again, fix qemu-iotests, use enum rather than raw bool in all callers
v2: retitle (was "event: Add signal information to SHUTDOWN"), completely rework to post bool based on whether it is guest-initiated
v1: initial submission, exposing just Unix signals from host
--- include/sysemu/sysemu.h | 4 ++-- vl.c | 17 ++++++++--------- hw/acpi/core.c | 4 ++-- hw/arm/highbank.c | 4 ++-- hw/arm/integratorcp.c | 2 +- hw/arm/musicpal.c | 2 +- hw/arm/omap1.c | 10 ++++++---- hw/arm/omap2.c | 2 +- hw/arm/spitz.c | 2 +- hw/arm/stellaris.c | 2 +- hw/arm/tosa.c | 2 +- hw/i386/pc.c | 2 +- hw/i386/xen/xen-hvm.c | 2 +- hw/input/pckbd.c | 4 ++-- hw/ipmi/ipmi.c | 4 ++-- hw/isa/lpc_ich9.c | 2 +- hw/mips/boston.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_r4k.c | 4 ++-- hw/misc/arm_sysctl.c | 8 ++++---- hw/misc/cbus.c | 2 +- hw/misc/macio/cuda.c | 4 ++-- hw/misc/slavio_misc.c | 4 ++-- hw/misc/zynq_slcr.c | 2 +- hw/pci-host/apb.c | 4 ++-- hw/pci-host/bonito.c | 2 +- hw/pci-host/piix.c | 2 +- hw/ppc/e500.c | 2 +- hw/ppc/mpc8544_guts.c | 2 +- hw/ppc/ppc.c | 2 +- hw/ppc/ppc405_uc.c | 2 +- hw/ppc/spapr_hcall.c | 2 +- hw/ppc/spapr_rtas.c | 4 ++-- hw/s390x/ipl.c | 2 +- hw/sh4/r2d.c | 2 +- hw/timer/etraxfs_timer.c | 2 +- hw/timer/m48t59.c | 4 ++-- hw/timer/milkymist-sysctl.c | 4 ++-- hw/timer/pxa2xx_timer.c | 2 +- hw/watchdog/watchdog.c | 2 +- hw/xenpv/xen_domainbuild.c | 2 +- hw/xtensa/xtfpga.c | 2 +- kvm-all.c | 6 +++--- os-win32.c | 2 +- qmp.c | 4 ++-- replay/replay.c | 3 ++- target/alpha/sys_helper.c | 4 ++-- target/arm/psci.c | 4 ++-- target/i386/excp_helper.c | 2 +- target/i386/hax-all.c | 6 +++--- target/i386/helper.c | 2 +- target/i386/kvm.c | 2 +- target/s390x/helper.c | 2 +- target/s390x/kvm.c | 4 ++-- target/s390x/misc_helper.c | 4 ++-- target/sparc/int32_helper.c | 2 +- ui/sdl.c | 2 +- ui/sdl2.c | 4 ++-- trace-events | 2 +- ui/cocoa.m | 2 +- 60 files changed, 98 insertions(+), 96 deletions(-)
include/sysemu/sysemu.h +2 -2
@@ -65,13 +65,13 @@ typedef enum WakeupReason {QEMU_WAKEUP_REASON_OTHER , } WakeupReason; -void qemu_system_reset_request (void ); +void qemu_system_reset_request (ShutdownCause reason);void qemu_system_suspend_request (void );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_system_shutdown_request (void ); +void qemu_system_shutdown_request (ShutdownCause reason);void qemu_system_powerdown_request (void );void qemu_register_powerdown_notifier (Notifier *notifier);void qemu_system_debug_request (void );
vl.c +8 -9
@@ -1725,7 +1725,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)if (!no_shutdown) {qapi_event_send_guest_panicked (GUEST_PANIC_ACTION_POWEROFF , !!info, info, &error_abort); -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_PANIC ); }if (info) {
@@ -1742,13 +1742,12 @@ void qemu_system_guest_panicked(GuestPanicInformation *info) } } -void qemu_system_reset_request (void ) +void qemu_system_reset_request (ShutdownCause reason) {if (no_reboot) { -/* FIXME - add a parameter to allow callers to specify reason */ - shutdown_requested =SHUTDOWN_CAUSE_HOST_ERROR ; + shutdown_requested = reason; }else { - reset_requested =SHUTDOWN_CAUSE_HOST_ERROR ; + reset_requested = reason; }cpu_stop_current ();qemu_notify_event ();
@@ -1819,12 +1818,12 @@ void qemu_system_killed(int signal, pid_t pid)qemu_notify_event (); } -void qemu_system_shutdown_request (void ) +void qemu_system_shutdown_request (ShutdownCause reason) { -trace_qemu_system_shutdown_request (); +trace_qemu_system_shutdown_request (reason); +/* FIXME - add a parameter to let replay preserve reason */ replay_shutdown_request (); -/* FIXME - add a parameter to allow callers to specify reason */ - shutdown_requested =SHUTDOWN_CAUSE_HOST_ERROR ; + shutdown_requested = reason;qemu_notify_event (); }
hw/acpi/core.c +2 -2
@@ -561,7 +561,7 @@ static void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)uint16_t sus_typ = (val >>10 ) &7 ;switch (sus_typ) {case 0 :/* soft power off */ -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );break ;case 1 :qemu_system_suspend_request ();
@@ -569,7 +569,7 @@ static void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)default :if (sus_typ == ar->pm1.cnt.s4_val) {/* S4 request */ qapi_event_send_suspend_disk (&error_abort); -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); }break ; }
hw/arm/highbank.c +2 -2
@@ -108,9 +108,9 @@ static void hb_regs_write(void *opaque, hwaddr offset,if (offset ==0xf00 ) {if (value ==1 || value ==2 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }else if (value ==3 ) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); } }
hw/arm/integratorcp.c +1 -1
@@ -158,7 +158,7 @@ static void integratorcm_do_remap(IntegratorCMState *s)static void integratorcm_set_ctrl (IntegratorCMState *s,uint32_t value) {if (value &8 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }if ((s->cm_ctrl ^ value) &1 ) {/* (value & 1) != 0 means the green "MISC LED" is lit.
hw/arm/musicpal.c +1 -1
@@ -898,7 +898,7 @@ static void mv88w8618_pit_write(void *opaque, hwaddr offset,case MP_BOARD_RESET :if (value ==MP_BOARD_RESET_MAGIC ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ; }
hw/arm/omap1.c +6 -4
@@ -355,7 +355,7 @@ static void omap_wd_timer_write(void *opaque, hwaddr addr,/* XXX: on T|E hardware somehow this has no effect, * on Zire 71 it works as specified. */ s->reset =1 ; -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } } s->last_wr = value &0xff ;
@@ -1545,8 +1545,10 @@ static inline void omap_clkm_idlect1_update(struct omap_mpu_state_s *s,if (value & (1 <<11 )) {/* SETARM_IDLE */ cpu_interrupt (CPU (s->cpu),CPU_INTERRUPT_HALT ); } -if (!(value & (1 <<10 )))/* WKUP_MODE */ -qemu_system_shutdown_request ();/* XXX: disable wakeup from IRQ */ +if (!(value & (1 <<10 ))) {/* WKUP_MODE */ +/* XXX: disable wakeup from IRQ */ +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); + }#define SET_CANIDLE (clock, bit) \ if (diff & (1 << bit)) { \
@@ -1693,7 +1695,7 @@ static void omap_clkm_write(void *opaque, hwaddr addr, diff = s->clkm.arm_rstct1 ^ value; s->clkm.arm_rstct1 = value &0x0007 ;if (value &9 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); s->clkm.cold_start =0xa ; }if (diff & ~value &4 ) {/* DSP_RST */
hw/arm/omap2.c +1 -1
@@ -1610,7 +1610,7 @@ static void omap_prcm_write(void *opaque, hwaddr addr,case 0x450 :/* RM_RSTCTRL_WKUP */ /* TODO: reset */ if (value &2 ) -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );break ;case 0x454 :/* RM_RSTTIME_WKUP */ s->rsttime_wkup = value &0x1fff ;
hw/arm/spitz.c +1 -1
@@ -848,7 +848,7 @@ static void spitz_lcd_hsync_handler(void *opaque, int line, int level)static void spitz_reset (void *opaque,int line,int level) {if (level) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }
hw/arm/stellaris.c +1 -1
@@ -1197,7 +1197,7 @@ staticvoid do_sys_reset (void *opaque,int n,int level) {if (level) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }
hw/arm/tosa.c +1 -1
@@ -90,7 +90,7 @@ static void tosa_out_switch(void *opaque, int line, int level)static void tosa_reset (void *opaque,int line,int level) {if (level) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }
hw/i386/pc.c +1 -1
@@ -519,7 +519,7 @@ static void port92_write(void *opaque, hwaddr addr, uint64_t val, s->outport = val;qemu_set_irq (s->a20_out, (val >>1 ) &1 );if ((val &1 ) && !(oldval &1 )) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }
hw/i386/xen/xen-hvm.c +1 -1
@@ -1398,7 +1398,7 @@ void xen_shutdown_fatal_error(const char *fmt, ...)va_end (ap);fprintf (stderr,"Will destroy the domain.\n" );/* destroy the domain */ -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_ERROR ); }void xen_hvm_modified_memory (ram_addr_t start,ram_addr_t length)
hw/input/pckbd.c +2 -2
@@ -226,7 +226,7 @@ static void outport_write(KBDState *s, uint32_t val) s->outport = val;qemu_set_irq (s->a20_out, (val >>1 ) &1 );if (!(val &1 )) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }
@@ -301,7 +301,7 @@ static void kbd_write_command(void *opaque, hwaddr addr, s->outport &= ~KBD_OUT_A20 ;break ;case KBD_CCMD_RESET : -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );break ;case KBD_CCMD_NO_OP :/* ignore that */
hw/ipmi/ipmi.c +2 -2
@@ -44,14 +44,14 @@ static int ipmi_do_hw_op(IPMIInterface *s, enum ipmi_op op, int checkonly)if (checkonly) {return 0 ; } -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );return 0 ;case IPMI_POWEROFF_CHASSIS :if (checkonly) {return 0 ; } -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );return 0 ;case IPMI_SEND_NMI :
hw/isa/lpc_ich9.c +1 -1
@@ -606,7 +606,7 @@ static void ich9_rst_cnt_write(void *opaque, hwaddr addr, uint64_t val,ICH9LPCState *lpc = opaque;if (val &4 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );return ; } lpc->rst_cnt = val &0xA ;/* keep FULL_RST (bit 3) and SYS_RST (bit 1) */
hw/mips/boston.c +1 -1
@@ -232,7 +232,7 @@ static void boston_platreg_write(void *opaque, hwaddr addr,break ;case PLAT_SOFTRST_CTL :if (val &PLAT_SOFTRST_CTL_SYSRESET ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ;default :
hw/mips/mips_malta.c +1 -1
@@ -470,7 +470,7 @@ static void malta_fpga_write(void *opaque, hwaddr addr,/* SOFTRES Register */ case 0x00500 :if (val ==0x42 ) -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );break ;/* BRKRES Register */
hw/mips/mips_r4k.c +2 -2
@@ -53,9 +53,9 @@ static void mips_qemu_write (void *opaque, hwaddr addr, uint64_t val, unsigned size) {if ((addr &0xffff ) ==0 && val ==42 ) -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );else if ((addr &0xffff ) ==4 && val ==42 ) -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); } static uint64_t mips_qemu_read (void *opaque, hwaddr addr,
hw/misc/arm_sysctl.c +4 -4
@@ -351,13 +351,13 @@ static bool vexpress_cfgctrl_write(arm_sysctl_state *s, unsigned int dcc,break ;case SYS_CFG_SHUTDOWN :if (site ==SYS_CFG_SITE_MB && device ==0 ) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );return true; }break ;case SYS_CFG_REBOOT :if (site ==SYS_CFG_SITE_MB && device ==0 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );return true; }break ;
@@ -429,7 +429,7 @@ static void arm_sysctl_write(void *opaque, hwaddr offset,if (s->lockval ==LOCK_VALUE ) { s->resetlevel = val;if (val &0x100 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }break ;
@@ -438,7 +438,7 @@ static void arm_sysctl_write(void *opaque, hwaddr offset,if (s->lockval ==LOCK_VALUE ) { s->resetlevel = val;if (val &0x04 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }break ;
hw/misc/cbus.c +1 -1
@@ -356,7 +356,7 @@ static inline void retu_write(CBusRetu *s, int reg, uint16_t val)case RETU_REG_WATCHDOG :if (val ==0 && (s->cc[0 ] &2 )) -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );break ;case RETU_REG_TXCR :
hw/misc/macio/cuda.c +2 -2
@@ -612,7 +612,7 @@ static bool cuda_cmd_powerdown(CUDAState *s,return false; } -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );return true; }
@@ -624,7 +624,7 @@ static bool cuda_cmd_reset_system(CUDAState *s,return false; } -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );return true; }
hw/misc/slavio_misc.c +2 -2
@@ -258,7 +258,7 @@ static void slavio_aux2_mem_writeb(void *opaque, hwaddr addr, val &=AUX2_PWROFF ; s->aux2 = val;if (val &AUX2_PWROFF ) -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );slavio_misc_update_irq (s); }
@@ -338,7 +338,7 @@ static void slavio_sysctrl_mem_writel(void *opaque, hwaddr addr,case 0 :if (val &SYS_RESET ) { s->sysctrl =SYS_RESETSTAT ; -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ;default :
hw/misc/zynq_slcr.c +1 -1
@@ -405,7 +405,7 @@ static void zynq_slcr_write(void *opaque, hwaddr offset,switch (offset) {case PSS_RST_CTRL :if (val &R_PSS_RST_CTRL_SOFT_RST ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ; }
hw/pci-host/apb.c +2 -2
@@ -482,9 +482,9 @@ static void apb_config_writel (void *opaque, hwaddr addr, s->reset_control |= val &RESET_WMASK ;if (val &SOFT_POR ) { s->nr_resets =0 ; -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }else if (val &SOFT_XIR ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }break ;
hw/pci-host/bonito.c +1 -1
@@ -269,7 +269,7 @@ static void bonito_writel(void *opaque, hwaddr addr, } s->regs[saddr] = val;if (reset) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ;case BONITO_INTENSET :
hw/pci-host/piix.c +1 -1
@@ -638,7 +638,7 @@ static void rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned len)PIIX3State *d = opaque;if (val &4 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );return ; } d->rcr = val &2 ;/* keep System Reset type only */
hw/ppc/e500.c +1 -1
@@ -774,7 +774,7 @@ static qemu_irq *ppce500_init_mpic(MachineState *machine, PPCE500Params *params,static void ppce500_power_off (void *opaque,int line,int on) {if (on) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); } }
hw/ppc/mpc8544_guts.c +1 -1
@@ -98,7 +98,7 @@ static void mpc8544_guts_write(void *opaque, hwaddr addr,switch (addr) {case MPC8544_GUTS_ADDR_RSTCR :if (value &MPC8544_GUTS_RSTCR_RESET ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ;default :
hw/ppc/ppc.c +1 -1
@@ -412,7 +412,7 @@ static void ppce500_set_irq(void *opaque, int pin, int level)if (level) {LOG_IRQ ("%s: reset the PowerPC system\n" , __func__); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ;case PPCE500_INPUT_RESET_CORE :
hw/ppc/ppc405_uc.c +1 -1
@@ -1807,7 +1807,7 @@ void ppc40x_chip_reset(PowerPCCPU *cpu)void ppc40x_system_reset (PowerPCCPU *cpu) {printf ("Reset PowerPC system\n" ); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }void store_40x_dbcr0 (CPUPPCState *env,uint32_t val)
hw/ppc/spapr_hcall.c +1 -1
@@ -1166,7 +1166,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,spapr_ovec_cleanup (ov5_updates);if (spapr->cas_reboot) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }else {/* If ppc_spapr_reset() did not set up a HPT but one is necessary * (because the guest isn't going to use radix) then set it up here. */
hw/ppc/spapr_rtas.c +2 -2
@@ -110,7 +110,7 @@ static void rtas_power_off(PowerPCCPU *cpu, sPAPRMachineState *spapr,rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; } -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );cpu_stop_current ();rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); }
@@ -124,7 +124,7 @@ static void rtas_system_reboot(PowerPCCPU *cpu, sPAPRMachineState *spapr,rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; } -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); }
hw/s390x/ipl.c +1 -1
@@ -363,7 +363,7 @@ void s390_reipl_request(void)S390IPLState *ipl =get_ipl_device (); ipl->reipl_requested = true; -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }void s390_ipl_prepare_cpu (S390CPU *cpu)
hw/sh4/r2d.c +1 -1
@@ -164,7 +164,7 @@ r2d_fpga_write(void *opaque, hwaddr addr, uint64_t value, unsigned int size)break ;case PA_POWOFF :if (value &1 ) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); }break ;case PA_VERREG :
hw/timer/etraxfs_timer.c +1 -1
@@ -207,7 +207,7 @@ static void watchdog_hit(void *opaque)qemu_irq_raise (t->nmi); }else -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); t->wd_hits++; }
hw/timer/m48t59.c +2 -2
@@ -1,7 +1,7 @@/* * QEMU M48T59 and M48T08 NVRAM emulation for PPC PREP and Sparc platforms * -* Copyright (c) 2003-2005, 2007 Jocelyn Mayer +* Copyright (c) 2003-2005, 2007, 2017 Jocelyn Mayer * Copyright (c) 2013 Hervé Poussineau * * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -159,7 +159,7 @@ static void watchdog_cb (void *opaque)NVRAM ->buffer[0x1FF7 ] =0x00 ;NVRAM ->buffer[0x1FFC ] &= ~0x40 ;/* May it be a hw CPU Reset instead ? */ -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }else {qemu_set_irq (NVRAM ->IRQ,1 );qemu_set_irq (NVRAM ->IRQ,0 );
hw/timer/milkymist-sysctl.c +2 -2
@@ -90,7 +90,7 @@ static void sysctl_icap_write(MilkymistSysctlState *s, uint32_t value)trace_milkymist_sysctl_icap_write (value);switch (value &0xffff ) {case 0x000e : -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );break ; } }
@@ -195,7 +195,7 @@ static void sysctl_write(void *opaque, hwaddr addr, uint64_t value, s->regs[addr] =1 ;break ;case R_SYSTEM_ID : -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );break ;case R_GPIO_IN :
hw/timer/pxa2xx_timer.c +1 -1
@@ -401,7 +401,7 @@ static void pxa2xx_timer_tick(void *opaque)if (t->num ==3 )if (i->reset3 &1 ) { i->reset3 =0 ; -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }
hw/watchdog/watchdog.c +1 -1
@@ -110,7 +110,7 @@ void watchdog_perform_action(void)switch (watchdog_action) {case WDT_RESET :/* same as 'system_reset' in monitor */ qapi_event_send_watchdog (WATCHDOG_EXPIRATION_ACTION_RESET , &error_abort); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );break ;case WDT_SHUTDOWN :/* same as 'system_powerdown' in monitor */
hw/xenpv/xen_domainbuild.c +1 -1
@@ -148,7 +148,7 @@ static void xen_domain_poll(void *opaque)return ; quit: -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); }static int xen_domain_watcher (void )
hw/xtensa/xtfpga.c +1 -1
@@ -100,7 +100,7 @@ static void lx60_fpga_write(void *opaque, hwaddr addr,case 0x10 :/*board reset*/ if (val ==0xdead ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ; }
kvm-all.c +3 -3
@@ -2052,7 +2052,7 @@ int kvm_cpu_exec(CPUState *cpu)break ;case KVM_EXIT_SHUTDOWN :DPRINTF ("shutdown\n" ); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); ret =EXCP_INTERRUPT ;break ;case KVM_EXIT_UNKNOWN :
@@ -2066,11 +2066,11 @@ int kvm_cpu_exec(CPUState *cpu)case KVM_EXIT_SYSTEM_EVENT :switch (run->system_event.type) {case KVM_SYSTEM_EVENT_SHUTDOWN : -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); ret =EXCP_INTERRUPT ;break ;case KVM_SYSTEM_EVENT_RESET : -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); ret =EXCP_INTERRUPT ;break ;case KVM_SYSTEM_EVENT_CRASH :
os-win32.c +1 -1
@@ -52,7 +52,7 @@ int setenv(const char *name, const char *value, int overwrite) static BOOL WINAPI qemu_ctrl_handler(DWORD type) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_SIGNAL );/* Windows 7 kills application when the function returns. Sleep here to give QEMU a try for closing. Sleep period is 10000ms because Windows kills the program
qmp.c +2 -2
@@ -84,7 +84,7 @@ UuidInfo *qmp_query_uuid(Error **errp)void qmp_quit (Error **errp) { no_shutdown =0 ; -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_QMP ); }void qmp_stop (Error **errp)
@@ -105,7 +105,7 @@ void qmp_stop(Error **errp)void qmp_system_reset (Error **errp) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_HOST_QMP ); }void qmp_system_powerdown (Error **erp)
replay/replay.c +2 -1
@@ -51,7 +51,8 @@ bool replay_next_event_is(int event)switch (replay_state.data_kind) {case EVENT_SHUTDOWN :replay_finish_event (); -qemu_system_shutdown_request (); +/* FIXME - store actual reason */ +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_ERROR );break ;default :/* clock, time_t, checkpoint and other events */
target/alpha/sys_helper.c +2 -2
@@ -60,9 +60,9 @@ void helper_tb_flush(CPUAlphaState *env)void helper_halt (uint64_t restart) {if (restart) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }else { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); } }
target/arm/psci.c +2 -2
@@ -137,7 +137,7 @@ void arm_handle_psci_call(ARMCPU *cpu) }break ;case QEMU_PSCI_0_2_FN_SYSTEM_RESET : -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );/* QEMU reset and shutdown are async requests, but PSCI * mandates that we never return from the reset/shutdown * call, so power the CPU off now so it doesn't execute
@@ -145,7 +145,7 @@ void arm_handle_psci_call(ARMCPU *cpu)*/ goto cpu_off;case QEMU_PSCI_0_2_FN_SYSTEM_OFF : -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); goto cpu_off;case QEMU_PSCI_0_1_FN_CPU_ON :case QEMU_PSCI_0_2_FN_CPU_ON :
target/i386/excp_helper.c +1 -1
@@ -59,7 +59,7 @@ static int check_exception(CPUX86State *env, int intno, int *error_code,qemu_log_mask (CPU_LOG_RESET ,"Triple fault\n" ); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); return EXCP_HLT; }#endif
target/i386/hax-all.c +3 -3
@@ -540,14 +540,14 @@ static int hax_vcpu_hax_exec(CPUArchState *env)/* Guest state changed, currently only for shutdown */ case HAX_EXIT_STATECHANGE :fprintf (stdout,"VCPU shutdown request\n" ); -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );hax_vcpu_sync_state (env,0 ); ret =1 ;break ;case HAX_EXIT_UNKNOWN_VMEXIT :fprintf (stderr,"Unknown VMX exit %x from guest\n" , ht->_exit_reason); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );hax_vcpu_sync_state (env,0 );cpu_dump_state (cpu, stderr, fprintf,0 ); ret =-1 ;
@@ -578,7 +578,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env)break ;default :fprintf (stderr,"Unknown exit %x from HAX\n" , ht->_exit_status); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );hax_vcpu_sync_state (env,0 );cpu_dump_state (cpu, stderr, fprintf,0 ); ret =1 ;
target/i386/helper.c +1 -1
@@ -1212,7 +1212,7 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cpu_data data)" triple fault\n" , cs->cpu_index);qemu_log_mask (CPU_LOG_RESET ,"Triple fault\n" ); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );return ; }if (banks[1 ] &MCI_STATUS_VAL ) {
target/i386/kvm.c +1 -1
@@ -2930,7 +2930,7 @@ int kvm_arch_process_async_events(CPUState *cs)if (env->exception_injected ==EXCP08_DBLE ) {/* this means triple fault */ -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); cs->exit_request =1 ;return 0 ; }
target/s390x/helper.c +1 -1
@@ -266,7 +266,7 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)S390CPU *cpu =s390_env_get_cpu (env);if (s390_cpu_halt (cpu) ==0 ) {#ifndef CONFIG_USER_ONLY -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );#endif } }
target/s390x/kvm.c +2 -2
@@ -1929,7 +1929,7 @@ static int handle_intercept(S390CPU *cpu)cpu_synchronize_state (cs);if (s390_cpu_halt (cpu) ==0 ) {if (is_special_wait_psw (cs)) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); }else {qemu_system_guest_panicked (NULL ); }
@@ -1938,7 +1938,7 @@ static int handle_intercept(S390CPU *cpu)break ;case ICPT_CPU_STOP :if (s390_cpu_set_state (CPU_STATE_STOPPED , cpu) ==0 ) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); }if (cpu->env.sigp_order ==SIGP_STOP_STORE_STATUS ) { kvm_s390_store_status(cpu, KVM_S390_STORE_STATUS_DEF_ADDR,
target/s390x/misc_helper.c +2 -2
@@ -533,11 +533,11 @@ uint32_t HELPER(sigp)(CPUS390XState *env, uint64_t order_code, uint32_t r1,break ;#if !defined(CONFIG_USER_ONLY )case SIGP_RESTART : -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );cpu_loop_exit (CPU (s390_env_get_cpu (env)));break ;case SIGP_STOP : -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );cpu_loop_exit (CPU (s390_env_get_cpu (env)));break ;#endif
target/sparc/int32_helper.c +1 -1
@@ -109,7 +109,7 @@ void sparc_cpu_do_interrupt(CPUState *cs)if (env->psret ==0 ) {if (cs->exception_index ==0x80 && env->def->features &CPU_FEATURE_TA0_SHUTDOWN ) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); }else {cpu_abort (cs,"Trap 0x%02x while interrupts disabled, Error state" , cs->exception_index);
ui/sdl.c +1 -1
@@ -837,7 +837,7 @@ static void sdl_refresh(DisplayChangeListener *dcl)case SDL_QUIT :if (!no_quit) { no_shutdown =0 ; -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_UI ); }break ;case SDL_MOUSEMOTION :
ui/sdl2.c +2 -2
@@ -568,7 +568,7 @@ static void handle_windowevent(SDL_Event *ev)case SDL_WINDOWEVENT_CLOSE :if (!no_quit) { no_shutdown =0 ; -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_UI ); }break ;case SDL_WINDOWEVENT_SHOWN :
@@ -611,7 +611,7 @@ void sdl2_poll_events(struct sdl2_console *scon)case SDL_QUIT :if (!no_quit) { no_shutdown =0 ; -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_UI ); }break ;case SDL_MOUSEMOTION :
trace-events +1 -1
@@ -38,7 +38,7 @@ vm_state_notify(int running, int reason) "running %d reason %d" load_file(const char *name, const char *path) "name %s location %s" runstate_set(int new_state) "new state %d" system_wakeup_request(int reason) "reason=%d" -qemu_system_shutdown_request(void) "" +qemu_system_shutdown_request(int reason) "reason=%d" qemu_system_powerdown_request(void) "" # spice-qemu-char.c
ui/cocoa.m +1 -1
@@ -934,7 +934,7 @@ QemuCocoaView *cocoaView; { COCOA_DEBUG("QemuCocoaAppController: applicationWillTerminate\n"); - qemu_system_shutdown_request(); + qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); exit(0); }
Signature · 1 line
2.9.3
Re: [PATCH v6 3/5] shutdown: Add source information to SHUTDOWN and RESET
Quoted 20 lines · Eric Blake
Time to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch.
It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers.
Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests.
Replay adds a FIXME to preserve the cause across the replay stream, that will be tackled in the next patch.
Signed-off-by Eric Blake <[email protected]>
[snip]
hw/ppc/spapr_hcall.c static target_ulong h_client_architecture_support(PowerPCCPU *cpu, · line 1169
Quoted 10 lines
hw/ppc/spapr_hcall.c +1
-1@@ -1166,7 +1166,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,spapr_ovec_cleanup (ov5_updates);if (spapr->cas_reboot) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );
I'm not 100% sure about this one, since I'm not sure 100% of how the different enum values are defined. This one is tripped when feature negotiation between firmware and guest can't be satisfied without rebooting (next time round the firmware will use some different options).
So it's essentially a firmware/hypervisor triggered reset, but one that should only ever be tripped during early guest boot. Is CAUSE_GUEST_RESET correct for that?
Apart from this, ppc changes
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [PATCH v6 3/5] shutdown: Add source information to SHUTDOWN and RESET
Quoted 31 lines · David Gibson
Quoted 20 lines · Eric Blake
Time to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch.
It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers.
Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests.
Replay adds a FIXME to preserve the cause across the replay stream, that will be tackled in the next patch.
Signed-off-by Eric Blake <[email protected]>[snip]
Quoted 7 lines
hw/ppc/spapr_hcall.c +0
-0@@ -1166,7 +1166,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,spapr_ovec_cleanup (ov5_updates);
Quoted 9 lines
hw/ppc/spapr_hcall.c static target_ulong h_client_architecture_support(PowerPCCPU *cpu, · line 1169
Quoted 3 lines
hw/ppc/spapr_hcall.c +1
-1if (spapr->cas_reboot) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );I'm not 100% sure about this one, since I'm not sure 100% of how the different enum values are defined. This one is tripped when feature negotiation between firmware and guest can't be satisfied without rebooting (next time round the firmware will use some different options).
Patch 2/5 introduced the enum. The biggest part of the patch (for now) is that anything SHUTDOWN_CAUSE_HOST_ will be exposed to the QMP client as host-triggered, anything SHUTDOWN_CAUSE_GUEST_ will be exposed as guest-triggered. I basically used SHUTDOWN_CAUSE_GUEST_RESET for any call to qemu_system_reset_requst() underneath the hw/ tree, because the hw/ tree is emulating guest behavior and therefore it is presumably a reset caused by a guest request.
Quoted 4 lines
So it's essentially a
firmware/hypervisortriggered reset, but one that should only ever be tripped during early guest boot. IsCAUSE_GUEST_RESETcorrect for that?
Of course, I'm not an export on SPAPR, so I'll happily change it to anything else if you think that is more appropriate. But the rule of thumb I went by is whether this is qemu emulating a bare-metal reset/shutdown, vs. qemu killing the guest without waiting for guest instructions to reach some magic memory/register/ACPI/who-knows-what-else request. While it may happen only early during guest boot, it is still the guest firmware that is requesting it, and not qemu causing a unilateral death.
Quoted 4 lines
Apart from this, ppc changes
Acked-by David Gibson <[email protected]>
Thanks.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v6 3/5] shutdown: Add source information to SHUTDOWN and RESET
In reply to David GibsonQuoted 31 lines · David Gibson
Quoted 20 lines · Eric Blake
Time to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch.
It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers.
Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests.
Replay adds a FIXME to preserve the cause across the replay stream, that will be tackled in the next patch.
Signed-off-by Eric Blake <[email protected]>[snip]
Quoted 7 lines
hw/ppc/spapr_hcall.c +0
-0@@ -1166,7 +1166,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,spapr_ovec_cleanup (ov5_updates);
Quoted 9 lines
hw/ppc/spapr_hcall.c static target_ulong h_client_architecture_support(PowerPCCPU *cpu, · line 1169
Quoted 3 lines
hw/ppc/spapr_hcall.c +1
-1if (spapr->cas_reboot) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );I'm not 100% sure about this one, since I'm not sure 100% of how the different enum values are defined. This one is tripped when feature negotiation between firmware and guest can't be satisfied without rebooting (next time round the firmware will use some different options).
Patch 2/5 introduced the enum. The biggest part of the patch (for now) is that anything SHUTDOWN_CAUSE_HOST_ will be exposed to the QMP client as host-triggered, anything SHUTDOWN_CAUSE_GUEST_ will be exposed as guest-triggered. I basically used SHUTDOWN_CAUSE_GUEST_RESET for any call to qemu_system_reset_requst() underneath the hw/ tree, because the hw/ tree is emulating guest behavior and therefore it is presumably a reset caused by a guest request.
Quoted 4 lines
So it's essentially a
firmware/hypervisortriggered reset, but one that should only ever be tripped during early guest boot. IsCAUSE_GUEST_RESETcorrect for that?
Of course, I'm not an export on SPAPR, so I'll happily change it to anything else if you think that is more appropriate. But the rule of thumb I went by is whether this is qemu emulating a bare-metal reset/shutdown, vs. qemu killing the guest without waiting for guest instructions to reach some magic memory/register/ACPI/who-knows-what-else request. While it may happen only early during guest boot, it is still the guest firmware that is requesting it, and not qemu causing a unilateral death.
Quoted 4 lines
Apart from this, ppc changes
Acked-by David Gibson <[email protected]>
Thanks.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [PATCH v6 3/5] shutdown: Add source information to SHUTDOWN and RESET
Quoted 42 lines · Eric Blake
Quoted 31 lines · David Gibson
Quoted 20 lines · Eric Blake
Time to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch.
It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers.
Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests.
Replay adds a FIXME to preserve the cause across the replay stream, that will be tackled in the next patch.
Signed-off-by Eric Blake <[email protected]>[snip]
Quoted 7 lines
hw/ppc/spapr_hcall.c +0
-0@@ -1166,7 +1166,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,spapr_ovec_cleanup (ov5_updates);Quoted 9 lines
hw/ppc/spapr_hcall.c static target_ulong h_client_architecture_support(PowerPCCPU *cpu, · line 1169
Quoted 3 lines
hw/ppc/spapr_hcall.c +1
-1if (spapr->cas_reboot) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );I'm not 100% sure about this one, since I'm not sure 100% of how the different enum values are defined. This one is tripped when feature negotiation between firmware and guest can't be satisfied without rebooting (next time round the firmware will use some different options).
Quoted 7 lines
Patch 2/5 introduced the enum. The biggest part of the patch (for now) is that anything
SHUTDOWN_CAUSE_HOST_will be exposed to the QMP client as host-triggered, anythingSHUTDOWN_CAUSE_GUEST_will be exposed as guest-triggered. I basically usedSHUTDOWN_CAUSE_GUEST_RESETfor any call toqemu_system_reset_requst()underneath the hw/ tree, because the hw/ tree is emulating guest behavior and therefore it is presumably a reset caused by a guest request.
Ok.
Quoted 4 lines
Quoted 3 lines
So it's essentially a
firmware/hypervisortriggered reset, but one that should only ever be tripped during early guest boot. IsCAUSE_GUEST_RESETcorrect for that?
Quoted 8 lines
Of course, I'm not an export on SPAPR, so I'll happily change it to anything else if you think that is more appropriate. But the rule of thumb I went by is whether this is qemu emulating a bare-metal reset/shutdown, vs. qemu killing the guest without waiting for guest instructions to reach some magic memory/register/ACPI/who-knows-what-else request. While it may happen only early during guest boot, it is still the guest firmware that is requesting it, and not qemu causing a unilateral death.
So, I think GUEST_RESET is the right choice here. The distinctions are blurry, because PAPR is built as a paravirtualized platform - there is no bare metal equivalent. For example, on PowerVM this really would be initiated by guest firmware, but it's working in communication with the hypervisor. But with qemu and KVM, we actually implement all this negotiation logic in qemu directly (this is easier than having complex communication channels between guest firware and qemu).
But I guess the point is that this is a "business as usual" reboot and the guest is expected to continue booting at some point after this, rather than being killed by qemu.
Things get more complicated still if we think about what happens if this feature negotiation fails - then we can't boot the guest OS. At the moment the few cases where this happens, I think we just exit qemu, but notifying this as a host caused shutdown might be appropriate.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [PATCH v6 3/5] shutdown: Add source information to SHUTDOWN and RESET
In reply to Eric BlakeQuoted 42 lines · Eric Blake
Quoted 31 lines · David Gibson
Quoted 20 lines · Eric Blake
Time to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch.
It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers.
Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests.
Replay adds a FIXME to preserve the cause across the replay stream, that will be tackled in the next patch.
Signed-off-by Eric Blake <[email protected]>[snip]
Quoted 7 lines
hw/ppc/spapr_hcall.c +0
-0@@ -1166,7 +1166,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,spapr_ovec_cleanup (ov5_updates);Quoted 9 lines
hw/ppc/spapr_hcall.c static target_ulong h_client_architecture_support(PowerPCCPU *cpu, · line 1169
Quoted 3 lines
hw/ppc/spapr_hcall.c +1
-1if (spapr->cas_reboot) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );I'm not 100% sure about this one, since I'm not sure 100% of how the different enum values are defined. This one is tripped when feature negotiation between firmware and guest can't be satisfied without rebooting (next time round the firmware will use some different options).
Quoted 7 lines
Patch 2/5 introduced the enum. The biggest part of the patch (for now) is that anything
SHUTDOWN_CAUSE_HOST_will be exposed to the QMP client as host-triggered, anythingSHUTDOWN_CAUSE_GUEST_will be exposed as guest-triggered. I basically usedSHUTDOWN_CAUSE_GUEST_RESETfor any call toqemu_system_reset_requst()underneath the hw/ tree, because the hw/ tree is emulating guest behavior and therefore it is presumably a reset caused by a guest request.
Ok.
Quoted 4 lines
Quoted 3 lines
So it's essentially a
firmware/hypervisortriggered reset, but one that should only ever be tripped during early guest boot. IsCAUSE_GUEST_RESETcorrect for that?
Quoted 8 lines
Of course, I'm not an export on SPAPR, so I'll happily change it to anything else if you think that is more appropriate. But the rule of thumb I went by is whether this is qemu emulating a bare-metal reset/shutdown, vs. qemu killing the guest without waiting for guest instructions to reach some magic memory/register/ACPI/who-knows-what-else request. While it may happen only early during guest boot, it is still the guest firmware that is requesting it, and not qemu causing a unilateral death.
So, I think GUEST_RESET is the right choice here. The distinctions are blurry, because PAPR is built as a paravirtualized platform - there is no bare metal equivalent. For example, on PowerVM this really would be initiated by guest firmware, but it's working in communication with the hypervisor. But with qemu and KVM, we actually implement all this negotiation logic in qemu directly (this is easier than having complex communication channels between guest firware and qemu).
But I guess the point is that this is a "business as usual" reboot and the guest is expected to continue booting at some point after this, rather than being killed by qemu.
Things get more complicated still if we think about what happens if this feature negotiation fails - then we can't boot the guest OS. At the moment the few cases where this happens, I think we just exit qemu, but notifying this as a host caused shutdown might be appropriate.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v6 3/5] shutdown: Add source information to SHUTDOWN and RESET
In reply to Eric BlakeQuoted 20 lines · Eric Blake
Time to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch.
It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers.
Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests.
Replay adds a FIXME to preserve the cause across the replay stream, that will be tackled in the next patch.
Signed-off-by Eric Blake <[email protected]>
[snip]
hw/ppc/spapr_hcall.c static target_ulong h_client_architecture_support(PowerPCCPU *cpu, · line 1169
Quoted 10 lines
hw/ppc/spapr_hcall.c +1
-1@@ -1166,7 +1166,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,spapr_ovec_cleanup (ov5_updates);if (spapr->cas_reboot) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );
I'm not 100% sure about this one, since I'm not sure 100% of how the different enum values are defined. This one is tripped when feature negotiation between firmware and guest can't be satisfied without rebooting (next time round the firmware will use some different options).
So it's essentially a firmware/hypervisor triggered reset, but one that should only ever be tripped during early guest boot. Is CAUSE_GUEST_RESET correct for that?
Apart from this, ppc changes
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v6 3/5 shutdown: Add source information to SHUTDOWN and RESET
In reply to Eric BlakeTime to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch.
It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers.
Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests.
Replay adds a FIXME to preserve the cause across the replay stream, that will be tackled in the next patch.
---
v6: defer event additions to later, add reviews of unchanged portions
v5: drop accidental addition of unrelated files
v4: s/ShutdownType/ShutdownCause/, no thanks to mingw header pollution
v3: retitle again, fix qemu-iotests, use enum rather than raw bool in all callers
v2: retitle (was "event: Add signal information to SHUTDOWN"), completely rework to post bool based on whether it is guest-initiated
v1: initial submission, exposing just Unix signals from host
--- include/sysemu/sysemu.h | 4 ++-- vl.c | 17 ++++++++--------- hw/acpi/core.c | 4 ++-- hw/arm/highbank.c | 4 ++-- hw/arm/integratorcp.c | 2 +- hw/arm/musicpal.c | 2 +- hw/arm/omap1.c | 10 ++++++---- hw/arm/omap2.c | 2 +- hw/arm/spitz.c | 2 +- hw/arm/stellaris.c | 2 +- hw/arm/tosa.c | 2 +- hw/i386/pc.c | 2 +- hw/i386/xen/xen-hvm.c | 2 +- hw/input/pckbd.c | 4 ++-- hw/ipmi/ipmi.c | 4 ++-- hw/isa/lpc_ich9.c | 2 +- hw/mips/boston.c | 2 +- hw/mips/mips_malta.c | 2 +- hw/mips/mips_r4k.c | 4 ++-- hw/misc/arm_sysctl.c | 8 ++++---- hw/misc/cbus.c | 2 +- hw/misc/macio/cuda.c | 4 ++-- hw/misc/slavio_misc.c | 4 ++-- hw/misc/zynq_slcr.c | 2 +- hw/pci-host/apb.c | 4 ++-- hw/pci-host/bonito.c | 2 +- hw/pci-host/piix.c | 2 +- hw/ppc/e500.c | 2 +- hw/ppc/mpc8544_guts.c | 2 +- hw/ppc/ppc.c | 2 +- hw/ppc/ppc405_uc.c | 2 +- hw/ppc/spapr_hcall.c | 2 +- hw/ppc/spapr_rtas.c | 4 ++-- hw/s390x/ipl.c | 2 +- hw/sh4/r2d.c | 2 +- hw/timer/etraxfs_timer.c | 2 +- hw/timer/m48t59.c | 4 ++-- hw/timer/milkymist-sysctl.c | 4 ++-- hw/timer/pxa2xx_timer.c | 2 +- hw/watchdog/watchdog.c | 2 +- hw/xenpv/xen_domainbuild.c | 2 +- hw/xtensa/xtfpga.c | 2 +- kvm-all.c | 6 +++--- os-win32.c | 2 +- qmp.c | 4 ++-- replay/replay.c | 3 ++- target/alpha/sys_helper.c | 4 ++-- target/arm/psci.c | 4 ++-- target/i386/excp_helper.c | 2 +- target/i386/hax-all.c | 6 +++--- target/i386/helper.c | 2 +- target/i386/kvm.c | 2 +- target/s390x/helper.c | 2 +- target/s390x/kvm.c | 4 ++-- target/s390x/misc_helper.c | 4 ++-- target/sparc/int32_helper.c | 2 +- ui/sdl.c | 2 +- ui/sdl2.c | 4 ++-- trace-events | 2 +- ui/cocoa.m | 2 +- 60 files changed, 98 insertions(+), 96 deletions(-)
include/sysemu/sysemu.h +2 -2
@@ -65,13 +65,13 @@ typedef enum WakeupReason {QEMU_WAKEUP_REASON_OTHER , } WakeupReason; -void qemu_system_reset_request (void ); +void qemu_system_reset_request (ShutdownCause reason);void qemu_system_suspend_request (void );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_system_shutdown_request (void ); +void qemu_system_shutdown_request (ShutdownCause reason);void qemu_system_powerdown_request (void );void qemu_register_powerdown_notifier (Notifier *notifier);void qemu_system_debug_request (void );
vl.c +8 -9
@@ -1725,7 +1725,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)if (!no_shutdown) {qapi_event_send_guest_panicked (GUEST_PANIC_ACTION_POWEROFF , !!info, info, &error_abort); -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_PANIC ); }if (info) {
@@ -1742,13 +1742,12 @@ void qemu_system_guest_panicked(GuestPanicInformation *info) } } -void qemu_system_reset_request (void ) +void qemu_system_reset_request (ShutdownCause reason) {if (no_reboot) { -/* FIXME - add a parameter to allow callers to specify reason */ - shutdown_requested =SHUTDOWN_CAUSE_HOST_ERROR ; + shutdown_requested = reason; }else { - reset_requested =SHUTDOWN_CAUSE_HOST_ERROR ; + reset_requested = reason; }cpu_stop_current ();qemu_notify_event ();
@@ -1819,12 +1818,12 @@ void qemu_system_killed(int signal, pid_t pid)qemu_notify_event (); } -void qemu_system_shutdown_request (void ) +void qemu_system_shutdown_request (ShutdownCause reason) { -trace_qemu_system_shutdown_request (); +trace_qemu_system_shutdown_request (reason); +/* FIXME - add a parameter to let replay preserve reason */ replay_shutdown_request (); -/* FIXME - add a parameter to allow callers to specify reason */ - shutdown_requested =SHUTDOWN_CAUSE_HOST_ERROR ; + shutdown_requested = reason;qemu_notify_event (); }
hw/acpi/core.c +2 -2
@@ -561,7 +561,7 @@ static void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)uint16_t sus_typ = (val >>10 ) &7 ;switch (sus_typ) {case 0 :/* soft power off */ -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );break ;case 1 :qemu_system_suspend_request ();
@@ -569,7 +569,7 @@ static void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)default :if (sus_typ == ar->pm1.cnt.s4_val) {/* S4 request */ qapi_event_send_suspend_disk (&error_abort); -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); }break ; }
hw/arm/highbank.c +2 -2
@@ -108,9 +108,9 @@ static void hb_regs_write(void *opaque, hwaddr offset,if (offset ==0xf00 ) {if (value ==1 || value ==2 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }else if (value ==3 ) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); } }
hw/arm/integratorcp.c +1 -1
@@ -158,7 +158,7 @@ static void integratorcm_do_remap(IntegratorCMState *s)static void integratorcm_set_ctrl (IntegratorCMState *s,uint32_t value) {if (value &8 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }if ((s->cm_ctrl ^ value) &1 ) {/* (value & 1) != 0 means the green "MISC LED" is lit.
hw/arm/musicpal.c +1 -1
@@ -898,7 +898,7 @@ static void mv88w8618_pit_write(void *opaque, hwaddr offset,case MP_BOARD_RESET :if (value ==MP_BOARD_RESET_MAGIC ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ; }
hw/arm/omap1.c +6 -4
@@ -355,7 +355,7 @@ static void omap_wd_timer_write(void *opaque, hwaddr addr,/* XXX: on T|E hardware somehow this has no effect, * on Zire 71 it works as specified. */ s->reset =1 ; -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } } s->last_wr = value &0xff ;
@@ -1545,8 +1545,10 @@ static inline void omap_clkm_idlect1_update(struct omap_mpu_state_s *s,if (value & (1 <<11 )) {/* SETARM_IDLE */ cpu_interrupt (CPU (s->cpu),CPU_INTERRUPT_HALT ); } -if (!(value & (1 <<10 )))/* WKUP_MODE */ -qemu_system_shutdown_request ();/* XXX: disable wakeup from IRQ */ +if (!(value & (1 <<10 ))) {/* WKUP_MODE */ +/* XXX: disable wakeup from IRQ */ +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); + }#define SET_CANIDLE (clock, bit) \ if (diff & (1 << bit)) { \
@@ -1693,7 +1695,7 @@ static void omap_clkm_write(void *opaque, hwaddr addr, diff = s->clkm.arm_rstct1 ^ value; s->clkm.arm_rstct1 = value &0x0007 ;if (value &9 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); s->clkm.cold_start =0xa ; }if (diff & ~value &4 ) {/* DSP_RST */
hw/arm/omap2.c +1 -1
@@ -1610,7 +1610,7 @@ static void omap_prcm_write(void *opaque, hwaddr addr,case 0x450 :/* RM_RSTCTRL_WKUP */ /* TODO: reset */ if (value &2 ) -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );break ;case 0x454 :/* RM_RSTTIME_WKUP */ s->rsttime_wkup = value &0x1fff ;
hw/arm/spitz.c +1 -1
@@ -848,7 +848,7 @@ static void spitz_lcd_hsync_handler(void *opaque, int line, int level)static void spitz_reset (void *opaque,int line,int level) {if (level) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }
hw/arm/stellaris.c +1 -1
@@ -1197,7 +1197,7 @@ staticvoid do_sys_reset (void *opaque,int n,int level) {if (level) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }
hw/arm/tosa.c +1 -1
@@ -90,7 +90,7 @@ static void tosa_out_switch(void *opaque, int line, int level)static void tosa_reset (void *opaque,int line,int level) {if (level) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }
hw/i386/pc.c +1 -1
@@ -519,7 +519,7 @@ static void port92_write(void *opaque, hwaddr addr, uint64_t val, s->outport = val;qemu_set_irq (s->a20_out, (val >>1 ) &1 );if ((val &1 ) && !(oldval &1 )) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }
hw/i386/xen/xen-hvm.c +1 -1
@@ -1398,7 +1398,7 @@ void xen_shutdown_fatal_error(const char *fmt, ...)va_end (ap);fprintf (stderr,"Will destroy the domain.\n" );/* destroy the domain */ -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_ERROR ); }void xen_hvm_modified_memory (ram_addr_t start,ram_addr_t length)
hw/input/pckbd.c +2 -2
@@ -226,7 +226,7 @@ static void outport_write(KBDState *s, uint32_t val) s->outport = val;qemu_set_irq (s->a20_out, (val >>1 ) &1 );if (!(val &1 )) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }
@@ -301,7 +301,7 @@ static void kbd_write_command(void *opaque, hwaddr addr, s->outport &= ~KBD_OUT_A20 ;break ;case KBD_CCMD_RESET : -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );break ;case KBD_CCMD_NO_OP :/* ignore that */
hw/ipmi/ipmi.c +2 -2
@@ -44,14 +44,14 @@ static int ipmi_do_hw_op(IPMIInterface *s, enum ipmi_op op, int checkonly)if (checkonly) {return 0 ; } -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );return 0 ;case IPMI_POWEROFF_CHASSIS :if (checkonly) {return 0 ; } -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );return 0 ;case IPMI_SEND_NMI :
hw/isa/lpc_ich9.c +1 -1
@@ -606,7 +606,7 @@ static void ich9_rst_cnt_write(void *opaque, hwaddr addr, uint64_t val,ICH9LPCState *lpc = opaque;if (val &4 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );return ; } lpc->rst_cnt = val &0xA ;/* keep FULL_RST (bit 3) and SYS_RST (bit 1) */
hw/mips/boston.c +1 -1
@@ -232,7 +232,7 @@ static void boston_platreg_write(void *opaque, hwaddr addr,break ;case PLAT_SOFTRST_CTL :if (val &PLAT_SOFTRST_CTL_SYSRESET ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ;default :
hw/mips/mips_malta.c +1 -1
@@ -470,7 +470,7 @@ static void malta_fpga_write(void *opaque, hwaddr addr,/* SOFTRES Register */ case 0x00500 :if (val ==0x42 ) -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );break ;/* BRKRES Register */
hw/mips/mips_r4k.c +2 -2
@@ -53,9 +53,9 @@ static void mips_qemu_write (void *opaque, hwaddr addr, uint64_t val, unsigned size) {if ((addr &0xffff ) ==0 && val ==42 ) -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );else if ((addr &0xffff ) ==4 && val ==42 ) -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); } static uint64_t mips_qemu_read (void *opaque, hwaddr addr,
hw/misc/arm_sysctl.c +4 -4
@@ -351,13 +351,13 @@ static bool vexpress_cfgctrl_write(arm_sysctl_state *s, unsigned int dcc,break ;case SYS_CFG_SHUTDOWN :if (site ==SYS_CFG_SITE_MB && device ==0 ) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );return true; }break ;case SYS_CFG_REBOOT :if (site ==SYS_CFG_SITE_MB && device ==0 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );return true; }break ;
@@ -429,7 +429,7 @@ static void arm_sysctl_write(void *opaque, hwaddr offset,if (s->lockval ==LOCK_VALUE ) { s->resetlevel = val;if (val &0x100 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }break ;
@@ -438,7 +438,7 @@ static void arm_sysctl_write(void *opaque, hwaddr offset,if (s->lockval ==LOCK_VALUE ) { s->resetlevel = val;if (val &0x04 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }break ;
hw/misc/cbus.c +1 -1
@@ -356,7 +356,7 @@ static inline void retu_write(CBusRetu *s, int reg, uint16_t val)case RETU_REG_WATCHDOG :if (val ==0 && (s->cc[0 ] &2 )) -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );break ;case RETU_REG_TXCR :
hw/misc/macio/cuda.c +2 -2
@@ -612,7 +612,7 @@ static bool cuda_cmd_powerdown(CUDAState *s,return false; } -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );return true; }
@@ -624,7 +624,7 @@ static bool cuda_cmd_reset_system(CUDAState *s,return false; } -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );return true; }
hw/misc/slavio_misc.c +2 -2
@@ -258,7 +258,7 @@ static void slavio_aux2_mem_writeb(void *opaque, hwaddr addr, val &=AUX2_PWROFF ; s->aux2 = val;if (val &AUX2_PWROFF ) -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );slavio_misc_update_irq (s); }
@@ -338,7 +338,7 @@ static void slavio_sysctrl_mem_writel(void *opaque, hwaddr addr,case 0 :if (val &SYS_RESET ) { s->sysctrl =SYS_RESETSTAT ; -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ;default :
hw/misc/zynq_slcr.c +1 -1
@@ -405,7 +405,7 @@ static void zynq_slcr_write(void *opaque, hwaddr offset,switch (offset) {case PSS_RST_CTRL :if (val &R_PSS_RST_CTRL_SOFT_RST ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ; }
hw/pci-host/apb.c +2 -2
@@ -482,9 +482,9 @@ static void apb_config_writel (void *opaque, hwaddr addr, s->reset_control |= val &RESET_WMASK ;if (val &SOFT_POR ) { s->nr_resets =0 ; -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }else if (val &SOFT_XIR ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }break ;
hw/pci-host/bonito.c +1 -1
@@ -269,7 +269,7 @@ static void bonito_writel(void *opaque, hwaddr addr, } s->regs[saddr] = val;if (reset) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ;case BONITO_INTENSET :
hw/pci-host/piix.c +1 -1
@@ -638,7 +638,7 @@ static void rcr_write(void *opaque, hwaddr addr, uint64_t val, unsigned len)PIIX3State *d = opaque;if (val &4 ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );return ; } d->rcr = val &2 ;/* keep System Reset type only */
hw/ppc/e500.c +1 -1
@@ -774,7 +774,7 @@ static qemu_irq *ppce500_init_mpic(MachineState *machine, PPCE500Params *params,static void ppce500_power_off (void *opaque,int line,int on) {if (on) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); } }
hw/ppc/mpc8544_guts.c +1 -1
@@ -98,7 +98,7 @@ static void mpc8544_guts_write(void *opaque, hwaddr addr,switch (addr) {case MPC8544_GUTS_ADDR_RSTCR :if (value &MPC8544_GUTS_RSTCR_RESET ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ;default :
hw/ppc/ppc.c +1 -1
@@ -412,7 +412,7 @@ static void ppce500_set_irq(void *opaque, int pin, int level)if (level) {LOG_IRQ ("%s: reset the PowerPC system\n" , __func__); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ;case PPCE500_INPUT_RESET_CORE :
hw/ppc/ppc405_uc.c +1 -1
@@ -1807,7 +1807,7 @@ void ppc40x_chip_reset(PowerPCCPU *cpu)void ppc40x_system_reset (PowerPCCPU *cpu) {printf ("Reset PowerPC system\n" ); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }void store_40x_dbcr0 (CPUPPCState *env,uint32_t val)
hw/ppc/spapr_hcall.c +1 -1
@@ -1166,7 +1166,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,spapr_ovec_cleanup (ov5_updates);if (spapr->cas_reboot) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }else {/* If ppc_spapr_reset() did not set up a HPT but one is necessary * (because the guest isn't going to use radix) then set it up here. */
hw/ppc/spapr_rtas.c +2 -2
@@ -110,7 +110,7 @@ static void rtas_power_off(PowerPCCPU *cpu, sPAPRMachineState *spapr,rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; } -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );cpu_stop_current ();rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); }
@@ -124,7 +124,7 @@ static void rtas_system_reboot(PowerPCCPU *cpu, sPAPRMachineState *spapr,rtas_st (rets,0 ,RTAS_OUT_PARAM_ERROR );return ; } -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );rtas_st (rets,0 ,RTAS_OUT_SUCCESS ); }
hw/s390x/ipl.c +1 -1
@@ -363,7 +363,7 @@ void s390_reipl_request(void)S390IPLState *ipl =get_ipl_device (); ipl->reipl_requested = true; -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }void s390_ipl_prepare_cpu (S390CPU *cpu)
hw/sh4/r2d.c +1 -1
@@ -164,7 +164,7 @@ r2d_fpga_write(void *opaque, hwaddr addr, uint64_t value, unsigned int size)break ;case PA_POWOFF :if (value &1 ) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); }break ;case PA_VERREG :
hw/timer/etraxfs_timer.c +1 -1
@@ -207,7 +207,7 @@ static void watchdog_hit(void *opaque)qemu_irq_raise (t->nmi); }else -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); t->wd_hits++; }
hw/timer/m48t59.c +2 -2
@@ -1,7 +1,7 @@/* * QEMU M48T59 and M48T08 NVRAM emulation for PPC PREP and Sparc platforms * -* Copyright (c) 2003-2005, 2007 Jocelyn Mayer +* Copyright (c) 2003-2005, 2007, 2017 Jocelyn Mayer * Copyright (c) 2013 Hervé Poussineau * * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -159,7 +159,7 @@ static void watchdog_cb (void *opaque)NVRAM ->buffer[0x1FF7 ] =0x00 ;NVRAM ->buffer[0x1FFC ] &= ~0x40 ;/* May it be a hw CPU Reset instead ? */ -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }else {qemu_set_irq (NVRAM ->IRQ,1 );qemu_set_irq (NVRAM ->IRQ,0 );
hw/timer/milkymist-sysctl.c +2 -2
@@ -90,7 +90,7 @@ static void sysctl_icap_write(MilkymistSysctlState *s, uint32_t value)trace_milkymist_sysctl_icap_write (value);switch (value &0xffff ) {case 0x000e : -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );break ; } }
@@ -195,7 +195,7 @@ static void sysctl_write(void *opaque, hwaddr addr, uint64_t value, s->regs[addr] =1 ;break ;case R_SYSTEM_ID : -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );break ;case R_GPIO_IN :
hw/timer/pxa2xx_timer.c +1 -1
@@ -401,7 +401,7 @@ static void pxa2xx_timer_tick(void *opaque)if (t->num ==3 )if (i->reset3 &1 ) { i->reset3 =0 ; -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); } }
hw/watchdog/watchdog.c +1 -1
@@ -110,7 +110,7 @@ void watchdog_perform_action(void)switch (watchdog_action) {case WDT_RESET :/* same as 'system_reset' in monitor */ qapi_event_send_watchdog (WATCHDOG_EXPIRATION_ACTION_RESET , &error_abort); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );break ;case WDT_SHUTDOWN :/* same as 'system_powerdown' in monitor */
hw/xenpv/xen_domainbuild.c +1 -1
@@ -148,7 +148,7 @@ static void xen_domain_poll(void *opaque)return ; quit: -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); }static int xen_domain_watcher (void )
hw/xtensa/xtfpga.c +1 -1
@@ -100,7 +100,7 @@ static void lx60_fpga_write(void *opaque, hwaddr addr,case 0x10 :/*board reset*/ if (val ==0xdead ) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }break ; }
kvm-all.c +3 -3
@@ -2052,7 +2052,7 @@ int kvm_cpu_exec(CPUState *cpu)break ;case KVM_EXIT_SHUTDOWN :DPRINTF ("shutdown\n" ); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); ret =EXCP_INTERRUPT ;break ;case KVM_EXIT_UNKNOWN :
@@ -2066,11 +2066,11 @@ int kvm_cpu_exec(CPUState *cpu)case KVM_EXIT_SYSTEM_EVENT :switch (run->system_event.type) {case KVM_SYSTEM_EVENT_SHUTDOWN : -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); ret =EXCP_INTERRUPT ;break ;case KVM_SYSTEM_EVENT_RESET : -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); ret =EXCP_INTERRUPT ;break ;case KVM_SYSTEM_EVENT_CRASH :
os-win32.c +1 -1
@@ -52,7 +52,7 @@ int setenv(const char *name, const char *value, int overwrite) static BOOL WINAPI qemu_ctrl_handler(DWORD type) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_SIGNAL );/* Windows 7 kills application when the function returns. Sleep here to give QEMU a try for closing. Sleep period is 10000ms because Windows kills the program
qmp.c +2 -2
@@ -84,7 +84,7 @@ UuidInfo *qmp_query_uuid(Error **errp)void qmp_quit (Error **errp) { no_shutdown =0 ; -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_QMP ); }void qmp_stop (Error **errp)
@@ -105,7 +105,7 @@ void qmp_stop(Error **errp)void qmp_system_reset (Error **errp) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_HOST_QMP ); }void qmp_system_powerdown (Error **erp)
replay/replay.c +2 -1
@@ -51,7 +51,8 @@ bool replay_next_event_is(int event)switch (replay_state.data_kind) {case EVENT_SHUTDOWN :replay_finish_event (); -qemu_system_shutdown_request (); +/* FIXME - store actual reason */ +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_ERROR );break ;default :/* clock, time_t, checkpoint and other events */
target/alpha/sys_helper.c +2 -2
@@ -60,9 +60,9 @@ void helper_tb_flush(CPUAlphaState *env)void helper_halt (uint64_t restart) {if (restart) { -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); }else { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); } }
target/arm/psci.c +2 -2
@@ -137,7 +137,7 @@ void arm_handle_psci_call(ARMCPU *cpu) }break ;case QEMU_PSCI_0_2_FN_SYSTEM_RESET : -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );/* QEMU reset and shutdown are async requests, but PSCI * mandates that we never return from the reset/shutdown * call, so power the CPU off now so it doesn't execute
@@ -145,7 +145,7 @@ void arm_handle_psci_call(ARMCPU *cpu)*/ goto cpu_off;case QEMU_PSCI_0_2_FN_SYSTEM_OFF : -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); goto cpu_off;case QEMU_PSCI_0_1_FN_CPU_ON :case QEMU_PSCI_0_2_FN_CPU_ON :
target/i386/excp_helper.c +1 -1
@@ -59,7 +59,7 @@ static int check_exception(CPUX86State *env, int intno, int *error_code,qemu_log_mask (CPU_LOG_RESET ,"Triple fault\n" ); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); return EXCP_HLT; }#endif
target/i386/hax-all.c +3 -3
@@ -540,14 +540,14 @@ static int hax_vcpu_hax_exec(CPUArchState *env)/* Guest state changed, currently only for shutdown */ case HAX_EXIT_STATECHANGE :fprintf (stdout,"VCPU shutdown request\n" ); -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );hax_vcpu_sync_state (env,0 ); ret =1 ;break ;case HAX_EXIT_UNKNOWN_VMEXIT :fprintf (stderr,"Unknown VMX exit %x from guest\n" , ht->_exit_reason); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );hax_vcpu_sync_state (env,0 );cpu_dump_state (cpu, stderr, fprintf,0 ); ret =-1 ;
@@ -578,7 +578,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env)break ;default :fprintf (stderr,"Unknown exit %x from HAX\n" , ht->_exit_status); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );hax_vcpu_sync_state (env,0 );cpu_dump_state (cpu, stderr, fprintf,0 ); ret =1 ;
target/i386/helper.c +1 -1
@@ -1212,7 +1212,7 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cpu_data data)" triple fault\n" , cs->cpu_index);qemu_log_mask (CPU_LOG_RESET ,"Triple fault\n" ); -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );return ; }if (banks[1 ] &MCI_STATUS_VAL ) {
target/i386/kvm.c +1 -1
@@ -2930,7 +2930,7 @@ int kvm_arch_process_async_events(CPUState *cs)if (env->exception_injected ==EXCP08_DBLE ) {/* this means triple fault */ -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET ); cs->exit_request =1 ;return 0 ; }
target/s390x/helper.c +1 -1
@@ -266,7 +266,7 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)S390CPU *cpu =s390_env_get_cpu (env);if (s390_cpu_halt (cpu) ==0 ) {#ifndef CONFIG_USER_ONLY -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );#endif } }
target/s390x/kvm.c +2 -2
@@ -1929,7 +1929,7 @@ static int handle_intercept(S390CPU *cpu)cpu_synchronize_state (cs);if (s390_cpu_halt (cpu) ==0 ) {if (is_special_wait_psw (cs)) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); }else {qemu_system_guest_panicked (NULL ); }
@@ -1938,7 +1938,7 @@ static int handle_intercept(S390CPU *cpu)break ;case ICPT_CPU_STOP :if (s390_cpu_set_state (CPU_STATE_STOPPED , cpu) ==0 ) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); }if (cpu->env.sigp_order ==SIGP_STOP_STORE_STATUS ) { kvm_s390_store_status(cpu, KVM_S390_STORE_STATUS_DEF_ADDR,
target/s390x/misc_helper.c +2 -2
@@ -533,11 +533,11 @@ uint32_t HELPER(sigp)(CPUS390XState *env, uint64_t order_code, uint32_t r1,break ;#if !defined(CONFIG_USER_ONLY )case SIGP_RESTART : -qemu_system_reset_request (); +qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );cpu_loop_exit (CPU (s390_env_get_cpu (env)));break ;case SIGP_STOP : -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN );cpu_loop_exit (CPU (s390_env_get_cpu (env)));break ;#endif
target/sparc/int32_helper.c +1 -1
@@ -109,7 +109,7 @@ void sparc_cpu_do_interrupt(CPUState *cs)if (env->psret ==0 ) {if (cs->exception_index ==0x80 && env->def->features &CPU_FEATURE_TA0_SHUTDOWN ) { -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); }else {cpu_abort (cs,"Trap 0x%02x while interrupts disabled, Error state" , cs->exception_index);
ui/sdl.c +1 -1
@@ -837,7 +837,7 @@ static void sdl_refresh(DisplayChangeListener *dcl)case SDL_QUIT :if (!no_quit) { no_shutdown =0 ; -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_UI ); }break ;case SDL_MOUSEMOTION :
ui/sdl2.c +2 -2
@@ -568,7 +568,7 @@ static void handle_windowevent(SDL_Event *ev)case SDL_WINDOWEVENT_CLOSE :if (!no_quit) { no_shutdown =0 ; -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_UI ); }break ;case SDL_WINDOWEVENT_SHOWN :
@@ -611,7 +611,7 @@ void sdl2_poll_events(struct sdl2_console *scon)case SDL_QUIT :if (!no_quit) { no_shutdown =0 ; -qemu_system_shutdown_request (); +qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_UI ); }break ;case SDL_MOUSEMOTION :
trace-events +1 -1
@@ -38,7 +38,7 @@ vm_state_notify(int running, int reason) "running %d reason %d" load_file(const char *name, const char *path) "name %s location %s" runstate_set(int new_state) "new state %d" system_wakeup_request(int reason) "reason=%d" -qemu_system_shutdown_request(void) "" +qemu_system_shutdown_request(int reason) "reason=%d" qemu_system_powerdown_request(void) "" # spice-qemu-char.c
ui/cocoa.m +1 -1
@@ -934,7 +934,7 @@ QemuCocoaView *cocoaView; { COCOA_DEBUG("QemuCocoaAppController: applicationWillTerminate\n"); - qemu_system_shutdown_request(); + qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI); exit(0); }
Signature · 7 lines
2.9.3 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v6 4/5 shutdown: Preserve shutdown cause through replay
In reply to Eric BlakeWith the recent addition of ShutdownCause, we want to be able to pass a cause through any shutdown request, and then faithfully replay that cause when later replaying the same sequence. The easiest way is to expand the reply event mechanism to track a series of values for EVENT_SHUTDOWN, one corresponding to each value of ShutdownCause.
We are free to change the replay stream as needed, since there are already no guarantees about being able to use a replay stream by any other version of qemu than the one that generated it.
---
v6: new patch
--- include/sysemu/replay.h | 3 ++- include/sysemu/sysemu.h | 1 + replay/replay-internal.h | 3 ++- vl.c | 3 +-- replay/replay.c | 10 +++++----- 5 files changed, 11 insertions(+), 9 deletions(-)
include/sysemu/replay.h +2 -1
@@ -13,6 +13,7 @@*/ #include "qapi-types.h" +#include "sysemu.h" /* replay clock kinds */ enum ReplayClockKind {
@@ -98,7 +99,7 @@ int64_t replay_read_clock(ReplayClockKind kind);/* Events */ /*! Called when qemu shutdown is requested. */ -void replay_shutdown_request (void ); +void replay_shutdown_request (ShutdownCause cause);/*! Should be called at check points in the execution. These check points are skipped, if they were not met. Saves checkpoint in the SAVE mode and validates in the PLAY mode.
include/sysemu/sysemu.h +1 -0
@@ -50,6 +50,7 @@ enum ShutdownCause {turns that into a shutdown */ SHUTDOWN_CAUSE_GUEST_PANIC ,/* Guest panicked, and command line turns that into a shutdown */ + SHUTDOWN_CAUSE__MAX, };void vm_start (void );
replay/replay-internal.h +2 -1
@@ -22,8 +22,9 @@ enum ReplayEvents {EVENT_EXCEPTION ,/* for async events */ EVENT_ASYNC , -/* for shutdown request */ +/* for shutdown requests, range allows recovery of ShutdownCause */ EVENT_SHUTDOWN , +EVENT_SHUTDOWN_LAST =EVENT_SHUTDOWN +SHUTDOWN_CAUSE__MAX ,/* for character device write event */ EVENT_CHAR_WRITE,/* for character device read all event */
vl.c +1 -2
@@ -1821,8 +1821,7 @@ void qemu_system_killed(int signal, pid_t pid)void qemu_system_shutdown_request (ShutdownCause reason) {trace_qemu_system_shutdown_request (reason); -/* FIXME - add a parameter to let replay preserve reason */ -replay_shutdown_request (); +replay_shutdown_request (reason); shutdown_requested = reason;qemu_notify_event (); }
replay/replay.c +5 -5
@@ -49,10 +49,10 @@ bool replay_next_event_is(int event) res = true; }switch (replay_state.data_kind) { -case EVENT_SHUTDOWN : + case EVENT_SHUTDOWN ... EVENT_SHUTDOWN_LAST:replay_finish_event (); -/* FIXME - store actual reason */ -qemu_system_shutdown_request (SHUTDOWN_CAUSE_HOST_ERROR ); +qemu_system_shutdown_request (replay_state.data_kind - +EVENT_SHUTDOWN );break ;default :/* clock, time_t, checkpoint and other events */
@@ -171,11 +171,11 @@ bool replay_has_interrupt(void)return res; } -void replay_shutdown_request (void ) +void replay_shutdown_request (ShutdownCause cause) {if (replay_mode ==REPLAY_MODE_RECORD ) {replay_mutex_lock (); -replay_put_event (EVENT_SHUTDOWN ); +replay_put_event (EVENT_SHUTDOWN + cause);replay_mutex_unlock (); } }
Signature · 1 line
2.9.3
PATCH v6 5/5 shutdown: Expose bool cause in SHUTDOWN and RESET events
In reply to Eric BlakeLibvirt would like to be able to distinguish between a SHUTDOWN event triggered solely by guest request and one triggered by a SIGTERM or other action on the host. While qemu_kill_report() was already able to give different output to stderr based on whether a shutdown was triggered by a host signal (but NOT by a host UI event, such as clicking the X on the window), that information was then lost to management. The previous patches improved things to use an enum throughout all callsites, so now we have something ready to expose through QMP.
Note that for now, the decision was to expose ONLY a boolean, rather than promoting ShutdownCause to a QAPI enum; this is because libvirt has not expressed an interest in anything finer-grained. We can still add additional details, in a backwards-compatible manner, if a need later arises (if the addition happens before 2.10, we can replace the bool with an enum; otherwise, the enum will have to be in addition to the bool).
Update expected iotest outputs to match the new data (complete coverage of the affected tests is obtained by -raw, -qcow2, and -nbd).
Here is output from 'virsh qemu-monitor-event --loop' with the patch installed:
event SHUTDOWN at 1492639680.731251 for domain fedora_13: {"guest":true} event STOP at 1492639680.732116 for domain fedora_13: <null> event SHUTDOWN at 1492639680.732830 for domain fedora_13: {"guest":false}
Note that libvirt runs qemu with -no-quit: the first SHUTDOWN event was triggered by an action I took directly in the guest (shutdown -h), at which point qemu stops the vcpus and waits for libvirt to do any final cleanups; the second SHUTDOWN event is the result of libvirt sending SIGTERM now that it has completed cleanup.
See also https://bugzilla.redhat.com/1384007
---
v6: split out from 'shutdown: Add source information to SHUTDOWN and RESET'
--- qapi/event.json | 17 +++++++++++++---- vl.c | 6 ++++-- tests/qemu-iotests/071.out | 4 ++-- tests/qemu-iotests/081.out | 2 +- tests/qemu-iotests/087.out | 12 ++++++------ tests/qemu-iotests/094.out | 2 +- tests/qemu-iotests/117.out | 2 +- tests/qemu-iotests/119.out | 2 +- tests/qemu-iotests/120.out | 2 +- tests/qemu-iotests/140.out | 2 +- tests/qemu-iotests/143.out | 2 +- tests/qemu-iotests/156.out | 2 +- 12 files changed, 33 insertions(+), 22 deletions(-)
qapi/event.json +13 -4
@@ -10,6 +10,10 @@ # Emitted when the virtual machine has shut down, indicating that qemu is # about to exit. # +# @guest: If true, the shutdown was triggered by a guest request (such as +# a guest-initiated ACPI shutdown request or other hardware-specific action) +# rather than a host request (such as sending qemu a SIGINT). (since 2.10) +# # Note: If the command-line option "-no-shutdown" has been specified, qemu will # not exit, and a STOP event will eventually follow the SHUTDOWN event #
@@ -17,11 +21,11 @@ # # Example: # -# <- { "event": "SHUTDOWN", +# <- { "event": "SHUTDOWN", "data": { "guest": true }, # "timestamp": { "seconds": 1267040730, "microseconds": 682951 } } # ## -{ 'event': 'SHUTDOWN' } +{ 'event': 'SHUTDOWN', 'data': { 'guest': 'bool' } } ## # @POWERDOWN:
@@ -44,15 +48,20 @@ # # Emitted when the virtual machine is reset # +# @guest: If true, the reset was triggered by a guest request (such as +# a guest-initiated ACPI reboot request or other hardware-specific action) +# rather than a host request (such as the QMP command system_reset). +# (since 2.10) +# # Since: 0.12.0 # # Example: # -# <- { "event": "RESET", +# <- { "event": "RESET", "data": { "guest": false }, # "timestamp": { "seconds": 1267041653, "microseconds": 9518 } } # ## -{ 'event': 'RESET' } +{ 'event': 'RESET', 'data': { 'guest': 'bool' } } ## # @STOP:
vl.c +4 -2
@@ -1707,7 +1707,8 @@ void qemu_system_reset(bool report, ShutdownCause reason) }if (report) {assert (reason); -qapi_event_send_reset (&error_abort); +qapi_event_send_reset (reason >=SHUTDOWN_CAUSE_GUEST_SHUTDOWN , + &error_abort); }cpu_synchronize_all_post_reset (); }
@@ -1864,7 +1865,8 @@ static bool main_loop_should_exit(void) request =qemu_shutdown_requested ();if (request) {qemu_kill_report (); -qapi_event_send_shutdown (&error_abort); +qapi_event_send_shutdown (request >=SHUTDOWN_CAUSE_GUEST_SHUTDOWN , + &error_abort);if (no_shutdown) {vm_stop (RUN_STATE_SHUTDOWN ); }else {
tests/qemu-iotests/071.out +2 -2
@@ -46,7 +46,7 @@ QMP_VERSION read failed: Input/output error {"return": ""} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} === Testing blkverify on existing block device ===
@@ -85,7 +85,7 @@ wrote 512/512 bytes at offset 0 read failed: Input/output error {"return": ""} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} QEMU_PROG: Failed to flush the L2 table cache: Input/output error QEMU_PROG: Failed to flush the refcount block cache: Input/output error
tests/qemu-iotests/081.out +1 -1
@@ -36,7 +36,7 @@ read 10485760/10485760 bytes at offset 0 10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} == using quorum rewrite corrupted mode ==
tests/qemu-iotests/087.out +6 -6
@@ -8,7 +8,7 @@ QMP_VERSION {"return": {}} {"error": {"class": "GenericError", "desc": "'node-name' must be specified for the root node"}} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} === Duplicate ID ===
@@ -19,7 +19,7 @@ QMP_VERSION {"error": {"class": "GenericError", "desc": "node-name=disk is conflicting with a device id"}} {"error": {"class": "GenericError", "desc": "Duplicate node name"}} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} === aio=native without O_DIRECT ===
@@ -29,7 +29,7 @@ QMP_VERSION {"return": {}} {"error": {"class": "GenericError", "desc": "aio=native was specified, but it requires cache.direct=on, which was not specified."}} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} === Encrypted image ===
@@ -40,14 +40,14 @@ QMP_VERSION {"return": {}} {"error": {"class": "GenericError", "desc": "Use of AES-CBC encrypted IMGFMT images is no longer supported in system emulators"}} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} Testing: QMP_VERSION {"return": {}} {"error": {"class": "GenericError", "desc": "Use of AES-CBC encrypted IMGFMT images is no longer supported in system emulators"}} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} === Missing driver ===
@@ -58,6 +58,6 @@ QMP_VERSION {"return": {}} {"error": {"class": "GenericError", "desc": "Parameter 'driver' is missing"}} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} *** done
tests/qemu-iotests/094.out +1 -1
@@ -7,5 +7,5 @@ Formatting 'TEST_DIR/source.IMGFMT', fmt=IMGFMT size=67108864 {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 67108864, "offset": 67108864, "speed": 0, "type": "mirror"}} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} *** done
tests/qemu-iotests/117.out +1 -1
@@ -7,7 +7,7 @@ wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} No errors were found on the image. read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
tests/qemu-iotests/119.out +1 -1
@@ -6,6 +6,6 @@ read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} *** done
tests/qemu-iotests/120.out +1 -1
@@ -6,7 +6,7 @@ wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 0
tests/qemu-iotests/140.out +1 -1
@@ -10,5 +10,5 @@ read 65536/65536 bytes at offset 0 {"return": {}} can't open device nbd+unix:///drv?socket=TEST_DIR/nbd: No export with name 'drv' available {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} *** done
tests/qemu-iotests/143.out +1 -1
@@ -3,5 +3,5 @@ QA output created by 143 {"return": {}} can't open device nbd+unix:///no_such_export?socket=TEST_DIR/nbd: No export with name 'no_such_export' available {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} *** done
tests/qemu-iotests/156.out +1 -1
@@ -34,7 +34,7 @@ read 65536/65536 bytes at offset 196608 {"return": ""} {"return": {}} -{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Signature · 1 line
2.9.3