From patchwork Tue Sep 22 14:51:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 49324 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8MEq1kX031878 for ; Tue, 22 Sep 2009 14:52:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756755AbZIVOvw (ORCPT ); Tue, 22 Sep 2009 10:51:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756734AbZIVOvw (ORCPT ); Tue, 22 Sep 2009 10:51:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3827 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756597AbZIVOvu (ORCPT ); Tue, 22 Sep 2009 10:51:50 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8MEpsUZ009524 for ; Tue, 22 Sep 2009 10:51:54 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8MEprp0030820; Tue, 22 Sep 2009 10:51:54 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 4C33418D472; Tue, 22 Sep 2009 17:51:52 +0300 (IDT) From: Gleb Natapov To: avi@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH] Update halted state from mpstate only in case of inkernel irq chip Date: Tue, 22 Sep 2009 17:51:50 +0300 Message-Id: <1253631112-26124-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Otherwise cpu is always unhalted by call to kvm_arch_get_registers() Signed-off-by: Gleb Natapov --- qemu-kvm.c | 10 ++++++++++ qemu-kvm.h | 9 +-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index 6511cb6..2a7fe3d 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1605,6 +1605,16 @@ static void on_vcpu(CPUState *env, void (*func)(void *data), void *data) qemu_cond_wait(&qemu_work_cond); } +void kvm_arch_get_registers(CPUState *env) +{ + kvm_arch_save_regs(env); + kvm_arch_save_mpstate(env); +#ifdef KVM_CAP_MP_STATE + if (kvm_irqchip_in_kernel(kvm_context)) + env->halted = (env->mp_state == KVM_MP_STATE_HALTED); +#endif +} + static void do_kvm_cpu_synchronize_state(void *_env) { CPUState *env = _env; diff --git a/qemu-kvm.h b/qemu-kvm.h index b2c8c35..4523e25 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -1181,14 +1181,7 @@ static inline int kvm_sync_vcpus(void) } #ifndef QEMU_KVM_NO_CPU -static inline void kvm_arch_get_registers(CPUState *env) -{ - kvm_arch_save_regs(env); - kvm_arch_save_mpstate(env); -#ifdef KVM_CAP_MP_STATE - env->halted = (env->mp_state == KVM_MP_STATE_HALTED); -#endif -} +void kvm_arch_get_registers(CPUState *env); static inline void kvm_arch_put_registers(CPUState *env) {