[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 2/9] target-ppc: Refactor init_proc_POWER7
From: |
Alexey Kardashevskiy |
Subject: |
[Qemu-ppc] [PATCH 2/9] target-ppc: Refactor init_proc_POWER7 |
Date: |
Wed, 21 May 2014 16:20:21 +1000 |
This moves SPR initialization to helper functions.
Signed-off-by: Alexey Kardashevskiy <address@hidden>
---
target-ppc/translate_init.c | 83 +++++++++++++++++++++++++++++++++------------
1 file changed, 62 insertions(+), 21 deletions(-)
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index bf5ea09..e9c37fa 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -7680,17 +7680,17 @@ POWERPC_FAMILY(POWER5P)(ObjectClass *oc, void *data)
pcc->l1_icache_size = 0x10000;
}
-static void init_proc_POWER7 (CPUPPCState *env)
+static void gen_spr_book3s_ids(CPUPPCState *env)
{
- gen_spr_ne_601(env);
- gen_spr_7xx(env);
- /* Time base */
- gen_tbl(env);
/* Processor identification */
spr_register(env, SPR_PIR, "PIR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_pir,
0x00000000);
+}
+
+static void gen_spr_book3s_purr(CPUPPCState *env)
+{
#if !defined(CONFIG_USER_ONLY)
/* PURR & SPURR: Hack - treat these as aliases for the TB for now */
spr_register_kvm(env, SPR_PURR, "PURR",
@@ -7701,14 +7701,22 @@ static void init_proc_POWER7 (CPUPPCState *env)
&spr_read_purr, SPR_NOACCESS,
&spr_read_purr, SPR_NOACCESS,
KVM_REG_PPC_SPURR, 0x00000000);
+#endif
+}
+
+static void gen_spr_book3s_debug(CPUPPCState *env)
+{
+#if !defined(CONFIG_USER_ONLY)
spr_register(env, SPR_CFAR, "SPR_CFAR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_cfar, &spr_write_cfar,
0x00000000);
- spr_register_kvm(env, SPR_DSCR, "SPR_DSCR",
- SPR_NOACCESS, SPR_NOACCESS,
- &spr_read_generic, &spr_write_generic,
- KVM_REG_PPC_DSCR, 0x00000000);
+#endif
+}
+
+static void gen_spr_book3s_pmu(CPUPPCState *env)
+{
+#if !defined(CONFIG_USER_ONLY)
spr_register_kvm(env, SPR_MMCRA, "SPR_MMCRA",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
@@ -7721,8 +7729,34 @@ static void init_proc_POWER7 (CPUPPCState *env)
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
KVM_REG_PPC_PMC6, 0x00000000);
-#endif /* !CONFIG_USER_ONLY */
- gen_spr_amr(env);
+#endif
+}
+
+static void gen_spr_book3s_vr(CPUPPCState *env)
+{
+ spr_register(env, SPR_VRSAVE, "SPR_VRSAVE",
+ &spr_read_generic, &spr_write_generic,
+ &spr_read_generic, &spr_write_generic,
+ 0x00000000);
+}
+
+static void gen_spr_book3s_lpar(CPUPPCState *env)
+{
+ /* Logical partitionning */
+ spr_register_kvm(env, SPR_LPCR, "LPCR",
+ SPR_NOACCESS, SPR_NOACCESS,
+ &spr_read_generic, &spr_write_generic,
+ KVM_REG_PPC_LPCR, 0x00000000);
+}
+
+static void gen_spr_book3s_common(CPUPPCState *env)
+{
+#if !defined(CONFIG_USER_ONLY)
+ spr_register_kvm(env, SPR_DSCR, "SPR_DSCR",
+ SPR_NOACCESS, SPR_NOACCESS,
+ &spr_read_generic, &spr_write_generic,
+ KVM_REG_PPC_DSCR, 0x00000000);
+#endif
/* XXX : not implemented */
spr_register(env, SPR_CTRL, "SPR_CTRLT",
SPR_NOACCESS, SPR_NOACCESS,
@@ -7732,22 +7766,29 @@ static void init_proc_POWER7 (CPUPPCState *env)
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, SPR_NOACCESS,
0x80800000);
- spr_register(env, SPR_VRSAVE, "SPR_VRSAVE",
- &spr_read_generic, &spr_write_generic,
- &spr_read_generic, &spr_write_generic,
- 0x00000000);
spr_register(env, SPR_PPR, "PPR",
&spr_read_generic, &spr_write_generic,
&spr_read_generic, &spr_write_generic,
0x00000000);
- /* Logical partitionning */
- spr_register_kvm(env, SPR_LPCR, "LPCR",
- SPR_NOACCESS, SPR_NOACCESS,
- &spr_read_generic, &spr_write_generic,
- KVM_REG_PPC_LPCR, 0x00000000);
+}
+
+static void init_proc_POWER7 (CPUPPCState *env)
+{
+ gen_spr_ne_601(env);
+ gen_spr_7xx(env);
+ /* Time base */
+ gen_tbl(env);
+ gen_spr_book3s_ids(env);
+ gen_spr_book3s_common(env);
+ gen_spr_amr(env);
+ gen_spr_book3s_vr(env);
+ gen_spr_book3s_lpar(env);
+ gen_spr_book3s_purr(env);
+ gen_spr_book3s_debug(env);
+ gen_spr_book3s_pmu(env);
#if !defined(CONFIG_USER_ONLY)
env->slb_nr = 32;
-#endif
+#endif /* !CONFIG_USER_ONLY */
init_excp_POWER7(env);
env->dcache_line_size = 128;
env->icache_line_size = 128;
--
1.9.rc0
- Re: [Qemu-ppc] [PATCH 9/9] spapr_hcall: Add address-translation-mode-on-interrupt resource in H_SET_MODE, (continued)
[Qemu-ppc] [PATCH 4/9] target-ppc: Refactor init_proc_POWER8, Alexey Kardashevskiy, 2014/05/21
[Qemu-ppc] [PATCH 8/9] spapr_hcall: Split h_set_mode(), Alexey Kardashevskiy, 2014/05/21
[Qemu-ppc] [PATCH 6/9] target-ppc: Enable PPR and VRSAVE SPRs migration, Alexey Kardashevskiy, 2014/05/21