Skip to contentSkip to conversation

target-ppc: POWER8 supports the MSR_LE bit

PATCH In review Anton Blanchard 6 participants 14 messages Mar 25, 2014 – Apr 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 target-ppc: POWER8 supports the MSR_LE bit

Add MSR_LE to the msr_mask for POWER8.

---
 target-ppc/translate_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-ppc/translate_init.c +1 -1
index 7f53c33..a82c8f9 100644
@@ -7175,7 +7175,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data)
                         PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |
                         PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
                         PPC2_ISA205 | PPC2_ISA207S;
-    pcc->msr_mask = 0x800000000284FF36ULL;
+    pcc->msr_mask = 0x800000000284FF37ULL;
     pcc->mmu_model = POWERPC_MMU_2_06;
 #if defined(CONFIG_SOFTMMU)
     pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 2/6 target-ppc: POWER8 supports isel

POWER8 supports isel, so enable it in QEMU.

---
 target-ppc/translate_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-ppc/translate_init.c +1 -1
index a82c8f9..4fda0fd 100644
@@ -7157,7 +7157,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data)
     pcc->pvr_mask = CPU_POWERPC_POWER8_MASK;
     pcc->init_proc = init_proc_POWER8;
     pcc->check_pow = check_pow_nocheck;
-    pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_MFTB |
+    pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
                        PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
                        PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
                        PPC_FLOAT_FRSQRTES |
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH 3/6 target-ppc: POWER7+ supports the MSR_VSX bit

In reply to Anton Blanchard

Without MSR_VSX we die early during a Linux boot.

---
 target-ppc/translate_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-ppc/translate_init.c +1 -1
index 4fda0fd..87c00a1 100644
@@ -7118,7 +7118,7 @@ POWERPC_FAMILY(POWER7P)(ObjectClass *oc, void *data)
                         PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
                         PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
                         PPC2_FP_TST_ISA206;
-    pcc->msr_mask = 0x800000000204FF37ULL;
+    pcc->msr_mask = 0x800000000284FF37ULL;
     pcc->mmu_model = POWERPC_MMU_2_06;
 #if defined(CONFIG_SOFTMMU)
     pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
Signature · 1 line
1.8.3.2
#3 lore raw

PATCH 4/6 target-ppc: MSR_POW not supported on POWER7/7+/8

In reply to Anton Blanchard

Remove MSR_POW from the msr_mask for POWER7/7+/8.

---
 target-ppc/translate_init.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
target-ppc/translate_init.c +3 -3
index 87c00a1..d07e186 100644
@@ -7075,7 +7075,7 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data)
                         PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
                         PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
                         PPC2_FP_TST_ISA206;
-    pcc->msr_mask = 0x800000000284FF37ULL;
+    pcc->msr_mask = 0x800000000280FF37ULL;
     pcc->mmu_model = POWERPC_MMU_2_06;
 #if defined(CONFIG_SOFTMMU)
     pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
@@ -7118,7 +7118,7 @@ POWERPC_FAMILY(POWER7P)(ObjectClass *oc, void *data)
                         PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
                         PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
                         PPC2_FP_TST_ISA206;
-    pcc->msr_mask = 0x800000000284FF37ULL;
+    pcc->msr_mask = 0x800000000280FF37ULL;
     pcc->mmu_model = POWERPC_MMU_2_06;
 #if defined(CONFIG_SOFTMMU)
     pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
@@ -7175,7 +7175,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data)
                         PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 |
                         PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 |
                         PPC2_ISA205 | PPC2_ISA207S;
-    pcc->msr_mask = 0x800000000284FF37ULL;
+    pcc->msr_mask = 0x800000000280FF37ULL;
     pcc->mmu_model = POWERPC_MMU_2_06;
 #if defined(CONFIG_SOFTMMU)
     pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
Signature · 1 line
1.8.3.2
#4 lore raw

PATCH 5/6 target-ppc: Fix Book3S PMU SPRs

In reply to Anton Blanchard

Most of the PMU SPRs were wrong on Book3S.

---
 target-ppc/cpu.h            |  29 ++++++++-
 target-ppc/translate_init.c | 139 +++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 153 insertions(+), 15 deletions(-)
target-ppc/cpu.h +28 -1
index 2719c08..7082041 100644
@@ -1452,54 +1452,81 @@ static inline int cpu_mmu_index (CPUPPCState *env)
 #define SPR_MPC_MI_CTR        (0x300)
 #define SPR_PERF1             (0x301)
 #define SPR_RCPU_MI_RBA1      (0x301)
+#define SPR_BOOK3S_UMMCR2     (0x301)
 #define SPR_PERF2             (0x302)
 #define SPR_RCPU_MI_RBA2      (0x302)
 #define SPR_MPC_MI_AP         (0x302)
-#define SPR_MMCRA             (0x302)
+#define SPR_BOOK3S_UMMCRA     (0x302)
 #define SPR_PERF3             (0x303)
 #define SPR_RCPU_MI_RBA3      (0x303)
 #define SPR_MPC_MI_EPN        (0x303)
+#define SPR_BOOK3S_UPMC1      (0x303)
 #define SPR_PERF4             (0x304)
+#define SPR_BOOK3S_UPMC2      (0x304)
 #define SPR_PERF5             (0x305)
 #define SPR_MPC_MI_TWC        (0x305)
+#define SPR_BOOK3S_UPMC3      (0x305)
 #define SPR_PERF6             (0x306)
 #define SPR_MPC_MI_RPN        (0x306)
+#define SPR_BOOK3S_UPMC4      (0x306)
 #define SPR_PERF7             (0x307)
+#define SPR_BOOK3S_UPMC5      (0x307)
 #define SPR_PERF8             (0x308)
 #define SPR_RCPU_L2U_RBA0     (0x308)
 #define SPR_MPC_MD_CTR        (0x308)
+#define SPR_BOOK3S_UPMC6      (0x308)
 #define SPR_PERF9             (0x309)
 #define SPR_RCPU_L2U_RBA1     (0x309)
 #define SPR_MPC_MD_CASID      (0x309)
+#define SPR_BOOK3S_UPMC7      (0x309)
 #define SPR_PERFA             (0x30A)
 #define SPR_RCPU_L2U_RBA2     (0x30A)
 #define SPR_MPC_MD_AP         (0x30A)
+#define SPR_BOOK3S_UPMC8      (0x30A)
 #define SPR_PERFB             (0x30B)
 #define SPR_RCPU_L2U_RBA3     (0x30B)
 #define SPR_MPC_MD_EPN        (0x30B)
+#define SPR_BOOK3S_UMMCR0     (0x30B)
 #define SPR_PERFC             (0x30C)
 #define SPR_MPC_MD_TWB        (0x30C)
+#define SPR_BOOK3S_USIAR      (0x30C)
 #define SPR_PERFD             (0x30D)
 #define SPR_MPC_MD_TWC        (0x30D)
+#define SPR_BOOK3S_USDAR      (0x30D)
 #define SPR_PERFE             (0x30E)
 #define SPR_MPC_MD_RPN        (0x30E)
+#define SPR_BOOK3S_UMMCR1     (0x30E)
 #define SPR_PERFF             (0x30F)
 #define SPR_MPC_MD_TW         (0x30F)
 #define SPR_UPERF0            (0x310)
 #define SPR_UPERF1            (0x311)
+#define SPR_BOOK3S_MMCR2      (0x311)
 #define SPR_UPERF2            (0x312)
+#define SPR_BOOK3S_MMCRA      (0x312)
 #define SPR_UPERF3            (0x313)
+#define SPR_BOOK3S_PMC1       (0x313)
 #define SPR_UPERF4            (0x314)
+#define SPR_BOOK3S_PMC2       (0x314)
 #define SPR_UPERF5            (0x315)
+#define SPR_BOOK3S_PMC3       (0x315)
 #define SPR_UPERF6            (0x316)
+#define SPR_BOOK3S_PMC4       (0x316)
 #define SPR_UPERF7            (0x317)
+#define SPR_BOOK3S_PMC5       (0x317)
 #define SPR_UPERF8            (0x318)
+#define SPR_BOOK3S_PMC6       (0x318)
 #define SPR_UPERF9            (0x319)
+#define SPR_BOOK3S_PMC7       (0x319)
 #define SPR_UPERFA            (0x31A)
+#define SPR_BOOK3S_PMC8       (0x31A)
 #define SPR_UPERFB            (0x31B)
+#define SPR_BOOK3S_MMCR0      (0x31B)
 #define SPR_UPERFC            (0x31C)
+#define SPR_BOOK3S_SIAR       (0x31C)
 #define SPR_UPERFD            (0x31D)
+#define SPR_BOOK3S_SDAR       (0x31D)
 #define SPR_UPERFE            (0x31E)
+#define SPR_BOOK3S_MMCR1      (0x31E)
 #define SPR_UPERFF            (0x31F)
 #define SPR_RCPU_MI_RA0       (0x320)
 #define SPR_MPC_MI_DBCAM      (0x320)
target-ppc/translate_init.c +125 -14

181 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#5 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 5/6] target-ppc: Fix Book3S PMU SPRs

Quoted 100 lines · Anton Blanchard

Most of the PMU SPRs were wrong on Book3S.

---
  target-ppc/cpu.h            |  29 ++++++++-
  target-ppc/translate_init.c | 139 +++++++++++++++++++++++++++++++++++++++-----
  2 files changed, 153 insertions(+), 15 deletions(-)
target-ppc/cpu.h +28 -1
index 2719c08..7082041 100644
@@ -1452,54 +1452,81 @@ static inline int cpu_mmu_index (CPUPPCState *env)
  #define SPR_MPC_MI_CTR        (0x300)
  #define SPR_PERF1             (0x301)
  #define SPR_RCPU_MI_RBA1      (0x301)
+#define SPR_BOOK3S_UMMCR2     (0x301)
  #define SPR_PERF2             (0x302)
  #define SPR_RCPU_MI_RBA2      (0x302)
  #define SPR_MPC_MI_AP         (0x302)
-#define SPR_MMCRA             (0x302)
+#define SPR_BOOK3S_UMMCRA     (0x302)
  #define SPR_PERF3             (0x303)
  #define SPR_RCPU_MI_RBA3      (0x303)
  #define SPR_MPC_MI_EPN        (0x303)
+#define SPR_BOOK3S_UPMC1      (0x303)
  #define SPR_PERF4             (0x304)
+#define SPR_BOOK3S_UPMC2      (0x304)
  #define SPR_PERF5             (0x305)
  #define SPR_MPC_MI_TWC        (0x305)
+#define SPR_BOOK3S_UPMC3      (0x305)
  #define SPR_PERF6             (0x306)
  #define SPR_MPC_MI_RPN        (0x306)
+#define SPR_BOOK3S_UPMC4      (0x306)
  #define SPR_PERF7             (0x307)
+#define SPR_BOOK3S_UPMC5      (0x307)
  #define SPR_PERF8             (0x308)
  #define SPR_RCPU_L2U_RBA0     (0x308)
  #define SPR_MPC_MD_CTR        (0x308)
+#define SPR_BOOK3S_UPMC6      (0x308)
  #define SPR_PERF9             (0x309)
  #define SPR_RCPU_L2U_RBA1     (0x309)
  #define SPR_MPC_MD_CASID      (0x309)
+#define SPR_BOOK3S_UPMC7      (0x309)
  #define SPR_PERFA             (0x30A)
  #define SPR_RCPU_L2U_RBA2     (0x30A)
  #define SPR_MPC_MD_AP         (0x30A)
+#define SPR_BOOK3S_UPMC8      (0x30A)
  #define SPR_PERFB             (0x30B)
  #define SPR_RCPU_L2U_RBA3     (0x30B)
  #define SPR_MPC_MD_EPN        (0x30B)
+#define SPR_BOOK3S_UMMCR0     (0x30B)
  #define SPR_PERFC             (0x30C)
  #define SPR_MPC_MD_TWB        (0x30C)
+#define SPR_BOOK3S_USIAR      (0x30C)
  #define SPR_PERFD             (0x30D)
  #define SPR_MPC_MD_TWC        (0x30D)
+#define SPR_BOOK3S_USDAR      (0x30D)
  #define SPR_PERFE             (0x30E)
  #define SPR_MPC_MD_RPN        (0x30E)
+#define SPR_BOOK3S_UMMCR1     (0x30E)
  #define SPR_PERFF             (0x30F)
  #define SPR_MPC_MD_TW         (0x30F)
  #define SPR_UPERF0            (0x310)
  #define SPR_UPERF1            (0x311)
+#define SPR_BOOK3S_MMCR2      (0x311)
  #define SPR_UPERF2            (0x312)
+#define SPR_BOOK3S_MMCRA      (0x312)
  #define SPR_UPERF3            (0x313)
+#define SPR_BOOK3S_PMC1       (0x313)
  #define SPR_UPERF4            (0x314)
+#define SPR_BOOK3S_PMC2       (0x314)
  #define SPR_UPERF5            (0x315)
+#define SPR_BOOK3S_PMC3       (0x315)
  #define SPR_UPERF6            (0x316)
+#define SPR_BOOK3S_PMC4       (0x316)
  #define SPR_UPERF7            (0x317)
+#define SPR_BOOK3S_PMC5       (0x317)
  #define SPR_UPERF8            (0x318)
+#define SPR_BOOK3S_PMC6       (0x318)
  #define SPR_UPERF9            (0x319)
+#define SPR_BOOK3S_PMC7       (0x319)
  #define SPR_UPERFA            (0x31A)
+#define SPR_BOOK3S_PMC8       (0x31A)
  #define SPR_UPERFB            (0x31B)
+#define SPR_BOOK3S_MMCR0      (0x31B)
  #define SPR_UPERFC            (0x31C)
+#define SPR_BOOK3S_SIAR       (0x31C)
  #define SPR_UPERFD            (0x31D)
+#define SPR_BOOK3S_SDAR       (0x31D)
  #define SPR_UPERFE            (0x31E)
+#define SPR_BOOK3S_MMCR1      (0x31E)
  #define SPR_UPERFF            (0x31F)
  #define SPR_RCPU_MI_RA0       (0x320)
  #define SPR_MPC_MI_DBCAM      (0x320)
target-ppc/translate_init.c +0 -0
index d07e186..273e37d 100644

target-ppc/translate_init.c static int check_pow_970 (CPUPPCState *env) · line 6633

Quoted 5 lines
target-ppc/translate_init.c +2 -0
@@ -6629,10 +6629,128 @@ static int check_pow_970 (CPUPPCState *env)
      return 0;
  }
 
+/* SPR common to all book3s implementations */
+static void gen_spr_book3s (CPUPPCState *env)

Book3s or Book3s_64? We usually refer to 750+ as book3s as well - and depending on who you ask some 60x ones too :).

So I'd prefer if we name (and give the comment) slightly more specific. Something like "SPRs common to all ISA 2.x book3s implementations" for example. Then it's clear what we're talking about.

Otherwise seems to make a lot of sense.

Alex

#6 lore raw

PATCH 6/6 target-ppc: Add PMC7/8 to 970

In reply to Anton Blanchard

970 CPUs have PMC7/8. Create gen_spr_970 to avoid replicating it 3 times, and simplify the existing code.

---
 target-ppc/translate_init.c | 89 ++++++++++++++++++++-------------------------
 1 file changed, 39 insertions(+), 50 deletions(-)
target-ppc/translate_init.c +39 -50
index 273e37d..50b2603 100644
@@ -6747,12 +6747,13 @@ static void gen_spr_book3s (CPUPPCState *env)
                  0x00000000);
 }
 
-static void init_proc_970 (CPUPPCState *env)
+static void gen_spr_970 (CPUPPCState *env)
 {
-    gen_spr_ne_601(env);
-    gen_spr_book3s(env);
-    /* Time base */
-    gen_tbl(env);
+    spr_register(env, SPR_HIOR, "SPR_HIOR",
+                 SPR_NOACCESS, SPR_NOACCESS,
+                 &spr_read_hior, &spr_write_hior,
+                 0x00000000);
+
     /* Hardware implementation registers */
     /* XXX : not implemented */
     spr_register(env, SPR_HID0, "HID0",
@@ -6769,13 +6770,40 @@ static void init_proc_970 (CPUPPCState *env)
                  SPR_NOACCESS, SPR_NOACCESS,
                  &spr_read_generic, &spr_write_generic,
                  POWERPC970_HID5_INIT);
+
+    /* Performance monitors */
+    /* XXX : not implemented */
+    spr_register_kvm(env, SPR_BOOK3S_PMC7, "PMC7",
+                     SPR_NOACCESS, SPR_NOACCESS,
+                     &spr_read_generic, &spr_write_generic,
+                     KVM_REG_PPC_PMC7, 0x00000000);
+    /* XXX : not implemented */
+    spr_register_kvm(env, SPR_BOOK3S_PMC8, "PMC8",
+                     SPR_NOACCESS, SPR_NOACCESS,
+                     &spr_read_generic, &spr_write_generic,
+                     KVM_REG_PPC_PMC8, 0x00000000);
+    /* XXX : not implemented */
+    spr_register(env, SPR_BOOK3S_UPMC7, "UPMC7",
+                 &spr_read_ureg, SPR_NOACCESS,
+                 &spr_read_ureg, SPR_NOACCESS,
+                 0x00000000);
+    /* XXX : not implemented */
+    spr_register(env, SPR_BOOK3S_UPMC8, "UPMC8",
+                 &spr_read_ureg, SPR_NOACCESS,
+                 &spr_read_ureg, SPR_NOACCESS,
+                 0x00000000);
+}
+
+static void init_proc_970 (CPUPPCState *env)
+{
+    gen_spr_ne_601(env);
+    gen_spr_book3s(env);
+    gen_spr_970(env);
+    /* Time base */
+    gen_tbl(env);
     /* Memory management */
     /* XXX: not correct */
     gen_low_BATs(env);
-    spr_register(env, SPR_HIOR, "SPR_HIOR",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_hior, &spr_write_hior,
-                 0x00000000);
 #if !defined(CONFIG_USER_ONLY)
     env->slb_nr = 32;
 #endif
@@ -6831,31 +6859,12 @@ static void init_proc_970FX (CPUPPCState *env)
 {
     gen_spr_ne_601(env);
     gen_spr_book3s(env);
+    gen_spr_970(env);
     /* Time base */
     gen_tbl(env);
-    /* Hardware implementation registers */
-    /* XXX : not implemented */
-    spr_register(env, SPR_HID0, "HID0",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_clear,
-                 0x60000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_HID1, "HID1",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_970_HID5, "HID5",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 POWERPC970_HID5_INIT);
     /* Memory management */
     /* XXX: not correct */
     gen_low_BATs(env);
-    spr_register(env, SPR_HIOR, "SPR_HIOR",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_hior, &spr_write_hior,
-                 0x00000000);
     spr_register(env, SPR_CTRL, "SPR_CTRL",
                  SPR_NOACCESS, SPR_NOACCESS,
                  SPR_NOACCESS, &spr_write_generic,
@@ -6923,32 +6932,12 @@ static void init_proc_970MP (CPUPPCState *env)
 {
     gen_spr_ne_601(env);
     gen_spr_book3s(env);
+    gen_spr_970(env);
     /* Time base */
     gen_tbl(env);
-    /* Hardware implementation registers */
-    /* XXX : not implemented */
-    spr_register(env, SPR_HID0, "HID0",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_clear,
-                 0x60000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_HID1, "HID1",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_970_HID5, "HID5",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 POWERPC970_HID5_INIT);
-    /* XXX : not implemented */
     /* Memory management */
     /* XXX: not correct */
     gen_low_BATs(env);
-    spr_register(env, SPR_HIOR, "SPR_HIOR",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_hior, &spr_write_hior,
-                 0x00000000);
     /* Logical partitionning */
     spr_register_kvm(env, SPR_LPCR, "LPCR",
                      SPR_NOACCESS, SPR_NOACCESS,
Signature · 1 line
1.8.3.2
#7 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 6/6] target-ppc: Add PMC7/8 to 970

Quoted 14 lines · Anton Blanchard

970 CPUs have PMC7/8. Create gen_spr_970 to avoid replicating it 3 times, and simplify the existing code.

---
 target-ppc/translate_init.c | 89 ++++++++++++++++++++-------------------------
 1 file changed, 39 insertions(+), 50 deletions(-)
target-ppc/translate_init.c +0 -0
index 273e37d..50b2603 100644
@@ -6747,12 +6747,13 @@ static void gen_spr_book3s (CPUPPCState *env)
                  0x00000000);

target-ppc/translate_init.c static void gen_spr_book3s (CPUPPCState *env) · line 6752

Quoted 10 lines
target-ppc/translate_init.c +2 -5
 }
 
-static void init_proc_970 (CPUPPCState *env)
+static void gen_spr_970 (CPUPPCState *env)
 {
-    gen_spr_ne_601(env);
-    gen_spr_book3s(env);
-    /* Time base */
-    gen_tbl(env);
+    spr_register(env, SPR_HIOR, "SPR_HIOR",

+ spr_register(env, SPR_HIOR, "HIOR",

Can we please not add SPR_ in string name? Thanks.

Quoted 120 lines
target-ppc/translate_init.c +37 -45
+                 SPR_NOACCESS, SPR_NOACCESS,
+                 &spr_read_hior, &spr_write_hior,
+                 0x00000000);
+
     /* Hardware implementation registers */
     /* XXX : not implemented */
     spr_register(env, SPR_HID0, "HID0",
@@ -6769,13 +6770,40 @@ static void init_proc_970 (CPUPPCState *env)
                  SPR_NOACCESS, SPR_NOACCESS,
                  &spr_read_generic, &spr_write_generic,
                  POWERPC970_HID5_INIT);
+
+    /* Performance monitors */
+    /* XXX : not implemented */
+    spr_register_kvm(env, SPR_BOOK3S_PMC7, "PMC7",
+                     SPR_NOACCESS, SPR_NOACCESS,
+                     &spr_read_generic, &spr_write_generic,
+                     KVM_REG_PPC_PMC7, 0x00000000);
+    /* XXX : not implemented */
+    spr_register_kvm(env, SPR_BOOK3S_PMC8, "PMC8",
+                     SPR_NOACCESS, SPR_NOACCESS,
+                     &spr_read_generic, &spr_write_generic,
+                     KVM_REG_PPC_PMC8, 0x00000000);
+    /* XXX : not implemented */
+    spr_register(env, SPR_BOOK3S_UPMC7, "UPMC7",
+                 &spr_read_ureg, SPR_NOACCESS,
+                 &spr_read_ureg, SPR_NOACCESS,
+                 0x00000000);
+    /* XXX : not implemented */
+    spr_register(env, SPR_BOOK3S_UPMC8, "UPMC8",
+                 &spr_read_ureg, SPR_NOACCESS,
+                 &spr_read_ureg, SPR_NOACCESS,
+                 0x00000000);
+}
+
+static void init_proc_970 (CPUPPCState *env)
+{
+    gen_spr_ne_601(env);
+    gen_spr_book3s(env);
+    gen_spr_970(env);
+    /* Time base */
+    gen_tbl(env);
     /* Memory management */
     /* XXX: not correct */
     gen_low_BATs(env);
-    spr_register(env, SPR_HIOR, "SPR_HIOR",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_hior, &spr_write_hior,
-                 0x00000000);
 #if !defined(CONFIG_USER_ONLY)
     env->slb_nr = 32;
 #endif
@@ -6831,31 +6859,12 @@ static void init_proc_970FX (CPUPPCState *env)
 {
     gen_spr_ne_601(env);
     gen_spr_book3s(env);
+    gen_spr_970(env);
     /* Time base */
     gen_tbl(env);
-    /* Hardware implementation registers */
-    /* XXX : not implemented */
-    spr_register(env, SPR_HID0, "HID0",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_clear,
-                 0x60000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_HID1, "HID1",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_970_HID5, "HID5",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 POWERPC970_HID5_INIT);
     /* Memory management */
     /* XXX: not correct */
     gen_low_BATs(env);
-    spr_register(env, SPR_HIOR, "SPR_HIOR",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_hior, &spr_write_hior,
-                 0x00000000);
     spr_register(env, SPR_CTRL, "SPR_CTRL",
                  SPR_NOACCESS, SPR_NOACCESS,
                  SPR_NOACCESS, &spr_write_generic,
@@ -6923,32 +6932,12 @@ static void init_proc_970MP (CPUPPCState *env)
 {
     gen_spr_ne_601(env);
     gen_spr_book3s(env);
+    gen_spr_970(env);
     /* Time base */
     gen_tbl(env);
-    /* Hardware implementation registers */
-    /* XXX : not implemented */
-    spr_register(env, SPR_HID0, "HID0",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_clear,
-                 0x60000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_HID1, "HID1",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_970_HID5, "HID5",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 POWERPC970_HID5_INIT);
-    /* XXX : not implemented */
     /* Memory management */
     /* XXX: not correct */
     gen_low_BATs(env);
-    spr_register(env, SPR_HIOR, "SPR_HIOR",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_hior, &spr_write_hior,
-                 0x00000000);
     /* Logical partitionning */
     spr_register_kvm(env, SPR_LPCR, "LPCR",
                      SPR_NOACCESS, SPR_NOACCESS,
Signature · 1 line
Alexey
#8 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 6/6] target-ppc: Add PMC7/8 to 970

Am 27.03.2014 14:03, schrieb Alexey Kardashevskiy:

Quoted 29 lines · Anton Blanchard
Quoted 14 lines

970 CPUs have PMC7/8. Create gen_spr_970 to avoid replicating it 3 times, and simplify the existing code.

---
 target-ppc/translate_init.c | 89 ++++++++++++++++++++-------------------------
 1 file changed, 39 insertions(+), 50 deletions(-)
target-ppc/translate_init.c +0 -0
index 273e37d..50b2603 100644
@@ -6747,12 +6747,13 @@ static void gen_spr_book3s (CPUPPCState *env)
                  0x00000000);

target-ppc/translate_init.c static void gen_spr_book3s (CPUPPCState *env) · line 6752

Quoted 10 lines
target-ppc/translate_init.c +2 -5
 }
 
-static void init_proc_970 (CPUPPCState *env)
+static void gen_spr_970 (CPUPPCState *env)
 {
-    gen_spr_ne_601(env);
-    gen_spr_book3s(env);
-    /* Time base */
-    gen_tbl(env);
+    spr_register(env, SPR_HIOR, "SPR_HIOR",

+ spr_register(env, SPR_HIOR, "HIOR",

Quoted 1 line

Can we please not add SPR_ in string name? Thanks.

As far I see, this is only being moved around, not added here.

If this is not user ABI, feel free to first drop it, then move it. Similarly, adding the new ones in a third step would make review and bisection easier.

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#10 lore raw
In reply to Anton Blanchard
Quoted 2 lines · Anton Blanchard

Add MSR_LE to the msr_mask for POWER8.

<snip>

target-ppc/translate_init.c POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) · line 7178

Quoted 2 lines
target-ppc/translate_init.c +1 -1
-    pcc->msr_mask = 0x800000000284FF36ULL;
+    pcc->msr_mask = 0x800000000284FF37ULL;

<snip>

Should we be adding some #define's for the various bit positions on this mask? Looking at the current code it looks like a big ream of magic numbers.

Cheers,

Signature · 1 line
Alex Bennée
#11 lore raw

Am 25.03.2014 08:29, schrieb Alex Bennée:

Quoted 5 lines
Quoted 2 lines · Anton Blanchard

Add MSR_LE to the msr_mask for POWER8.

Quoted 8 lines

<snip>

target-ppc/translate_init.c POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) · line 7178

Quoted 2 lines
target-ppc/translate_init.c +1 -1
-    pcc->msr_mask = 0x800000000284FF36ULL;
+    pcc->msr_mask = 0x800000000284FF37ULL;

<snip>

Should we be adding some #define's for the various bit positions on this mask? Looking at the current code it looks like a big ream of magic numbers.

In general I concur that defines would be nice, however for 2.0 that's too risky for me as temporary maintainer and I'm not sure if these values are being pieced together by contributors or whether this is coming directly from the manual?

The other issue has been that adding a new family, even after the initial round of cleanups, still requires a chunk of code to be copied, which seems prone to forgetting little bits on the new one, then maybe fixing up the original template but not the derived models, etc.

Cheers,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#12 lore raw
Quoted 11 lines · Andreas Färber

Am 25.03.2014 08:29, schrieb Alex Bennée:

Quoted 10 lines
Quoted 2 lines · Anton Blanchard

Add MSR_LE to the msr_mask for POWER8.

<snip>

Quoted 2 lines
target-ppc/translate_init.c +1 -1
-    pcc->msr_mask = 0x800000000284FF36ULL;
+    pcc->msr_mask = 0x800000000284FF37ULL;

<snip>

Quoted 8 lines
Quoted 3 lines

Should we be adding some #define's for the various bit positions on this mask? Looking at the current code it looks like a big ream of magic numbers.

In general I concur that defines would be nice, however for 2.0 that's too risky for me as temporary maintainer and I'm not sure if these values are being pieced together by contributors or whether this is coming directly from the manual?

There are defines in target-ppc/cpu.h that identify the bit position. So something like this could/should be done (in 2.1):

    pcc->msr_mask =
        (1ULL << MSR_SF) |
        (1ULL << MSR_TAG) |
        (1ULL << MSR_ISF) |
        (1ULL << MSR_DR /* MISSING */ ) |
        (1ULL << MSR_IR /* MISSING */ ) |
        (1ULL << MSR_FE1 /* MISSING */ ) |
        (1ULL << MSR_BE /* MISSING */ ) |
        (1ULL << MSR_ME /* MISSING */ ) |
        (1ULL << MSR_SE /* MISSING */ ) |
        (1ULL << MSR_FE0 /* MISSING */ ) |
        (1ULL << MSR_FP /* MISSING */ ) |
        (1ULL << MSR_PR /* MISSING */ ) |
        (1ULL << MSR_EE /* MISSING */ );

The set of defines is incomplete -- the items marked MISSING are not currently there. They could, of course, easily be added.

Unfortunately, this behavior has been repeated over 50 times in the target-ppc/translate_init.c file and some MSR bit positions have multiple meanings based on processor family and era. So a thorough and accurate cleanup would provide a nice challenge :)

I'm willing to tackle this after I get done with some decimal floating point work (probably 2 weeks).

Quoted 4 lines

The other issue has been that adding a new family, even after the initial round of cleanups, still requires a chunk of code to be copied, which seems prone to forgetting little bits on the new one, then maybe fixing up the original template but not the derived models, etc.

#13 lore raw
In reply to Anton Blanchard

Hi Anton,

Am 25.03.2014 03:40, schrieb Anton Blanchard:

Quoted 4 lines

Add MSR_LE to the msr_mask for POWER8.

Something went wrong here - you're sending patches without placing your Sob last, which breaks the DCO chain. Cédric indicated to me on IRC to use Reviewed-by and/or Tested-by for him, fixed.

Please remember to include a cover letter next time.

I've picked up patches 1-4 for 2.0, tweaking two of the commit messages:
https://github.com/afaerber/qemu-cpu/commits/ppc-next

The SPR patches were too big for me to review right now, and it was not clear to me from commit messages what those patches were fixing (test case).

Thanks,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg