From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 2/3] Don't return to guest after CPU issued S3 command. Date: Tue, 30 Dec 2008 14:32:56 +0200 Message-ID: <20081230123256.GB3326@redhat.com> References: <20081230103712.5604.20753.stgit@dhcp-1-237.tlv.redhat.com> <20081230103723.5604.46564.stgit@dhcp-1-237.tlv.redhat.com> <495A03BA.5060701@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:33166 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751929AbYL3Mbx (ORCPT ); Tue, 30 Dec 2008 07:31:53 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id mBUCVrmM010272 for ; Tue, 30 Dec 2008 07:31:53 -0500 Content-Disposition: inline In-Reply-To: <495A03BA.5060701@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Dec 30, 2008 at 01:19:22PM +0200, Avi Kivity wrote: >> +int kvm_shutdown(void *opaque, void *data); > > That's a bad API. What's the opaque? what's the data? > How about this one: Don't return to guest CPU after qemu_system_reset_request(). Signed-off-by: Gleb Natapov diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c index 01c265b..8ec8f7f 100644 --- a/qemu/qemu-kvm.c +++ b/qemu/qemu-kvm.c @@ -1357,3 +1357,9 @@ int qemu_kvm_has_sync_mmu(void) { return kvm_has_sync_mmu(kvm_context); } + +void qemu_kvm_cpu_stop(CPUState *env) +{ + if (kvm_enabled()) + env->kvm_cpu_state.stopped = 1; +} diff --git a/qemu/qemu-kvm.h b/qemu/qemu-kvm.h index ec27d06..f8d724b 100644 --- a/qemu/qemu-kvm.h +++ b/qemu/qemu-kvm.h @@ -153,6 +153,7 @@ struct ioperm_data { }; int qemu_kvm_has_sync_mmu(void); +void qemu_kvm_cpu_stop(CPUState *env); #define kvm_enabled() (kvm_allowed) #define qemu_kvm_irqchip_in_kernel() kvm_irqchip_in_kernel(kvm_context) @@ -168,6 +169,7 @@ void kvm_load_tsc(CPUState *env); #define kvm_has_sync_mmu() (0) #define kvm_load_registers(env) do {} while(0) #define kvm_save_registers(env) do {} while(0) +#define qemu_kvm_cpu_stop(env) do {} while(0) static inline void kvm_init_vcpu(CPUState *env) { } static inline void void kvm_load_tsc(CPUState *env) {} diff --git a/qemu/vl.c b/qemu/vl.c index 0d1d236..a0c5472 100644 --- a/qemu/vl.c +++ b/qemu/vl.c @@ -3585,8 +3585,11 @@ void qemu_system_reset_request(void) } else { reset_requested = 1; } - if (cpu_single_env) + + if (cpu_single_env) { + qemu_kvm_cpu_stop(cpu_single_env); cpu_interrupt(cpu_single_env, CPU_INTERRUPT_EXIT); + } main_loop_break(); } -- Gleb.