From patchwork Mon Feb 7 11:19:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 537651 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p17BJkRu023398 for ; Mon, 7 Feb 2011 11:19:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753761Ab1BGLTm (ORCPT ); Mon, 7 Feb 2011 06:19:42 -0500 Received: from david.siemens.de ([192.35.17.14]:27872 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753392Ab1BGLTl (ORCPT ); Mon, 7 Feb 2011 06:19:41 -0500 Received: from mail1.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.13.6/8.13.6) with ESMTP id p17BJRtT010032; Mon, 7 Feb 2011 12:19:28 +0100 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p17BJQKM027537; Mon, 7 Feb 2011 12:19:27 +0100 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org Subject: [PATCH 05/15] Refactor debug and vmstop request interface Date: Mon, 7 Feb 2011 12:19:16 +0100 Message-Id: <880e5761b87cf2fbcf55e52e137d4e662aaea699.1297077507.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: In-Reply-To: References: Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 07 Feb 2011 11:19:47 +0000 (UTC) diff --git a/cpus.c b/cpus.c index e08ec03..85c680e 100644 --- a/cpus.c +++ b/cpus.c @@ -168,8 +168,7 @@ static bool all_cpus_idle(void) static void cpu_debug_handler(CPUState *env) { gdb_set_stop_cpu(env); - debug_requested = VMSTOP_DEBUG; - vm_stop(VMSTOP_DEBUG); + qemu_system_debug_request(); } #ifdef CONFIG_LINUX @@ -990,12 +989,6 @@ void qemu_notify_event(void) qemu_event_increment(); } -static void qemu_system_vmstop_request(int reason) -{ - vmstop_requested = reason; - qemu_notify_event(); -} - void cpu_stop_current(void) { if (cpu_single_env) { diff --git a/cpus.h b/cpus.h index 4cadb64..e021126 100644 --- a/cpus.h +++ b/cpus.h @@ -11,8 +11,6 @@ void cpu_stop_current(void); /* vl.c */ extern int smp_cores; extern int smp_threads; -extern int debug_requested; -extern int vmstop_requested; void vm_state_notify(int running, int reason); bool cpu_exec_all(void); void set_numa_modes(void); diff --git a/sysemu.h b/sysemu.h index b23e722..b496bde 100644 --- a/sysemu.h +++ b/sysemu.h @@ -59,6 +59,8 @@ void cpu_disable_ticks(void); void qemu_system_reset_request(void); void qemu_system_shutdown_request(void); void qemu_system_powerdown_request(void); +void qemu_system_debug_request(void); +void qemu_system_vmstop_request(int reason); int qemu_shutdown_requested(void); int qemu_reset_requested(void); int qemu_powerdown_requested(void); diff --git a/vl.c b/vl.c index 9440f98..afc0144 100644 --- a/vl.c +++ b/vl.c @@ -1217,8 +1217,8 @@ static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers = static int reset_requested; static int shutdown_requested; static int powerdown_requested; -int debug_requested; -int vmstop_requested; +static int debug_requested; +static int vmstop_requested; int qemu_shutdown_requested(void) { @@ -1312,6 +1312,18 @@ void qemu_system_powerdown_request(void) qemu_notify_event(); } +void qemu_system_debug_request(void) +{ + debug_requested = 1; + vm_stop(VMSTOP_DEBUG); +} + +void qemu_system_vmstop_request(int reason) +{ + vmstop_requested = reason; + qemu_notify_event(); +} + void main_loop_wait(int nonblocking) { IOHandlerRecord *ioh; @@ -1427,8 +1439,8 @@ static void main_loop(void) dev_time += profile_getclock() - ti; #endif - if ((r = qemu_debug_requested())) { - vm_stop(r); + if (qemu_debug_requested()) { + vm_stop(VMSTOP_DEBUG); } if (qemu_shutdown_requested()) { monitor_protocol_event(QEVENT_SHUTDOWN, NULL);