From patchwork Tue Jun 21 17:57:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 101349 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 793F5B7027 for ; Wed, 22 Jun 2011 04:46:41 +1000 (EST) Received: from localhost ([::1]:60481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ5yA-0000et-Bm for incoming@patchwork.ozlabs.org; Tue, 21 Jun 2011 14:46:38 -0400 Received: from eggs.gnu.org ([140.186.70.92]:41203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ5Cq-0004LL-Tv for qemu-devel@nongnu.org; Tue, 21 Jun 2011 13:57:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QZ5Cj-0000rL-Qs for qemu-devel@nongnu.org; Tue, 21 Jun 2011 13:57:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ5Cj-0000r4-A9 for qemu-devel@nongnu.org; Tue, 21 Jun 2011 13:57:37 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5LHvat1013443 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 21 Jun 2011 13:57:36 -0400 Received: from localhost (ovpn-113-137.phx2.redhat.com [10.3.113.137]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p5LHvZaK029161; Tue, 21 Jun 2011 13:57:36 -0400 From: Luiz Capitulino To: aliguori@us.ibm.com Date: Tue, 21 Jun 2011 14:57:27 -0300 Message-Id: <1308679048-4441-3-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1308679048-4441-1-git-send-email-lcapitulino@redhat.com> References: <1308679048-4441-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Jan Kiszka , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/3] Allow silent system resets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Kiszka 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 Signed-off-by: Luiz Capitulino --- sysemu.h | 5 ++++- vl.c | 10 ++++++---- xen-all.c | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/sysemu.h b/sysemu.h index 7e70daa..d3013f5 100644 --- a/sysemu.h +++ b/sysemu.h @@ -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); @@ -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); diff --git a/vl.c b/vl.c index dbdec71..52402a2 100644 --- a/vl.c +++ b/vl.c @@ -1253,7 +1253,7 @@ void qemu_unregister_reset(QEMUResetHandler *func, void *opaque) } } -void qemu_system_reset(void) +void qemu_system_reset(bool report) { QEMUResetEntry *re, *nre; @@ -1261,7 +1261,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); + } cpu_synchronize_all_post_reset(); } @@ -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()) { @@ -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; diff --git a/xen-all.c b/xen-all.c index 0eac202..41fd98a 100644 --- a/xen-all.c +++ b/xen-all.c @@ -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); } }