qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "open list:Overall" <kvm@vger.kernel.org>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	"Alexander Graf" <agraf@suse.de>,
	"Blue Swirl" <blauwirbel@gmail.com>,
	"open list:ppce500" <qemu-ppc@nongnu.org>,
	"Avi Kivity" <avi@redhat.com>,
	anthony@codemonkey.ws, "Scott Wood" <scottwood@freescale.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"David Gibson" <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH 20/35] cpus: Pass CPUState to qemu_cpu_kick()
Date: Wed, 31 Oct 2012 01:59:51 +0100	[thread overview]
Message-ID: <1351645206-3041-21-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1351645206-3041-1-git-send-email-afaerber@suse.de>

CPUArchState is no longer needed there.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 cpus.c             |   13 +++++--------
 exec.c             |    2 +-
 hw/ppc.c           |    4 ++--
 hw/ppce500_spin.c  |    2 +-
 hw/spapr_rtas.c    |    5 ++++-
 hw/sun4m.c         |    2 +-
 hw/sun4u.c         |    2 +-
 include/qemu/cpu.h |    8 ++++++++
 kvm-all.c          |    2 +-
 qemu-common.h      |    1 -
 target-ppc/kvm.c   |    3 +--
 target-s390x/kvm.c |    2 +-
 12 Dateien geändert, 26 Zeilen hinzugefügt(+), 20 Zeilen entfernt(-)

diff --git a/cpus.c b/cpus.c
index 5f91523..b802d38 100644
--- 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 a85a9b1..038e40d 100644
--- 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;
     }
 
diff --git a/hw/ppc.c b/hw/ppc.c
index ada100b..fa7ae74 100644
--- 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:
diff --git a/hw/ppce500_spin.c b/hw/ppce500_spin.c
index fb5461d..7f8c842 100644
--- a/hw/ppce500_spin.c
+++ b/hw/ppce500_spin.c
@@ -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,
diff --git a/hw/spapr_rtas.c b/hw/spapr_rtas.c
index ce76c58..6d5c48a 100644
--- a/hw/spapr_rtas.c
+++ b/hw/spapr_rtas.c
@@ -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;
diff --git a/hw/sun4m.c b/hw/sun4m.c
index 02673b2..1a78676 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -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)
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 1621171..b2b51e3 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -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)
diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h
index 75e0f8d..bfeb224 100644
--- a/include/qemu/cpu.h
+++ b/include/qemu/cpu.h
@@ -96,6 +96,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.
  *
diff --git a/kvm-all.c b/kvm-all.c
index 74d2652..e41e1c9 100644
--- 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);
     }
 }
 
diff --git a/qemu-common.h b/qemu-common.h
index 2094742..2011c00 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -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 */
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index d7d8e8f..6aacff0 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -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)
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index a66ac43..94de764 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -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;
 }
-- 
1.7.10.4

  parent reply	other threads:[~2012-10-31  1:00 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31  0:59 [Qemu-devel] [PULL] QOM CPUState patch queue 2012-10-31 Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 01/35] target-i386: cpu_x86_register(): report error from property setter Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 02/35] target-i386: If x86_cpu_realize() failed, report error and do cleanup Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 03/35] target-i386: Initialize APIC at CPU level Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 04/35] target-i386: Inline APIC cpu_env property setting Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 05/35] apic: Store X86CPU in APICCommonState Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 06/35] target-i386: Pass X86CPU to cpu_x86_load_seg_cache_sipi() Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 07/35] cpus: Pass CPUState to qemu_cpu_is_self() Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 08/35] cpus: Pass CPUState to qemu_cpu_kick_thread() Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 09/35] cpu: Move created field to CPUState Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 10/35] cpu: Move stop " Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 11/35] ppce500_spin: Store PowerPCCPU in SpinKick Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 12/35] cpu: Move stopped field to CPUState Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 13/35] cpus: Pass CPUState to cpu_is_stopped() Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 14/35] cpus: Pass CPUState to cpu_can_run() Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 15/35] cpu: Move halt_cond to CPUState Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 16/35] cpus: Pass CPUState to qemu_tcg_cpu_thread_fn Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 17/35] cpus: Pass CPUState to qemu_tcg_init_vcpu() Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 18/35] ppc: Pass PowerPCCPU to {ppc6xx, ppc970, power7, ppc40x, ppce500}_set_irq() Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 19/35] target-ppc: Rename kvm_kick_{env => cpu} and pass PowerPCCPU Andreas Färber
2012-10-31  0:59 ` Andreas Färber [this message]
2012-10-31  0:59 ` [Qemu-devel] [PATCH 21/35] cpu: Move queued_work_{first, last} to CPUState Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 22/35] cpus: Pass CPUState to flush_queued_work() Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 23/35] cpus: Pass CPUState to qemu_wait_io_event_common() Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 24/35] xtensa_pic: Pass XtensaCPU to xtensa_ccompare_cb() Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 25/35] target-ppc: Pass PowerPCCPU to powerpc_excp() Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 26/35] target-ppc: Pass PowerPCCPU to cpu_ppc_hypercall Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 27/35] spapr: Pass PowerPCCPU to spapr_hypercall() Andreas Färber
2012-10-31  0:59 ` [Qemu-devel] [PATCH 28/35] spapr: Pass PowerPCCPU to hypercalls Andreas Färber
2012-10-31  1:00 ` [Qemu-devel] [PATCH 29/35] cpus: Pass CPUState to [qemu_]cpu_has_work() Andreas Färber
2012-10-31  1:29   ` Richard Henderson
2012-10-31 21:05   ` Aurelien Jarno
2012-10-31 21:37     ` Andreas Färber
2012-10-31 21:47       ` Aurelien Jarno
2012-10-31  1:00 ` [Qemu-devel] [PATCH 30/35] target-i386: Pass X86CPU to kvm_mce_inject() Andreas Färber
2012-10-31  1:00 ` [Qemu-devel] [PATCH 31/35] target-i386: Pass X86CPU to cpu_x86_inject_mce() Andreas Färber
2012-10-31  1:00 ` [Qemu-devel] [PATCH 32/35] cpus: Pass CPUState to run_on_cpu() Andreas Färber
2012-10-31  1:00 ` [Qemu-devel] [PATCH 33/35] cpu: Move thread_id to CPUState Andreas Färber
2012-10-31  1:00 ` [Qemu-devel] [PATCH 34/35] target-i386: Pass X86CPU to kvm_get_mp_state() Andreas Färber
2012-10-31  1:00 ` [Qemu-devel] [PATCH 35/35] target-i386: Pass X86CPU to kvm_handle_halt() Andreas Färber
2012-10-31  3:15 ` [Qemu-devel] [PULL] QOM CPUState patch queue 2012-10-31 Andreas Färber
2012-11-01 19:32 ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1351645206-3041-21-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=scottwood@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).