diff mbox

[4/4] cpus: Change exec_init arg to cpu, not env

Message ID b6d0da2e852b19ac7852193a41d486edfb26c6ef.1432534114.git.crosthwaite.peter@gmail.com
State New
Headers show

Commit Message

Peter Crosthwaite May 25, 2015, 6:22 a.m. UTC
The callers (most of them in target-foo/cpu.c) to this function all
have the cpu pointer handy. Just pass it to avoid an ENV_GET_CPU from
core code (in exec.c).

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Michael Walle <michael@walle.cc>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Cc: Anthony Green <green@moxielogic.com>
Cc: Jia Liu <proljc@gmail.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
 exec.c                      | 4 ++--
 include/exec/exec-all.h     | 2 +-
 target-alpha/cpu.c          | 2 +-
 target-arm/cpu.c            | 2 +-
 target-cris/cpu.c           | 2 +-
 target-i386/cpu.c           | 2 +-
 target-lm32/cpu.c           | 2 +-
 target-m68k/cpu.c           | 2 +-
 target-microblaze/cpu.c     | 2 +-
 target-mips/cpu.c           | 2 +-
 target-moxie/cpu.c          | 2 +-
 target-openrisc/cpu.c       | 2 +-
 target-ppc/translate_init.c | 2 +-
 target-s390x/cpu.c          | 2 +-
 target-sh4/cpu.c            | 2 +-
 target-sparc/cpu.c          | 2 +-
 target-tricore/cpu.c        | 2 +-
 target-unicore32/cpu.c      | 2 +-
 target-xtensa/cpu.c         | 2 +-
 19 files changed, 20 insertions(+), 20 deletions(-)

Comments

Eduardo Habkost May 25, 2015, 8:54 p.m. UTC | #1
On Sun, May 24, 2015 at 11:22:25PM -0700, Peter Crosthwaite wrote:
> The callers (most of them in target-foo/cpu.c) to this function all
> have the cpu pointer handy. Just pass it to avoid an ENV_GET_CPU from
> core code (in exec.c).
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
> Cc: "Andreas Färber" <afaerber@suse.de>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Michael Walle <michael@walle.cc>
> Cc: Aurelien Jarno <aurelien@aurel32.net>
> Cc: Leon Alrae <leon.alrae@imgtec.com>
> Cc: Anthony Green <green@moxielogic.com>
> Cc: Jia Liu <proljc@gmail.com>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: Blue Swirl <blauwirbel@gmail.com>
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>

This conflicts with this series from Bharata B Rao:
  Subject: [PATCH v3 0/3] Bitmap based CPU enumeration

Can you rebase on top of that series?
Andreas Färber June 5, 2015, 2:51 p.m. UTC | #2
Am 25.05.2015 um 15:22 schrieb Peter Crosthwaite:
> The callers (most of them in target-foo/cpu.c) to this function all
> have the cpu pointer handy. Just pass it to avoid an ENV_GET_CPU from
> core code (in exec.c).
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
> Cc: "Andreas Färber" <afaerber@suse.de>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Michael Walle <michael@walle.cc>
> Cc: Aurelien Jarno <aurelien@aurel32.net>
> Cc: Leon Alrae <leon.alrae@imgtec.com>
> Cc: Anthony Green <green@moxielogic.com>
> Cc: Jia Liu <proljc@gmail.com>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: Blue Swirl <blauwirbel@gmail.com>
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
> ---
>  exec.c                      | 4 ++--
>  include/exec/exec-all.h     | 2 +-
>  target-alpha/cpu.c          | 2 +-
>  target-arm/cpu.c            | 2 +-
>  target-cris/cpu.c           | 2 +-
>  target-i386/cpu.c           | 2 +-
>  target-lm32/cpu.c           | 2 +-
>  target-m68k/cpu.c           | 2 +-
>  target-microblaze/cpu.c     | 2 +-
>  target-mips/cpu.c           | 2 +-
>  target-moxie/cpu.c          | 2 +-
>  target-openrisc/cpu.c       | 2 +-
>  target-ppc/translate_init.c | 2 +-
>  target-s390x/cpu.c          | 2 +-
>  target-sh4/cpu.c            | 2 +-
>  target-sparc/cpu.c          | 2 +-
>  target-tricore/cpu.c        | 2 +-
>  target-unicore32/cpu.c      | 2 +-
>  target-xtensa/cpu.c         | 2 +-
>  19 files changed, 20 insertions(+), 20 deletions(-)

Reviewed-by: Andreas Färber <afaerber@suse.de>

I assume this will conflict with another patch adding an Error**
argument - Eduardo, please help coordinating this.

Thanks,
Andreas
Eduardo Habkost June 5, 2015, 3:05 p.m. UTC | #3
On Fri, Jun 05, 2015 at 11:51:41PM +0900, Andreas Färber wrote:
> Am 25.05.2015 um 15:22 schrieb Peter Crosthwaite:
> > The callers (most of them in target-foo/cpu.c) to this function all
> > have the cpu pointer handy. Just pass it to avoid an ENV_GET_CPU from
> > core code (in exec.c).
[...]
> Reviewed-by: Andreas Färber <afaerber@suse.de>
> 
> I assume this will conflict with another patch adding an Error**
> argument - Eduardo, please help coordinating this.

I asked Peter to rebase on top of Bharata's "Bitmap based CPU
enumeration" series (that's already on v3 and got some Reviewed-by
lines), but both Peter and Bharata need to know which tree those series
are expected to be included.
Andreas Färber June 24, 2015, 12:48 p.m. UTC | #4
Am 05.06.2015 um 17:05 schrieb Eduardo Habkost:
> On Fri, Jun 05, 2015 at 11:51:41PM +0900, Andreas Färber wrote:
>> Am 25.05.2015 um 15:22 schrieb Peter Crosthwaite:
>>> The callers (most of them in target-foo/cpu.c) to this function all
>>> have the cpu pointer handy. Just pass it to avoid an ENV_GET_CPU from
>>> core code (in exec.c).
> [...]
>> Reviewed-by: Andreas Färber <afaerber@suse.de>
>>
>> I assume this will conflict with another patch adding an Error**
>> argument - Eduardo, please help coordinating this.
> 
> I asked Peter to rebase on top of Bharata's "Bitmap based CPU
> enumeration" series (that's already on v3 and got some Reviewed-by
> lines), but both Peter and Bharata need to know which tree those series
> are expected to be included.

I was expecting you to handle cpu_exec_init() through your x86 tree, but
seems that didn't happen. I am going through CPU patches today, so could
take open series but then would need to pick up the ENV_* stuff too,
which I thought would go through Paolo in my absence...

Regards,
Andreas
Paolo Bonzini June 24, 2015, 12:49 p.m. UTC | #5
On 24/06/2015 14:48, Andreas Färber wrote:
> I was expecting you to handle cpu_exec_init() through your x86 tree, but
> seems that didn't happen. I am going through CPU patches today, so could
> take open series but then would need to pick up the ENV_* stuff too,
> which I thought would go through Paolo in my absence...

I'm sorry for the misunderstanding.  I myself left the series behind
waiting for Bharata's series to get in, without really trying to see
what depended on it and what didn't.

Paolo
diff mbox

Patch

diff --git a/exec.c b/exec.c
index 69bd49e..0cb54f7 100644
--- a/exec.c
+++ b/exec.c
@@ -518,9 +518,8 @@  void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as)
 }
 #endif
 
-void cpu_exec_init(CPUArchState *env)
+void cpu_exec_init(CPUState *cpu)
 {
-    CPUState *cpu = ENV_GET_CPU(env);
     CPUClass *cc = CPU_GET_CLASS(cpu);
     CPUState *some_cpu;
     int cpu_index;
@@ -549,6 +548,7 @@  void cpu_exec_init(CPUArchState *env)
         vmstate_register(NULL, cpu_index, &vmstate_cpu_common, cpu);
     }
 #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
+    CPUArchState *env = cpu->env_ptr;
     register_savevm(NULL, "cpu", cpu_index, CPU_SAVE_VERSION,
                     cpu_save, cpu_load, env);
     assert(cc->vmsd == NULL);
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 304537f..078f517 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -88,7 +88,7 @@  void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
 TranslationBlock *tb_gen_code(CPUState *cpu,
                               target_ulong pc, target_ulong cs_base, int flags,
                               int cflags);
-void cpu_exec_init(CPUArchState *env);
+void cpu_exec_init(CPUState *env);
 void QEMU_NORETURN cpu_loop_exit(CPUState *cpu);
 int page_unprotect(target_ulong address, uintptr_t pc, void *puc);
 void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
index a98b7d8..9ffef3c 100644
--- a/target-alpha/cpu.c
+++ b/target-alpha/cpu.c
@@ -257,7 +257,7 @@  static void alpha_cpu_initfn(Object *obj)
     CPUAlphaState *env = &cpu->env;
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
     tlb_flush(cs, 1);
 
     alpha_translate_init();
diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index e39586b..f135529 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -402,7 +402,7 @@  static void arm_cpu_initfn(Object *obj)
     static bool inited;
 
     cs->env_ptr = &cpu->env;
-    cpu_exec_init(&cpu->env);
+    cpu_exec_init(cs);
     cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal,
                                          g_free, g_free);
 
diff --git a/target-cris/cpu.c b/target-cris/cpu.c
index d555ea0..50fbc9e 100644
--- a/target-cris/cpu.c
+++ b/target-cris/cpu.c
@@ -184,7 +184,7 @@  static void cris_cpu_initfn(Object *obj)
     static bool tcg_initialized;
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
 
     env->pregs[PR_VR] = ccc->vr;
 
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 3305e09..14e6546 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2850,7 +2850,7 @@  static void x86_cpu_initfn(Object *obj)
     static int inited;
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
 
     object_property_add(obj, "family", "int",
                         x86_cpuid_version_get_family,
diff --git a/target-lm32/cpu.c b/target-lm32/cpu.c
index f8081f5..44cb4a7 100644
--- a/target-lm32/cpu.c
+++ b/target-lm32/cpu.c
@@ -151,7 +151,7 @@  static void lm32_cpu_initfn(Object *obj)
     static bool tcg_initialized;
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
 
     env->flags = 0;
 
diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c
index 4cfb725..a33aa8a 100644
--- a/target-m68k/cpu.c
+++ b/target-m68k/cpu.c
@@ -168,7 +168,7 @@  static void m68k_cpu_initfn(Object *obj)
     static bool inited;
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
 
     if (tcg_enabled() && !inited) {
         inited = true;
diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c
index 89b8363..563ad46 100644
--- a/target-microblaze/cpu.c
+++ b/target-microblaze/cpu.c
@@ -136,7 +136,7 @@  static void mb_cpu_initfn(Object *obj)
     static bool tcg_initialized;
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
 
     set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
 
diff --git a/target-mips/cpu.c b/target-mips/cpu.c
index 958c999..2e29bd7 100644
--- a/target-mips/cpu.c
+++ b/target-mips/cpu.c
@@ -115,7 +115,7 @@  static void mips_cpu_initfn(Object *obj)
     CPUMIPSState *env = &cpu->env;
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
 
     if (tcg_enabled()) {
         mips_tcg_init();
diff --git a/target-moxie/cpu.c b/target-moxie/cpu.c
index 47b617f..de6e21a 100644
--- a/target-moxie/cpu.c
+++ b/target-moxie/cpu.c
@@ -66,7 +66,7 @@  static void moxie_cpu_initfn(Object *obj)
     static int inited;
 
     cs->env_ptr = &cpu->env;
-    cpu_exec_init(&cpu->env);
+    cpu_exec_init(cs);
 
     if (tcg_enabled() && !inited) {
         inited = 1;
diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
index 39bedc1..aa0e333 100644
--- a/target-openrisc/cpu.c
+++ b/target-openrisc/cpu.c
@@ -92,7 +92,7 @@  static void openrisc_cpu_initfn(Object *obj)
     static int inited;
 
     cs->env_ptr = &cpu->env;
-    cpu_exec_init(&cpu->env);
+    cpu_exec_init(cs);
 
 #ifndef CONFIG_USER_ONLY
     cpu_openrisc_mmu_init(cpu);
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index d74f4f0..e519cc0 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -9633,7 +9633,7 @@  static void ppc_cpu_initfn(Object *obj)
     CPUPPCState *env = &cpu->env;
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
     cpu->cpu_dt_id = cs->cpu_index;
 
     env->msr_mask = pcc->msr_mask;
diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c
index d2f9836..856a684 100644
--- a/target-s390x/cpu.c
+++ b/target-s390x/cpu.c
@@ -187,7 +187,7 @@  static void s390_cpu_initfn(Object *obj)
 #endif
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
 #if !defined(CONFIG_USER_ONLY)
     qemu_register_reset(s390_cpu_machine_reset_cb, cpu);
     qemu_get_timedate(&tm, 0);
diff --git a/target-sh4/cpu.c b/target-sh4/cpu.c
index d187a2b..f781e18 100644
--- a/target-sh4/cpu.c
+++ b/target-sh4/cpu.c
@@ -247,7 +247,7 @@  static void superh_cpu_initfn(Object *obj)
     CPUSH4State *env = &cpu->env;
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
 
     env->movcal_backup_tail = &(env->movcal_backup);
 
diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c
index a952097..ebf5af7 100644
--- a/target-sparc/cpu.c
+++ b/target-sparc/cpu.c
@@ -802,7 +802,7 @@  static void sparc_cpu_initfn(Object *obj)
     CPUSPARCState *env = &cpu->env;
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
 
     if (tcg_enabled()) {
         gen_intermediate_code_init(env);
diff --git a/target-tricore/cpu.c b/target-tricore/cpu.c
index b3e5512..425525f 100644
--- a/target-tricore/cpu.c
+++ b/target-tricore/cpu.c
@@ -92,7 +92,7 @@  static void tricore_cpu_initfn(Object *obj)
     CPUTriCoreState *env = &cpu->env;
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
 
     if (tcg_enabled()) {
         tricore_tcg_init();
diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c
index 5b32987..76d680c 100644
--- a/target-unicore32/cpu.c
+++ b/target-unicore32/cpu.c
@@ -111,7 +111,7 @@  static void uc32_cpu_initfn(Object *obj)
     static bool inited;
 
     cs->env_ptr = env;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
 
 #ifdef CONFIG_USER_ONLY
     env->uncached_asr = ASR_MODE_USER;
diff --git a/target-xtensa/cpu.c b/target-xtensa/cpu.c
index 2b75678..83a86d3 100644
--- a/target-xtensa/cpu.c
+++ b/target-xtensa/cpu.c
@@ -114,7 +114,7 @@  static void xtensa_cpu_initfn(Object *obj)
 
     cs->env_ptr = env;
     env->config = xcc->config;
-    cpu_exec_init(env);
+    cpu_exec_init(cs);
 
     if (tcg_enabled() && !tcg_inited) {
         tcg_inited = true;