Skip to content

Commit

Permalink
Allow silent system resets
Browse files Browse the repository at this point in the history
This allows qemu_system_reset to be issued silently for internal
purposes, ie. without sending out a monitor event. Convert the system
reset after startup to the silent mode.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
  • Loading branch information
jan-kiszka authored and Luiz Capitulino committed Jun 16, 2011
1 parent e4ea5e2 commit e063eb1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 4 additions & 1 deletion sysemu.h
Expand Up @@ -34,6 +34,9 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
#define VMSTOP_LOADVM 7
#define VMSTOP_MIGRATE 8

#define VMRESET_SILENT false
#define VMRESET_REPORT true

void vm_start(void);
void vm_stop(int reason);

Expand All @@ -50,7 +53,7 @@ int qemu_powerdown_requested(void);
void qemu_system_killed(int signal, pid_t pid);
void qemu_kill_report(void);
extern qemu_irq qemu_system_powerdown;
void qemu_system_reset(void);
void qemu_system_reset(bool report);

void qemu_add_exit_notifier(Notifier *notify);
void qemu_remove_exit_notifier(Notifier *notify);
Expand Down
10 changes: 6 additions & 4 deletions vl.c
Expand Up @@ -1253,15 +1253,17 @@ void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
}
}

void qemu_system_reset(void)
void qemu_system_reset(bool report)
{
QEMUResetEntry *re, *nre;

/* reset all devices */
QTAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) {
re->func(re->opaque);
}
monitor_protocol_event(QEVENT_RESET, NULL);
if (report) {
monitor_protocol_event(QEVENT_RESET, NULL);
}
cpu_synchronize_all_post_reset();
}

Expand Down Expand Up @@ -1403,7 +1405,7 @@ static void main_loop(void)
if (qemu_reset_requested()) {
pause_all_vcpus();
cpu_synchronize_all_states();
qemu_system_reset();
qemu_system_reset(VMRESET_REPORT);
resume_all_vcpus();
}
if (qemu_powerdown_requested()) {
Expand Down Expand Up @@ -3293,7 +3295,7 @@ int main(int argc, char **argv, char **envp)
qemu_register_reset(qbus_reset_all_fn, sysbus_get_default());
qemu_run_machine_init_done_notifiers();

qemu_system_reset();
qemu_system_reset(VMRESET_SILENT);
if (loadvm) {
if (load_vmstate(loadvm) < 0) {
autostart = 0;
Expand Down
2 changes: 1 addition & 1 deletion xen-all.c
Expand Up @@ -452,7 +452,7 @@ static void cpu_handle_ioreq(void *opaque)
destroy_hvm_domain();
}
if (qemu_reset_requested_get()) {
qemu_system_reset();
qemu_system_reset(VMRESET_REPORT);
}
}

Expand Down

0 comments on commit e063eb1

Please sign in to comment.