diff mbox

Update halted state from mpstate only in case of inkernel irq chip

Message ID 1253631112-26124-1-git-send-email-gleb@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gleb Natapov Sept. 22, 2009, 2:51 p.m. UTC
Otherwise cpu is always unhalted by call to kvm_arch_get_registers()

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 qemu-kvm.c |   10 ++++++++++
 qemu-kvm.h |    9 +--------
 2 files changed, 11 insertions(+), 8 deletions(-)

Comments

Avi Kivity Sept. 23, 2009, 9 a.m. UTC | #1
On 09/22/2009 05:51 PM, Gleb Natapov wrote:
> Otherwise cpu is always unhalted by call to kvm_arch_get_registers()
>    

Applied, thanks.
diff mbox

Patch

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)
 {