@@ -904,7 +904,7 @@ static void tpm_emulator_vm_state_change(void *opaque, bool running,
trace_tpm_emulator_vm_state_change(running, state);
- if (!running || state != RUN_STATE_RUNNING || !tpm_emu->relock_storage) {
+ if (!running || !tpm_emu->relock_storage) {
return;
}
@@ -570,7 +570,7 @@ int gdb_continue_partial(char *newstates)
}
}
- if (vm_prepare_start(step_requested)) {
+ if (vm_prepare_start(step_requested, RUN_STATE_RUNNING)) {
return 0;
}
@@ -2451,7 +2451,7 @@ static void usb_ehci_vm_state_change(void *opaque, bool running, RunState state)
* USB-devices which have async handled packages have a packet in the
* ep queue to match the completion with.
*/
- if (state == RUN_STATE_RUNNING) {
+ if (running) {
ehci_advance_async_state(ehci);
}
@@ -1403,7 +1403,7 @@ static void usbredir_vm_state_change(void *priv, bool running, RunState state)
{
USBRedirDevice *dev = priv;
- if (state == RUN_STATE_RUNNING && dev->parser != NULL) {
+ if (running && dev->parser != NULL) {
usbredirparser_do_write(dev->parser); /* Flush any pending writes */
}
}
@@ -623,7 +623,7 @@ void xen_hvm_change_state_handler(void *opaque, bool running,
xen_set_ioreq_server_state(xen_domid,
state->ioservid,
- (rstate == RUN_STATE_RUNNING));
+ running);
}
void xen_exit_notifier(Notifier *n, void *data)
@@ -46,8 +46,10 @@ void vm_start(void);
* vm_prepare_start: Prepare for starting/resuming the VM
*
* @step_pending: whether any of the CPUs is about to be single-stepped by gdb
+ * @state: the vm state to setup
*/
-int vm_prepare_start(bool step_pending);
+int vm_prepare_start(bool step_pending, RunState state);
+
int vm_stop(RunState state);
int vm_stop_force_state(RunState state);
int vm_shutdown(void);
@@ -681,7 +681,7 @@ int vm_stop(RunState state)
* Returns -1 if the vCPUs are not to be restarted (e.g. if they are already
* running or in case of an error condition), 0 otherwise.
*/
-int vm_prepare_start(bool step_pending)
+int vm_prepare_start(bool step_pending, RunState state)
{
RunState requested;
@@ -713,14 +713,14 @@ int vm_prepare_start(bool step_pending)
qapi_event_send_resume();
cpu_enable_ticks();
- runstate_set(RUN_STATE_RUNNING);
- vm_state_notify(1, RUN_STATE_RUNNING);
+ runstate_set(state);
+ vm_state_notify(1, state);
return 0;
}
void vm_start(void)
{
- if (!vm_prepare_start(false)) {
+ if (!vm_prepare_start(false, RUN_STATE_RUNNING)) {
resume_all_vcpus();
}
}