From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKyMh-0006Tm-8w for qemu-devel@nongnu.org; Wed, 06 Jul 2016 21:44:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKyMf-0006gP-Kd for qemu-devel@nongnu.org; Wed, 06 Jul 2016 21:44:31 -0400 Date: Thu, 7 Jul 2016 11:11:14 +1000 From: David Gibson Message-ID: <20160707011114.GG14675@voom.fritz.box> References: <146780713904.26232.12351310667258006783.stgit@bahia.lab.toulouse-stg.fr.ibm.com> <146780714723.26232.11978180493637322382.stgit@bahia.lab.toulouse-stg.fr.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="S5HS5MvDw4DmbRmb" Content-Disposition: inline In-Reply-To: <146780714723.26232.11978180493637322382.stgit@bahia.lab.toulouse-stg.fr.ibm.com> Subject: Re: [Qemu-devel] [PATCH v3 1/7] ppc: different creation paths for cpus in system and user mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: Eduardo Habkost , Benjamin Herrenschmidt , qemu-devel@nongnu.org, Alexander Graf , qemu-ppc@nongnu.org, Cedric Le Goater , Bharata B Rao , Scott Wood , Igor Mammedov --S5HS5MvDw4DmbRmb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 06, 2016 at 02:13:14PM +0200, Greg Kurz wrote: > The machine code currently uses the same cpu_ppc_init() function to > create cpus as the user mode. This function also triggers the cpu > realization. >=20 > It is okay for user mode but with system mode we may want to do other > things between initialization and realization, like generating cpu > ids for the DT for example. >=20 > With this patch, each mode has its own creation helper: > - ppc_cpu_init() is for system mode only > - cpu_init() is for user mode only >=20 >=20 > Suggested-by: Igor Mammedov > Signed-off-by: Greg Kurz Reviewed-by: David Gibson > --- > v3: fixed ppc_cpu_init() invocation for virtex and ppc4xx (Igor) > --- > hw/ppc/e500.c | 2 +- > hw/ppc/mac_newworld.c | 2 +- > hw/ppc/mac_oldworld.c | 2 +- > hw/ppc/ppc.c | 5 +++++ > hw/ppc/ppc440_bamboo.c | 2 +- > hw/ppc/ppc4xx_devs.c | 2 +- > hw/ppc/prep.c | 2 +- > hw/ppc/spapr.c | 2 +- > hw/ppc/virtex_ml507.c | 2 +- > include/hw/ppc/ppc.h | 1 + > target-ppc/cpu.h | 5 +++-- > target-ppc/translate_init.c | 5 ----- > 12 files changed, 17 insertions(+), 15 deletions(-) >=20 > diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c > index 0cd534df55f8..ff5d92e48dd9 100644 > --- a/hw/ppc/e500.c > +++ b/hw/ppc/e500.c > @@ -821,7 +821,7 @@ void ppce500_init(MachineState *machine, PPCE500Param= s *params) > CPUState *cs; > qemu_irq *input; > =20 > - cpu =3D cpu_ppc_init(machine->cpu_model); > + cpu =3D ppc_cpu_init(machine->cpu_model); > if (cpu =3D=3D NULL) { > fprintf(stderr, "Unable to initialize CPU!\n"); > exit(1); > diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c > index 7d2510658d0f..ecd40914be45 100644 > --- a/hw/ppc/mac_newworld.c > +++ b/hw/ppc/mac_newworld.c > @@ -193,7 +193,7 @@ static void ppc_core99_init(MachineState *machine) > #endif > } > for (i =3D 0; i < smp_cpus; i++) { > - cpu =3D cpu_ppc_init(machine->cpu_model); > + cpu =3D ppc_cpu_init(machine->cpu_model); > if (cpu =3D=3D NULL) { > fprintf(stderr, "Unable to find PowerPC CPU definition\n"); > exit(1); > diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c > index 447948746b1a..77fbdfffd4e2 100644 > --- a/hw/ppc/mac_oldworld.c > +++ b/hw/ppc/mac_oldworld.c > @@ -113,7 +113,7 @@ static void ppc_heathrow_init(MachineState *machine) > if (machine->cpu_model =3D=3D NULL) > machine->cpu_model =3D "G3"; > for (i =3D 0; i < smp_cpus; i++) { > - cpu =3D cpu_ppc_init(machine->cpu_model); > + cpu =3D ppc_cpu_init(machine->cpu_model); > if (cpu =3D=3D NULL) { > fprintf(stderr, "Unable to find PowerPC CPU definition\n"); > exit(1); > diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c > index e4252528a69d..dc3d214009c5 100644 > --- a/hw/ppc/ppc.c > +++ b/hw/ppc/ppc.c > @@ -1350,3 +1350,8 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id) > =20 > return NULL; > } > + > +PowerPCCPU *ppc_cpu_init(const char *cpu_model) > +{ > + return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, cpu_model)); > +} > diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c > index 5c535b18a20d..7f22433c8e91 100644 > --- a/hw/ppc/ppc440_bamboo.c > +++ b/hw/ppc/ppc440_bamboo.c > @@ -186,7 +186,7 @@ static void bamboo_init(MachineState *machine) > if (machine->cpu_model =3D=3D NULL) { > machine->cpu_model =3D "440EP"; > } > - cpu =3D cpu_ppc_init(machine->cpu_model); > + cpu =3D ppc_cpu_init(machine->cpu_model); > if (cpu =3D=3D NULL) { > fprintf(stderr, "Unable to initialize CPU!\n"); > exit(1); > diff --git a/hw/ppc/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c > index e7f413e49d08..d48b61f04910 100644 > --- a/hw/ppc/ppc4xx_devs.c > +++ b/hw/ppc/ppc4xx_devs.c > @@ -56,7 +56,7 @@ PowerPCCPU *ppc4xx_init(const char *cpu_model, > CPUPPCState *env; > =20 > /* init CPUs */ > - cpu =3D cpu_ppc_init(cpu_model); > + cpu =3D ppc_cpu_init(cpu_model); > if (cpu =3D=3D NULL) { > fprintf(stderr, "Unable to find PowerPC %s CPU definition\n", > cpu_model); > diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c > index 054af1e8b481..e62fe643f492 100644 > --- a/hw/ppc/prep.c > +++ b/hw/ppc/prep.c > @@ -509,7 +509,7 @@ static void ppc_prep_init(MachineState *machine) > if (machine->cpu_model =3D=3D NULL) > machine->cpu_model =3D "602"; > for (i =3D 0; i < smp_cpus; i++) { > - cpu =3D cpu_ppc_init(machine->cpu_model); > + cpu =3D ppc_cpu_init(machine->cpu_model); > if (cpu =3D=3D NULL) { > fprintf(stderr, "Unable to find PowerPC CPU definition\n"); > exit(1); > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 7f33a1b2b57d..d134eb2f338e 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -1835,7 +1835,7 @@ static void ppc_spapr_init(MachineState *machine) > g_free(type); > } else { > for (i =3D 0; i < smp_cpus; i++) { > - PowerPCCPU *cpu =3D cpu_ppc_init(machine->cpu_model); > + PowerPCCPU *cpu =3D ppc_cpu_init(machine->cpu_model); > if (cpu =3D=3D NULL) { > error_report("Unable to find PowerPC CPU definition"); > exit(1); > diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c > index b97d96685cf1..7e4445b6879a 100644 > --- a/hw/ppc/virtex_ml507.c > +++ b/hw/ppc/virtex_ml507.c > @@ -96,7 +96,7 @@ static PowerPCCPU *ppc440_init_xilinx(ram_addr_t *ram_s= ize, > CPUPPCState *env; > qemu_irq *irqs; > =20 > - cpu =3D cpu_ppc_init(cpu_model); > + cpu =3D ppc_cpu_init(cpu_model); > if (cpu =3D=3D NULL) { > fprintf(stderr, "Unable to initialize CPU!\n"); > exit(1); > diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h > index 5617dc4a2c04..a4db1db82e1b 100644 > --- a/include/hw/ppc/ppc.h > +++ b/include/hw/ppc/ppc.h > @@ -106,4 +106,5 @@ enum { > /* ppc_booke.c */ > void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t flag= s); > =20 > +PowerPCCPU *ppc_cpu_init(const char *cpu_model); > #endif > diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h > index 2666a3f80d00..63e586298296 100644 > --- a/target-ppc/cpu.h > +++ b/target-ppc/cpu.h > @@ -1198,7 +1198,6 @@ extern const struct VMStateDescription vmstate_ppc_= cpu; > #endif > =20 > /***********************************************************************= ******/ > -PowerPCCPU *cpu_ppc_init(const char *cpu_model); > void ppc_translate_init(void); > void gen_update_current_nip(void *opaque); > /* you can call this signal handler from your SIGBUS and SIGSEGV > @@ -1277,7 +1276,9 @@ static inline uint64_t ppc_dump_gpr(CPUPPCState *en= v, int gprn) > int ppc_dcr_read (ppc_dcr_t *dcr_env, int dcrn, uint32_t *valp); > int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, uint32_t val); > =20 > -#define cpu_init(cpu_model) CPU(cpu_ppc_init(cpu_model)) > +#if defined(CONFIG_USER_ONLY) > +#define cpu_init(cpu_model) cpu_generic_init(TYPE_POWERPC_CPU, cpu_model) > +#endif > =20 > #define cpu_signal_handler cpu_ppc_signal_handler > #define cpu_list ppc_cpu_list > diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c > index 8f257fb74aa7..31120a5aaf33 100644 > --- a/target-ppc/translate_init.c > +++ b/target-ppc/translate_init.c > @@ -10012,11 +10012,6 @@ static ObjectClass *ppc_cpu_class_by_name(const = char *name) > return NULL; > } > =20 > -PowerPCCPU *cpu_ppc_init(const char *cpu_model) > -{ > - return POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, cpu_model)); > -} > - > /* Sort by PVR, ordering special case "host" last. */ > static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b) > { >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --S5HS5MvDw4DmbRmb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXfawyAAoJEGw4ysog2bOSd/AP/i8qYOnXVfa9koTJsfz9ubUn HzH0So/JZcj3KLE82QE/cugaKFr+mBcy92l8bCgm6qu4vcUJoLVMcMl5H/SVRpkG iUgep3MYlNJBEuNP9jabvcLr1r01z4iCMByHrQejRzNcehVL5uQcRrKsn0pBOqgY RStHq87q10TakWqQhfX3OjFiPK2tvCvMaGw4FrAeXLf6jMe6ftyXI/B9AenZdjlf zLn0m1gCceHlTx3SvNE1kDXWj++OZC4/h7UbBXEHte08tBy42iWeWHqONP5B22ds aMJmEupwGR7PG/6lJOy455LxzxR7+TcakCWrx5kp8LYM0ylyLCrrwjEMXgp9H+ye kUW2YJahLPFjEUdrXHD835v2TKCZ+oy0d3YKX3b/9m/dBSiulqOGQp+mVpjNkQyS awMzy29/n+gB54A9j4DdHKngLRj5Uh5HAqMDCE+NeSarsj867m+gGGLTs+XGM/8a GAz2ua351Txb1t/R0fjyNgYUyRg1ZYCUTwq05++RNg8Hjd364SVIn7iBuP9/KWcW Y6kK1/DzJ5W5XzsrAceUwJUXtYGwR5mYhP7SiIsIDHK9Aa0EJkXdJQq9IbyWzP86 jYpKXq1Ae4uGQLb54rZMO59b5Qa/LZesvM3YSx7fHNw4JiOlQkKOU7SoT++lObHH dP57i5C+X9vginU16Y5i =g/yt -----END PGP SIGNATURE----- --S5HS5MvDw4DmbRmb--