From patchwork Tue Dec 22 17:40:07 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5q2m55SwID0/SVNPLTIwMjItSlA/Qj9JQnNrUWoxVFRHa2JLRUk9Pz0=?= X-Patchwork-Id: 41619 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3B127B6F0C for ; Wed, 23 Dec 2009 04:46:22 +1100 (EST) Received: from localhost ([127.0.0.1]:58293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NN8oN-0000N7-8G for incoming@patchwork.ozlabs.org; Tue, 22 Dec 2009 12:46:19 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NN8kq-0007l6-T3 for qemu-devel@nongnu.org; Tue, 22 Dec 2009 12:42:40 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NN8kl-0007ia-0X for qemu-devel@nongnu.org; Tue, 22 Dec 2009 12:42:39 -0500 Received: from [199.232.76.173] (port=56244 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NN8kk-0007iJ-L8 for qemu-devel@nongnu.org; Tue, 22 Dec 2009 12:42:34 -0500 Received: from smtp-vip.mem.interq.net ([210.157.1.50]:22942 helo=smtp01.mem.internal-gmo) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NN8kj-0001zW-RY for qemu-devel@nongnu.org; Tue, 22 Dec 2009 12:42:34 -0500 Received: (from root@localhost) by smtp01.mem.internal-gmo (8.13.8/8.12.6) id nBMHgHdA021758 for qemu-devel@nongnu.org; Wed, 23 Dec 2009 02:42:17 +0900 (JST) Received: from YOUR-BD18D6DD63.m1.interq.or.jp (ntymns039132.ymns.nt.ftth.ppp.infoweb.ne.jp [121.92.167.132]) by smtp01.mem.internal-gmo with ESMTP id nBMHgGgC021741 for ; (me101664 for with PLAIN) Wed, 23 Dec 2009 02:42:16 +0900 (JST) Message-Id: <200912221740.AA00205@YOUR-BD18D6DD63.m1.interq.or.jp> From: "TAKEDA, toshiya" Date: Wed, 23 Dec 2009 02:40:07 +0900 To: qemu-devel MIME-Version: 1.0 X-Mailer: AL-Mail32 Version 1.13 X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) Subject: [Qemu-devel] [PATCH V4 02/18] sysemu: support qemu_cpu_reset() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: TAKEDA, toshiya --- sysemu.h | 3 +++ vl.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 0 deletions(-) diff --git a/sysemu.h b/sysemu.h index 9d80bb2..51c7ac8 100644 --- a/sysemu.h +++ b/sysemu.h @@ -45,13 +45,16 @@ void cpu_enable_ticks(void); void cpu_disable_ticks(void); void qemu_system_reset_request(void); +void qemu_cpu_reset_request(void); void qemu_system_shutdown_request(void); void qemu_system_powerdown_request(void); int qemu_shutdown_requested(void); int qemu_reset_requested(void); +int qemu_cpu_reset_requested(void); int qemu_powerdown_requested(void); extern qemu_irq qemu_system_powerdown; void qemu_system_reset(void); +void qemu_cpu_reset(void); void do_savevm(Monitor *mon, const QDict *qdict); int load_vmstate(Monitor *mon, const char *name); diff --git a/vl.c b/vl.c index e606903..565dae4 100644 --- a/vl.c +++ b/vl.c @@ -3261,6 +3261,7 @@ typedef struct QEMUResetEntry { static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers = QTAILQ_HEAD_INITIALIZER(reset_handlers); static int reset_requested; +static int cpu_reset_requested; static int shutdown_requested; static int powerdown_requested; static int debug_requested; @@ -3280,6 +3281,13 @@ int qemu_reset_requested(void) return r; } +int qemu_cpu_reset_requested(void) +{ + int r = cpu_reset_requested; + cpu_reset_requested = 0; + return r; +} + int qemu_powerdown_requested(void) { int r = powerdown_requested; @@ -3343,6 +3351,16 @@ void qemu_system_reset(void) } } +void qemu_cpu_reset(void) +{ + CPUState *env; + + /* reset all cpus */ + for(env = first_cpu; env != NULL; env = env->next_cpu) { + cpu_reset(env); + } +} + void qemu_system_reset_request(void) { if (no_reboot) { @@ -3353,6 +3371,12 @@ void qemu_system_reset_request(void) qemu_notify_event(); } +void qemu_cpu_reset_request(void) +{ + cpu_reset_requested = 1; + qemu_notify_event(); +} + void qemu_system_shutdown_request(void) { shutdown_requested = 1; @@ -4129,6 +4153,8 @@ static int vm_can_run(void) return 0; if (reset_requested) return 0; + if (cpu_reset_requested) + return 0; if (shutdown_requested) return 0; if (debug_requested) @@ -4182,6 +4208,12 @@ static void main_loop(void) qemu_system_reset(); resume_all_vcpus(); } + if (qemu_cpu_reset_requested()) { + monitor_protocol_event(QEVENT_RESET, NULL); + pause_all_vcpus(); + qemu_cpu_reset(); + resume_all_vcpus(); + } if (qemu_powerdown_requested()) { monitor_protocol_event(QEVENT_POWERDOWN, NULL); qemu_irq_raise(qemu_system_powerdown);