From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4op5-0000vG-Uc for qemu-devel@nongnu.org; Tue, 16 Jun 2015 07:14:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4op2-00082x-7y for qemu-devel@nongnu.org; Tue, 16 Jun 2015 07:14:31 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:101::1]:52407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4op1-00082X-VK for qemu-devel@nongnu.org; Tue, 16 Jun 2015 07:14:28 -0400 Date: Tue, 16 Jun 2015 13:14:26 +0200 From: Aurelien Jarno Message-ID: <20150616111426.GA23297@aurel32.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v2 4/5] cpus: Change exec_init() arg to cpu, not env List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: qemu-devel@nongnu.org On 2015-06-16 00:42, 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). >=20 > Cc: Paolo Bonzini > Cc: Richard Henderson > Cc: Peter Maydell > Cc: "Edgar E. Iglesias" > Cc: "Andreas F=E4rber" > Cc: Eduardo Habkost > Cc: Michael Walle > Cc: Aurelien Jarno > Cc: Leon Alrae > Cc: Anthony Green > Cc: Jia Liu > Cc: Alexander Graf > Cc: Blue Swirl > Cc: Mark Cave-Ayland > Cc: Bastian Koppelmann > Cc: Guan Xuetao > Cc: Max Filippov > Reviewed-by: Andreas F=E4rber > Signed-off-by: Peter Crosthwaite > --- > changed since v1: > Add () to function in commit message. > Rebase on Bharata's Error ** patch > --- > 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(-) >=20 > diff --git a/exec.c b/exec.c > index b1c8aae..7fc1950 100644 > --- a/exec.c > +++ b/exec.c > @@ -554,9 +554,8 @@ void cpu_exec_exit(CPUState *cpu) > } > #endif > =20 > -void cpu_exec_init(CPUArchState *env, Error **errp) > +void cpu_exec_init(CPUState *cpu, Error **errp) > { > - CPUState *cpu =3D ENV_GET_CPU(env); > CPUClass *cc =3D CPU_GET_CLASS(cpu); > int cpu_index; > Error *local_err =3D NULL; > @@ -585,6 +584,7 @@ void cpu_exec_init(CPUArchState *env, Error **errp) > vmstate_register(NULL, cpu_index, &vmstate_cpu_common, cpu); > } > #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY) > + CPUArchState *env =3D cpu->env_ptr; > register_savevm(NULL, "cpu", cpu_index, CPU_SAVE_VERSION, > cpu_save, cpu_load, env); > assert(cc->vmsd =3D=3D NULL); > diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h > index cffd21e..4bf13e0 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, uint= ptr_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, Error **errp); > +void cpu_exec_init(CPUState *env, Error **errp); > void QEMU_NORETURN cpu_loop_exit(CPUState *cpu); > =20 > #if !defined(CONFIG_USER_ONLY) > diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c > index e865ba7..421d7e5 100644 > --- a/target-alpha/cpu.c > +++ b/target-alpha/cpu.c > @@ -257,7 +257,7 @@ static void alpha_cpu_initfn(Object *obj) > CPUAlphaState *env =3D &cpu->env; > =20 > cs->env_ptr =3D env; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > tlb_flush(cs, 1); > =20 > alpha_translate_init(); > diff --git a/target-arm/cpu.c b/target-arm/cpu.c > index c0a8384..62c4e20 100644 > --- a/target-arm/cpu.c > +++ b/target-arm/cpu.c > @@ -423,7 +423,7 @@ static void arm_cpu_initfn(Object *obj) > static bool inited; > =20 > cs->env_ptr =3D &cpu->env; > - cpu_exec_init(&cpu->env, &error_abort); > + cpu_exec_init(cs, &error_abort); > cpu->cp_regs =3D g_hash_table_new_full(g_int_hash, g_int_equal, > g_free, g_free); > =20 > diff --git a/target-cris/cpu.c b/target-cris/cpu.c > index 4606901..b17e849 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; > =20 > cs->env_ptr =3D env; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > env->pregs[PR_VR] =3D ccc->vr; > =20 > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 643b390..0a808c9 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -3007,7 +3007,7 @@ static void x86_cpu_initfn(Object *obj) > static int inited; > =20 > cs->env_ptr =3D env; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > object_property_add(obj, "family", "int", > x86_cpuid_version_get_family, > diff --git a/target-lm32/cpu.c b/target-lm32/cpu.c > index da4fde1..c2b77c6 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; > =20 > cs->env_ptr =3D env; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > env->flags =3D 0; > =20 > diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c > index ae3d765..4f246da 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; > =20 > cs->env_ptr =3D env; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > if (tcg_enabled() && !inited) { > inited =3D true; > diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c > index 6469ac5..cd37dde 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; > =20 > cs->env_ptr =3D env; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > set_float_rounding_mode(float_round_nearest_even, &env->fp_status); > =20 > diff --git a/target-mips/cpu.c b/target-mips/cpu.c > index 1fd9f22..4027d0f 100644 > --- a/target-mips/cpu.c > +++ b/target-mips/cpu.c > @@ -115,7 +115,7 @@ static void mips_cpu_initfn(Object *obj) > CPUMIPSState *env =3D &cpu->env; > =20 > cs->env_ptr =3D env; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > if (tcg_enabled()) { > mips_tcg_init(); > diff --git a/target-moxie/cpu.c b/target-moxie/cpu.c > index 415c65a..6b035aa 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; > =20 > cs->env_ptr =3D &cpu->env; > - cpu_exec_init(&cpu->env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > if (tcg_enabled() && !inited) { > inited =3D 1; > diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c > index cd6c657..d97f3c0 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; > =20 > cs->env_ptr =3D &cpu->env; > - cpu_exec_init(&cpu->env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > #ifndef CONFIG_USER_ONLY > cpu_openrisc_mmu_init(cpu); > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c > index 2b72f2d..b95ac68 100644 > --- a/target-ppc/translate_init.c > +++ b/target-ppc/translate_init.c > @@ -8928,7 +8928,7 @@ static void ppc_cpu_realizefn(DeviceState *dev, Err= or **errp) > return; > } > =20 > - cpu_exec_init(&cpu->env, &local_err); > + cpu_exec_init(cs, &local_err); > if (local_err !=3D NULL) { > error_propagate(errp, local_err); > return; > diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c > index b428115..355b647 100644 > --- a/target-s390x/cpu.c > +++ b/target-s390x/cpu.c > @@ -195,7 +195,7 @@ static void s390_cpu_initfn(Object *obj) > #endif > =20 > cs->env_ptr =3D env; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > #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 2c2060b..5c65ab4 100644 > --- a/target-sh4/cpu.c > +++ b/target-sh4/cpu.c > @@ -248,7 +248,7 @@ static void superh_cpu_initfn(Object *obj) > CPUSH4State *env =3D &cpu->env; > =20 > cs->env_ptr =3D env; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > env->movcal_backup_tail =3D &(env->movcal_backup); > =20 > diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c > index 4d1da7c..9528e3a 100644 > --- a/target-sparc/cpu.c > +++ b/target-sparc/cpu.c > @@ -802,7 +802,7 @@ static void sparc_cpu_initfn(Object *obj) > CPUSPARCState *env =3D &cpu->env; > =20 > cs->env_ptr =3D env; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > if (tcg_enabled()) { > gen_intermediate_code_init(env); > diff --git a/target-tricore/cpu.c b/target-tricore/cpu.c > index 6fa60b1..2029ef6 100644 > --- a/target-tricore/cpu.c > +++ b/target-tricore/cpu.c > @@ -92,7 +92,7 @@ static void tricore_cpu_initfn(Object *obj) > CPUTriCoreState *env =3D &cpu->env; > =20 > cs->env_ptr =3D env; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > if (tcg_enabled()) { > tricore_tcg_init(); > diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c > index eda039c..fc451a1 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; > =20 > cs->env_ptr =3D env; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > #ifdef CONFIG_USER_ONLY > env->uncached_asr =3D ASR_MODE_USER; > diff --git a/target-xtensa/cpu.c b/target-xtensa/cpu.c > index 8d69d23..da8129d 100644 > --- a/target-xtensa/cpu.c > +++ b/target-xtensa/cpu.c > @@ -114,7 +114,7 @@ static void xtensa_cpu_initfn(Object *obj) > =20 > cs->env_ptr =3D env; > env->config =3D xcc->config; > - cpu_exec_init(env, &error_abort); > + cpu_exec_init(cs, &error_abort); > =20 > if (tcg_enabled() && !tcg_inited) { > tcg_inited =3D true; Reviewed-by: Aurelien Jarno --=20 Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net