[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/39] target/ppc: cpu_init: Group registration of generic SPRs
From: |
Cédric Le Goater |
Subject: |
[PULL 15/39] target/ppc: cpu_init: Group registration of generic SPRs |
Date: |
Fri, 18 Feb 2022 11:38:03 +0100 |
From: Fabiano Rosas <farosas@linux.ibm.com>
The top level init_proc calls register_generic_sprs but also registers
some other SPRs outside of that function. Let's group everything into
a single place.
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20220216162426.1885923-4-farosas@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
target/ppc/cpu_init.c | 58 ++++++++++++++++++++++++-------------------
1 file changed, 32 insertions(+), 26 deletions(-)
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index ec29ccf473e6..1fb17a5e5112 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -150,8 +150,11 @@ static void _spr_register(CPUPPCState *env, int num, const
char *name,
oea_read, oea_write, 0, ival)
/* Generic PowerPC SPRs */
-static void register_generic_sprs(CPUPPCState *env)
+static void register_generic_sprs(PowerPCCPU *cpu)
{
+ PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
+ CPUPPCState *env = &cpu->env;
+
/* Integer processing */
spr_register(env, SPR_XER, "XER",
&spr_read_xer, &spr_write_xer,
@@ -192,6 +195,32 @@ static void register_generic_sprs(CPUPPCState *env)
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
+
+ spr_register(env, SPR_PVR, "PVR",
+ /* Linux permits userspace to read PVR */
+#if defined(CONFIG_LINUX_USER)
+ &spr_read_generic,
+#else
+ SPR_NOACCESS,
+#endif
+ SPR_NOACCESS,
+ &spr_read_generic, SPR_NOACCESS,
+ pcc->pvr);
+
+ /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
+ if (pcc->svr != POWERPC_SVR_NONE) {
+ if (pcc->svr & POWERPC_SVR_E500) {
+ spr_register(env, SPR_E500_SVR, "SVR",
+ SPR_NOACCESS, SPR_NOACCESS,
+ &spr_read_generic, SPR_NOACCESS,
+ pcc->svr & ~POWERPC_SVR_E500);
+ } else {
+ spr_register(env, SPR_SVR, "SVR",
+ SPR_NOACCESS, SPR_NOACCESS,
+ &spr_read_generic, SPR_NOACCESS,
+ pcc->svr);
+ }
+ }
}
/* SPR common to all non-embedded PowerPC, including 601 */
@@ -7237,31 +7266,8 @@ static void init_ppc_proc(PowerPCCPU *cpu)
env->tlb_type = TLB_NONE;
#endif
/* Register SPR common to all PowerPC implementations */
- register_generic_sprs(env);
- spr_register(env, SPR_PVR, "PVR",
- /* Linux permits userspace to read PVR */
-#if defined(CONFIG_LINUX_USER)
- &spr_read_generic,
-#else
- SPR_NOACCESS,
-#endif
- SPR_NOACCESS,
- &spr_read_generic, SPR_NOACCESS,
- pcc->pvr);
- /* Register SVR if it's defined to anything else than POWERPC_SVR_NONE */
- if (pcc->svr != POWERPC_SVR_NONE) {
- if (pcc->svr & POWERPC_SVR_E500) {
- spr_register(env, SPR_E500_SVR, "SVR",
- SPR_NOACCESS, SPR_NOACCESS,
- &spr_read_generic, SPR_NOACCESS,
- pcc->svr & ~POWERPC_SVR_E500);
- } else {
- spr_register(env, SPR_SVR, "SVR",
- SPR_NOACCESS, SPR_NOACCESS,
- &spr_read_generic, SPR_NOACCESS,
- pcc->svr);
- }
- }
+ register_generic_sprs(cpu);
+
/* PowerPC implementation specific initialisations (SPRs, timers, ...) */
(*pcc->init_proc)(env);
--
2.34.1
- [PULL 22/39] target/ppc: cpu_init: Deduplicate 440 SPR registration, (continued)
- [PULL 22/39] target/ppc: cpu_init: Deduplicate 440 SPR registration, Cédric Le Goater, 2022/02/18
- [PULL 36/39] target/ppc: cpu_init: Expose some SPR registration helpers, Cédric Le Goater, 2022/02/18
- [PULL 35/39] target/ppc: Rename spr_tcg.h to spr_common.h, Cédric Le Goater, 2022/02/18
- [PULL 05/39] spapr: prevent hdec timer being set up under virtual hypervisor, Cédric Le Goater, 2022/02/18
- [PULL 09/39] target/ppc: add helper for books vhyp hypercall handler, Cédric Le Goater, 2022/02/18
- [PULL 32/39] target/ppc: cpu_init: Reuse init_proc_745 for the 755, Cédric Le Goater, 2022/02/18
- [PULL 33/39] target/ppc: cpu_init: Rename register_ne_601_sprs, Cédric Le Goater, 2022/02/18
- [PULL 20/39] target/ppc: cpu_init: Decouple G2 SPR registration from 755, Cédric Le Goater, 2022/02/18
- [PULL 12/39] spapr: implement nested-hv capability for the virtual hypervisor, Cédric Le Goater, 2022/02/18
- [PULL 31/39] target/ppc: cpu_init: Reuse init_proc_604 for the 604e, Cédric Le Goater, 2022/02/18
- [PULL 15/39] target/ppc: cpu_init: Group registration of generic SPRs,
Cédric Le Goater <=
- [PULL 27/39] target/ppc: cpu_init: Move 755 L2 cache SPRs into a function, Cédric Le Goater, 2022/02/18
- [PULL 19/39] target/ppc: cpu_init: Move G2 SPRs into register_G2_sprs, Cédric Le Goater, 2022/02/18
- [PULL 29/39] target/ppc: cpu_init: Move 604e SPR registration into a function, Cédric Le Goater, 2022/02/18
- [PULL 23/39] target/ppc: cpu_init: Deduplicate 603 SPR registration, Cédric Le Goater, 2022/02/18
- [PULL 13/39] target/ppc: cpu_init: Remove not implemented comments, Cédric Le Goater, 2022/02/18
- [PULL 38/39] target/ppc: cpu_init: Move check_pow and QOM macros to a header, Cédric Le Goater, 2022/02/18
- [PULL 10/39] target/ppc: Add powerpc_reset_excp_state helper, Cédric Le Goater, 2022/02/18
- [PULL 39/39] target/ppc: Move common SPR functions out of cpu_init, Cédric Le Goater, 2022/02/18
- [PULL 18/39] target/ppc: cpu_init: Move 405 SPRs into register_405_sprs, Cédric Le Goater, 2022/02/18
- Re: [PULL 00/39] ppc queue, Peter Maydell, 2022/02/20