Received: from eggs.gnu.org ([140.186.70.92]:45385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVJ30-0006L2-Fu for qemu-devel@nongnu.org; Tue, 29 Nov 2011 03:28:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RVJ2z-0001W3-8R for qemu-devel@nongnu.org; Tue, 29 Nov 2011 03:28:14 -0500 Received: from va3ehsobe003.messaging.microsoft.com ([216.32.180.13]:59020 helo=VA3EHSOBE003.bigfish.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVJ2z-0001Vm-5x for qemu-devel@nongnu.org; Tue, 29 Nov 2011 03:28:13 -0500 From: Liu Yu Date: Tue, 29 Nov 2011 14:41:18 +0800 Message-ID: <1322548878-14000-1-git-send-email-yu.liu@freescale.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH] kvm-ppc: halt secondary cpus when guest reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: agraf@suse.de Cc: Liu Yu , qemu-devel@nongnu.org When guest reset, we need to halt secondary cpus until guest kick them. This already works for tcg. The patch add the support for kvm. For kvm, if use in-kernel mpic, it should not be halted. In this case, we pause the sencondaries instead. This has impact to handling of halt exit, but fortunately, kvmppc doesn't use halt exit. Signed-off-by: Liu Yu --- hw/ppce500_spin.c | 1 + target-ppc/kvm.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/hw/ppce500_spin.c b/hw/ppce500_spin.c index cccd940..2b52728 100644 --- a/hw/ppce500_spin.c +++ b/hw/ppce500_spin.c @@ -112,6 +112,7 @@ static void spin_kick(void *data) env->halted = 0; env->exception_index = -1; + env->stopped = 0; qemu_cpu_kick(env); } diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 429349f..ff4cfdb 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -504,7 +504,16 @@ void kvm_arch_post_run(CPUState *env, struct kvm_run *run) int kvm_arch_process_async_events(CPUState *env) { - return 0; + if (kvm_irqchip_in_kernel()) { + if (env->halted == 1 && env->exception_index == EXCP_HLT) { + env->stopped = 1; + return 1; + } else { + return 0; + } + } + + return env->halted; } static int kvmppc_handle_halt(CPUState *env) -- 1.6.4