]> git.proxmox.com Git - qemu.git/commitdiff
cpus: Pass CPUState to qemu_cpu_kick()
authorAndreas Färber <afaerber@suse.de>
Thu, 3 May 2012 02:34:15 +0000 (04:34 +0200)
committerAndreas Färber <afaerber@suse.de>
Wed, 31 Oct 2012 00:02:45 +0000 (01:02 +0100)
CPUArchState is no longer needed there.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 files changed:
cpus.c
exec.c
hw/ppc.c
hw/ppce500_spin.c
hw/spapr_rtas.c
hw/sun4m.c
hw/sun4u.c
include/qemu/cpu.h
kvm-all.c
qemu-common.h
target-ppc/kvm.c
target-s390x/kvm.c

diff --git a/cpus.c b/cpus.c
index 5f915239ac7514d80ac8c4aa5d29d02356595f96..b802d38885e5f1954047322680ab1d70b9f24569 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -661,7 +661,7 @@ void run_on_cpu(CPUArchState *env, void (*func)(void *data), void *data)
     wi.next = NULL;
     wi.done = false;
 
-    qemu_cpu_kick(env);
+    qemu_cpu_kick(cpu);
     while (!wi.done) {
         CPUArchState *self_env = cpu_single_env;
 
@@ -870,11 +870,8 @@ static void qemu_cpu_kick_thread(CPUState *cpu)
 #endif
 }
 
-void qemu_cpu_kick(void *_env)
+void qemu_cpu_kick(CPUState *cpu)
 {
-    CPUArchState *env = _env;
-    CPUState *cpu = ENV_GET_CPU(env);
-
     qemu_cond_broadcast(cpu->halt_cond);
     if (!tcg_enabled() && !cpu->thread_kicked) {
         qemu_cpu_kick_thread(cpu);
@@ -950,7 +947,7 @@ void pause_all_vcpus(void)
     while (penv) {
         CPUState *pcpu = ENV_GET_CPU(penv);
         pcpu->stop = true;
-        qemu_cpu_kick(penv);
+        qemu_cpu_kick(pcpu);
         penv = penv->next_cpu;
     }
 
@@ -971,7 +968,7 @@ void pause_all_vcpus(void)
         qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex);
         penv = first_cpu;
         while (penv) {
-            qemu_cpu_kick(penv);
+            qemu_cpu_kick(ENV_GET_CPU(penv));
             penv = penv->next_cpu;
         }
     }
@@ -986,7 +983,7 @@ void resume_all_vcpus(void)
         CPUState *pcpu = ENV_GET_CPU(penv);
         pcpu->stop = false;
         pcpu->stopped = false;
-        qemu_cpu_kick(penv);
+        qemu_cpu_kick(pcpu);
         penv = penv->next_cpu;
     }
 }
diff --git a/exec.c b/exec.c
index a85a9b1fd2cc1004611d75df9950f5a8be09fe4e..038e40d09b6028714023813bf2d3872fd4d922e1 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -1704,7 +1704,7 @@ static void tcg_handle_interrupt(CPUArchState *env, int mask)
      * case its halted.
      */
     if (!qemu_cpu_is_self(cpu)) {
-        qemu_cpu_kick(env);
+        qemu_cpu_kick(cpu);
         return;
     }
 
index ada100b1c5428826fda35c9b2aa666ad61a09164..fa7ae74f0d06104cfb28735cf35ab032f02b82c2 100644 (file)
--- a/hw/ppc.c
+++ b/hw/ppc.c
@@ -206,7 +206,7 @@ static void ppc970_set_irq(void *opaque, int pin, int level)
             } else {
                 LOG_IRQ("%s: restart the CPU\n", __func__);
                 env->halted = 0;
-                qemu_cpu_kick(env);
+                qemu_cpu_kick(CPU(cpu));
             }
             break;
         case PPC970_INPUT_HRESET:
@@ -335,7 +335,7 @@ static void ppc40x_set_irq(void *opaque, int pin, int level)
             } else {
                 LOG_IRQ("%s: restart the CPU\n", __func__);
                 env->halted = 0;
-                qemu_cpu_kick(env);
+                qemu_cpu_kick(CPU(cpu));
             }
             break;
         case PPC40x_INPUT_DEBUG:
index fb5461d58833a0e5fa0014543fb0f5afaca1c2bd..7f8c8428b62f26bee31f991924978eea1018b9b1 100644 (file)
@@ -115,7 +115,7 @@ static void spin_kick(void *data)
     env->halted = 0;
     env->exception_index = -1;
     cpu->stopped = false;
-    qemu_cpu_kick(env);
+    qemu_cpu_kick(cpu);
 }
 
 static void spin_write(void *opaque, hwaddr addr, uint64_t value,
index ce76c5856a9bd160de37c363e12d5ff1dc106b72..6d5c48a740062dd0e3fd9c0abd6a1588296faa7a 100644 (file)
@@ -163,6 +163,7 @@ static void rtas_start_cpu(sPAPREnvironment *spapr,
                            uint32_t nret, target_ulong rets)
 {
     target_ulong id, start, r3;
+    CPUState *cpu;
     CPUPPCState *env;
 
     if (nargs != 3 || nret != 1) {
@@ -175,6 +176,8 @@ static void rtas_start_cpu(sPAPREnvironment *spapr,
     r3 = rtas_ld(args, 2);
 
     for (env = first_cpu; env; env = env->next_cpu) {
+        cpu = ENV_GET_CPU(env);
+
         if (env->cpu_index != id) {
             continue;
         }
@@ -194,7 +197,7 @@ static void rtas_start_cpu(sPAPREnvironment *spapr,
         env->gpr[3] = r3;
         env->halted = 0;
 
-        qemu_cpu_kick(env);
+        qemu_cpu_kick(cpu);
 
         rtas_st(rets, 0, 0);
         return;
index 02673b228e516f1f09741061d696292b1f44d5e9..1a786762aa6f62f39f43f71c7e56d705d1316cb2 100644 (file)
@@ -259,7 +259,7 @@ static void cpu_kick_irq(SPARCCPU *cpu)
 
     env->halted = 0;
     cpu_check_irqs(env);
-    qemu_cpu_kick(env);
+    qemu_cpu_kick(CPU(cpu));
 }
 
 static void cpu_set_irq(void *opaque, int irq, int level)
index 162117129cb27ce982b0079eb94ed4f765910ea3..b2b51e30c206356cc672a1e0eebadcb41a8a5a54 100644 (file)
@@ -317,7 +317,7 @@ static void cpu_kick_irq(SPARCCPU *cpu)
 
     env->halted = 0;
     cpu_check_irqs(env);
-    qemu_cpu_kick(env);
+    qemu_cpu_kick(CPU(cpu));
 }
 
 static void cpu_set_ivec_irq(void *opaque, int irq, int level)
index 75e0f8dc68064d2d94d0a329ca96d19c92c9fcd8..bfeb2245abc32a3d3156de34de8cec605ad35d04 100644 (file)
@@ -95,6 +95,14 @@ void cpu_reset(CPUState *cpu);
  */
 bool qemu_cpu_is_self(CPUState *cpu);
 
+/**
+ * qemu_cpu_kick:
+ * @cpu: The vCPU to kick.
+ *
+ * Kicks @cpu's thread.
+ */
+void qemu_cpu_kick(CPUState *cpu);
+
 /**
  * cpu_is_stopped:
  * @cpu: The CPU to check.
index 74d2652f02d8013e251fe3ad0a7900c60a1b8bac..e41e1c9531a9d7b010e823d421d1d832cff9867c 100644 (file)
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -833,7 +833,7 @@ static void kvm_handle_interrupt(CPUArchState *env, int mask)
     env->interrupt_request |= mask;
 
     if (!qemu_cpu_is_self(cpu)) {
-        qemu_cpu_kick(env);
+        qemu_cpu_kick(cpu);
     }
 }
 
index 2094742f2b73a65953ec00b2effec4f1ea42b90b..2011c00fe24910ff5368f78c1fa9f17204b6abfe 100644 (file)
@@ -324,7 +324,6 @@ void cpu_save(QEMUFile *f, void *opaque);
 int cpu_load(QEMUFile *f, void *opaque, int version_id);
 
 /* Unblock cpu */
-void qemu_cpu_kick(void *env);
 void qemu_cpu_kick_self(void);
 
 /* work queue */
index d7d8e8fef08b7a8991301d0d332a789c6700b277..6aacff062453617f65c274ca471f2ac79debb013 100644 (file)
@@ -76,9 +76,8 @@ static QEMUTimer *idle_timer;
 static void kvm_kick_cpu(void *opaque)
 {
     PowerPCCPU *cpu = opaque;
-    CPUPPCState *env = &cpu->env;
 
-    qemu_cpu_kick(env);
+    qemu_cpu_kick(CPU(cpu));
 }
 
 int kvm_arch_init(KVMState *s)
index a66ac4341c4323e5013f24effee3fbaf6d64f4a8..94de7642645c0696936d377624a44d1f8439309f 100644 (file)
@@ -403,7 +403,7 @@ static int s390_cpu_restart(S390CPU *cpu)
 
     kvm_s390_interrupt(env, KVM_S390_RESTART, 0);
     s390_add_running_cpu(env);
-    qemu_cpu_kick(env);
+    qemu_cpu_kick(CPU(cpu));
     dprintf("DONE: SIGP cpu restart: %p\n", env);
     return 0;
 }