From patchwork Fri Feb 4 18:21:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 532401 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 p14ILlAs011494 for ; Fri, 4 Feb 2011 18:21:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751202Ab1BDSVo (ORCPT ); Fri, 4 Feb 2011 13:21:44 -0500 Received: from goliath.siemens.de ([192.35.17.28]:24239 "EHLO goliath.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751167Ab1BDSVo (ORCPT ); Fri, 4 Feb 2011 13:21:44 -0500 Received: from mail1.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.13.6/8.13.6) with ESMTP id p14ILQhB006505; Fri, 4 Feb 2011 19:21:27 +0100 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p14ILPih009469; Fri, 4 Feb 2011 19:21:25 +0100 Message-ID: <4D4C43A5.2030207@siemens.com> Date: Fri, 04 Feb 2011 19:21:25 +0100 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Anthony Liguori CC: Marcelo Tosatti , "qemu-devel@nongnu.org" , "kvm@vger.kernel.org" Subject: [PATCH v3 02/23] Stop current VCPU on synchronous reset requests References: <4D4C389D.4060607@codemonkey.ws> <4D4C3CC8.9040202@siemens.com> In-Reply-To: <4D4C3CC8.9040202@siemens.com> 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]); Fri, 04 Feb 2011 18:21:48 +0000 (UTC) diff --git a/cpus.c b/cpus.c index ab6e40e..f8a88e3 100644 --- a/cpus.c +++ b/cpus.c @@ -312,6 +312,10 @@ void qemu_notify_event(void) void qemu_mutex_lock_iothread(void) {} void qemu_mutex_unlock_iothread(void) {} +void cpu_stop_current(void) +{ +} + void vm_stop(int reason) { do_vm_stop(reason); @@ -852,6 +856,14 @@ static void qemu_system_vmstop_request(int reason) qemu_notify_event(); } +void cpu_stop_current(void) +{ + if (cpu_single_env) { + cpu_single_env->stopped = 1; + cpu_exit(cpu_single_env); + } +} + void vm_stop(int reason) { QemuThread me; @@ -863,10 +875,7 @@ void vm_stop(int reason) * FIXME: should not return to device code in case * vm_stop() has been requested. */ - if (cpu_single_env) { - cpu_exit(cpu_single_env); - cpu_single_env->stop = 1; - } + cpu_stop_current(); return; } do_vm_stop(reason); diff --git a/cpus.h b/cpus.h index bf4d9bb..4cadb64 100644 --- a/cpus.h +++ b/cpus.h @@ -6,6 +6,7 @@ int qemu_init_main_loop(void); void qemu_main_loop_start(void); void resume_all_vcpus(void); void pause_all_vcpus(void); +void cpu_stop_current(void); /* vl.c */ extern int smp_cores; diff --git a/vl.c b/vl.c index 655617f..b1dc3ff 100644 --- a/vl.c +++ b/vl.c @@ -1296,6 +1296,7 @@ void qemu_system_reset_request(void) } else { reset_requested = 1; } + cpu_stop_current(); qemu_notify_event(); }