From cecafe4209b4cebbc858e662709998952fb455aa Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <23a13cde0d81a8776ab4defcd30f9edef53b045f.1346843178.git.minovotn@redhat.com> References: <23a13cde0d81a8776ab4defcd30f9edef53b045f.1346843178.git.minovotn@redhat.com> From: Luiz Capitulino Date: Wed, 22 Aug 2012 19:05:41 +0200 Subject: [PATCH 2/5] Allow silent system resets RH-Author: Luiz Capitulino Message-id: <1345662343-11200-2-git-send-email-lcapitulino@redhat.com> Patchwork-id: 41143 O-Subject: [RHEL6.4 qemu-kvm PATCH 1/3] Allow silent system resets Bugzilla: 850927 RH-Acked-by: Gerd Hoffmann RH-Acked-by: Paolo Bonzini RH-Acked-by: Kevin Wolf From: Luiz Capitulino NOTE: This is a manual backport of upstream commit e063eb1f4a6d42371e7d288dfdb690d5821190ed. Manually backporting this was easier than resolving conflicts, besides this requires RHEL6-only changes. 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: Luiz Capitulino --- qemu-kvm.c | 6 +++--- sysemu.h | 5 ++++- vl.c | 10 ++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) Signed-off-by: Michal Novotny --- qemu-kvm.c | 6 +++--- sysemu.h | 5 ++++- vl.c | 10 ++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index bd3b4a5..3aef23a 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1969,13 +1969,13 @@ static void setup_kernel_sigmask(CPUState *env) kvm_set_signal_mask(env, &set); } -static void qemu_kvm_system_reset(void) +static void qemu_kvm_system_reset(bool report) { CPUState *penv = first_cpu; kvm_pause_all_threads(); - qemu_system_reset(); + qemu_system_reset(report); while (penv) { kvm_arch_cpu_reset(penv); @@ -2255,7 +2255,7 @@ int kvm_main_loop(void) monitor_protocol_event(QEVENT_POWERDOWN, NULL); qemu_irq_raise(qemu_system_powerdown); } else if (qemu_reset_requested()) { - qemu_kvm_system_reset(); + qemu_kvm_system_reset(VMRESET_REPORT); if (runstate_check(RUN_STATE_INTERNAL_ERROR) || runstate_check(RUN_STATE_SHUTDOWN)) { runstate_set(RUN_STATE_PAUSED); diff --git a/sysemu.h b/sysemu.h index 1efac0d..adc3184 100644 --- a/sysemu.h +++ b/sysemu.h @@ -60,6 +60,9 @@ VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, void *opaque); void qemu_del_vm_change_state_handler(VMChangeStateEntry *e); +#define VMRESET_SILENT false +#define VMRESET_REPORT true + void vm_start(void); void vm_stop(RunState state); void vm_stop_force_state(RunState state); @@ -95,7 +98,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_system_suspend(void); void qemu_add_machine_init_done_notifier(Notifier *notify); diff --git a/vl.c b/vl.c index 0526a06..6a9c534 100644 --- a/vl.c +++ b/vl.c @@ -3334,7 +3334,7 @@ void qemu_unregister_reset(QEMUResetHandler *func, void *opaque) } } -void qemu_system_reset(void) +void qemu_system_reset(bool report) { QEMUResetEntry *re, *nre; @@ -3342,7 +3342,9 @@ void qemu_system_reset(void) 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); + } } void qemu_system_reset_request(void) @@ -4241,7 +4243,7 @@ static void main_loop(void) } if (qemu_reset_requested()) { pause_all_vcpus(); - qemu_system_reset(); + qemu_system_reset(VMRESET_REPORT); resume_all_vcpus(); if (runstate_check(RUN_STATE_INTERNAL_ERROR) || runstate_check(RUN_STATE_SHUTDOWN)) { @@ -6336,7 +6338,7 @@ int main(int argc, char **argv, char **envp) qemu_run_machine_init_done_notifiers(); - qemu_system_reset(); + qemu_system_reset(VMRESET_SILENT); if (loadvm) { if (load_vmstate(loadvm) < 0) { autostart = 0; -- 1.7.11.4