Skip to contentSkip to conversation

Honor CPU_DUMP_FPU

GIT PULL Applied Richard Henderson 2 participants 10 messages May 18, 2018 – May 21, 2018 RISC-V

lore
Share & tools
lore
#0 lore raw

With Peter's new patch for "-d fpu", it makes sense to honor this setting in as many targets as currently dump the fpu.

r~

The following changes since commit 5bcf917ee37a5efbef99f091a96db54a5276becb:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180518' into staging (2018-05-18 18:25:29 +0100)

are available in the Git repository at:

https://github.com/rth7680/qemu.git tags/pull-fpu-20180518

for you to fetch changes up to f29c0b170fa9e0568f2d02e764e18b00cad3a27f:

target/xtensa: Honor CPU_DUMP_FPU (2018-05-18 14:52:38 -0700)

----------------------------------------------------------------
Honor CPU_DUMP_FPU

----------------------------------------------------------------
Richard Henderson (8):
target/alpha: Honor CPU_DUMP_FPU
target/mips: Honor CPU_DUMP_FPU
target/ppc: Honor CPU_DUMP_FPU
target/riscv: Honor CPU_DUMP_FPU
target/s390x: Honor CPU_DUMP_FPU
target/sparc: Honor CPU_DUMP_FPU
target/unicore32: Honor CPU_DUMP_FPU
target/xtensa: Honor CPU_DUMP_FPU

 target/alpha/helper.c        | 17 ++++++++---------
 target/mips/translate.c      |  3 ++-
 target/ppc/translate.c       | 20 +++++++++++++-------
 target/riscv/cpu.c           | 12 +++++++-----
 target/s390x/helper.c        | 23 ++++++++++++-----------
 target/sparc/cpu.c           | 17 ++++++++++-------
 target/unicore32/translate.c |  4 +++-
 target/xtensa/translate.c    |  3 ++-
 8 files changed, 57 insertions(+), 42 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/8] target/alpha: Honor CPU_DUMP_FPU

---
 target/alpha/helper.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
target/alpha/helper.c +8 -9
index 8a6a948572..57e2c212b3 100644
@@ -442,20 +442,19 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
     cpu_fprintf(f, "     PC  " TARGET_FMT_lx "      PS  %02x\n",
                 env->pc, extract32(env->flags, ENV_FLAG_PS_SHIFT, 8));
     for (i = 0; i < 31; i++) {
-        cpu_fprintf(f, "IR%02d %s " TARGET_FMT_lx " ", i,
-                    linux_reg_names[i], cpu_alpha_load_gr(env, i));
-        if ((i % 3) == 2)
-            cpu_fprintf(f, "\n");
+        cpu_fprintf(f, "IR%02d %s " TARGET_FMT_lx "%c", i,
+                    linux_reg_names[i], cpu_alpha_load_gr(env, i),
+                    (i % 3) == 2 ? '\n' : ' ');
     }
 
     cpu_fprintf(f, "lock_a   " TARGET_FMT_lx " lock_v   " TARGET_FMT_lx "\n",
                 env->lock_addr, env->lock_value);
 
-    for (i = 0; i < 31; i++) {
-        cpu_fprintf(f, "FIR%02d    " TARGET_FMT_lx " ", i,
-                    *((uint64_t *)(&env->fir[i])));
-        if ((i % 3) == 2)
-            cpu_fprintf(f, "\n");
+    if (flags & CPU_DUMP_FPU) {
+        for (i = 0; i < 31; i++) {
+            cpu_fprintf(f, "FIR%02d    %016" PRIx64 "%c", i, env->fir[i],
+                        (i % 3) == 2 ? '\n' : ' ');
+        }
     }
     cpu_fprintf(f, "\n");
 }
Signature · 1 line
2.17.0
#2 lore raw

[Qemu-devel] [PULL 2/8] target/mips: Honor CPU_DUMP_FPU

In reply to Richard Henderson
---
 target/mips/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
target/mips/translate.c +2 -1
index f1c1fdd35c..e88f983ae7 100644
@@ -20446,8 +20446,9 @@ void mips_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
                 env->CP0_Config2, env->CP0_Config3);
     cpu_fprintf(f, "    Config4 0x%08x Config5 0x%08x\n",
                 env->CP0_Config4, env->CP0_Config5);
-    if (env->hflags & MIPS_HFLAG_FPU)
+    if ((flags & CPU_DUMP_FPU) && (env->hflags & MIPS_HFLAG_FPU)) {
         fpu_dump_state(env, f, cpu_fprintf, flags);
+    }
 }
 
 void mips_tcg_init(void)
Signature · 1 line
2.17.0
#3 lore raw

[Qemu-devel] [PULL 3/8] target/ppc: Honor CPU_DUMP_FPU

In reply to Richard Henderson
---
 target/ppc/translate.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
target/ppc/translate.c +13 -7
index d5e5f953da..e30d99fcbc 100644
@@ -7048,14 +7048,20 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
     }
     cpu_fprintf(f, " ]             RES " TARGET_FMT_lx "\n",
                 env->reserve_addr);
-    for (i = 0; i < 32; i++) {
-        if ((i & (RFPL - 1)) == 0)
-            cpu_fprintf(f, "FPR%02d", i);
-        cpu_fprintf(f, " %016" PRIx64, *((uint64_t *)&env->fpr[i]));
-        if ((i & (RFPL - 1)) == (RFPL - 1))
-            cpu_fprintf(f, "\n");
+
+    if (flags & CPU_DUMP_FPU) {
+        for (i = 0; i < 32; i++) {
+            if ((i & (RFPL - 1)) == 0) {
+                cpu_fprintf(f, "FPR%02d", i);
+            }
+            cpu_fprintf(f, " %016" PRIx64, *((uint64_t *)&env->fpr[i]));
+            if ((i & (RFPL - 1)) == (RFPL - 1)) {
+                cpu_fprintf(f, "\n");
+            }
+        }
+        cpu_fprintf(f, "FPSCR " TARGET_FMT_lx "\n", env->fpscr);
     }
-    cpu_fprintf(f, "FPSCR " TARGET_FMT_lx "\n", env->fpscr);
+
 #if !defined(CONFIG_USER_ONLY)
     cpu_fprintf(f, " SRR0 " TARGET_FMT_lx "  SRR1 " TARGET_FMT_lx
                    "    PVR " TARGET_FMT_lx " VRSAVE " TARGET_FMT_lx "\n",
Signature · 1 line
2.17.0
#4 lore raw

[Qemu-devel] [PULL 4/8] target/riscv: Honor CPU_DUMP_FPU

In reply to Richard Henderson
---
 target/riscv/cpu.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
target/riscv/cpu.c +7 -5
index 4e5a56d4e3..d630e8fd6c 100644
@@ -219,11 +219,13 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f,
             cpu_fprintf(f, "\n");
         }
     }
-    for (i = 0; i < 32; i++) {
-        cpu_fprintf(f, " %s %016" PRIx64,
-            riscv_fpr_regnames[i], env->fpr[i]);
-        if ((i & 3) == 3) {
-            cpu_fprintf(f, "\n");
+    if (flags & CPU_DUMP_FPU) {
+        for (i = 0; i < 32; i++) {
+            cpu_fprintf(f, " %s %016" PRIx64,
+                riscv_fpr_regnames[i], env->fpr[i]);
+            if ((i & 3) == 3) {
+                cpu_fprintf(f, "\n");
+            }
         }
     }
 }
Signature · 1 line
2.17.0
#5 lore raw

[Qemu-devel] [PULL 5/8] target/s390x: Honor CPU_DUMP_FPU

In reply to Richard Henderson

Also do not dump both "fpu" and "vector" registers as the former overlaps the latter.

---
 target/s390x/helper.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)
target/s390x/helper.c +12 -11
index e8548f340a..fd5791f134 100644
@@ -327,21 +327,22 @@ void s390_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
         }
     }
 
-    for (i = 0; i < 16; i++) {
-        cpu_fprintf(f, "F%02d=%016" PRIx64, i, get_freg(env, i)->ll);
-        if ((i % 4) == 3) {
-            cpu_fprintf(f, "\n");
+    if (flags & CPU_DUMP_FPU) {
+        if (s390_has_feat(S390_FEAT_VECTOR)) {
+            for (i = 0; i < 32; i++) {
+                cpu_fprintf(f, "V%02d=%016" PRIx64 "%016" PRIx64 "%c",
+                            i, env->vregs[i][0].ll, env->vregs[i][1].ll,
+                            i % 2 ? '\n' : ' ');
+            }
         } else {
-            cpu_fprintf(f, " ");
+            for (i = 0; i < 16; i++) {
+                cpu_fprintf(f, "F%02d=%016" PRIx64 "%c",
+                            i, get_freg(env, i)->ll,
+                            (i % 4) == 3 ? '\n' : ' ');
+            }
         }
     }
 
-    for (i = 0; i < 32; i++) {
-        cpu_fprintf(f, "V%02d=%016" PRIx64 "%016" PRIx64, i,
-                    env->vregs[i][0].ll, env->vregs[i][1].ll);
-        cpu_fprintf(f, (i % 2) ? "\n" : " ");
-    }
-
 #ifndef CONFIG_USER_ONLY
     for (i = 0; i < 16; i++) {
         cpu_fprintf(f, "C%02d=%016" PRIx64, i, env->cregs[i]);
Signature · 1 line
2.17.0
#6 lore raw

[Qemu-devel] [PULL 6/8] target/sparc: Honor CPU_DUMP_FPU

In reply to Richard Henderson
---
 target/sparc/cpu.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
target/sparc/cpu.c +10 -7
index ff6ed91f9a..0f090ece54 100644
@@ -647,15 +647,18 @@ void sparc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
         }
     }
 
-    for (i = 0; i < TARGET_DPREGS; i++) {
-        if ((i & 3) == 0) {
-            cpu_fprintf(f, "%%f%02d: ", i * 2);
-        }
-        cpu_fprintf(f, " %016" PRIx64, env->fpr[i].ll);
-        if ((i & 3) == 3) {
-            cpu_fprintf(f, "\n");
+    if (flags & CPU_DUMP_FPU) {
+        for (i = 0; i < TARGET_DPREGS; i++) {
+            if ((i & 3) == 0) {
+                cpu_fprintf(f, "%%f%02d: ", i * 2);
+            }
+            cpu_fprintf(f, " %016" PRIx64, env->fpr[i].ll);
+            if ((i & 3) == 3) {
+                cpu_fprintf(f, "\n");
+            }
         }
     }
+
 #ifdef TARGET_SPARC64
     cpu_fprintf(f, "pstate: %08x ccr: %02x (icc: ", env->pstate,
                 (unsigned)cpu_get_ccr(env));
Signature · 1 line
2.17.0
#7 lore raw

[Qemu-devel] [PULL 7/8] target/unicore32: Honor CPU_DUMP_FPU

In reply to Richard Henderson
---
 target/unicore32/translate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
target/unicore32/translate.c +3 -1
index abe2ea8592..3cae111955 100644
@@ -2101,7 +2101,9 @@ void uc32_cpu_dump_state(CPUState *cs, FILE *f,
                 psr & (1 << 28) ? 'V' : '-',
                 cpu_mode_names[psr & 0xf]);
 
-    cpu_dump_state_ucf64(env, f, cpu_fprintf, flags);
+    if (flags & CPU_DUMP_FPU) {
+        cpu_dump_state_ucf64(env, f, cpu_fprintf, flags);
+    }
 }
 
 void restore_state_to_opc(CPUUniCore32State *env, TranslationBlock *tb,
Signature · 1 line
2.17.0
#8 lore raw

[Qemu-devel] [PULL 8/8] target/xtensa: Honor CPU_DUMP_FPU

In reply to Richard Henderson
---
 target/xtensa/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
target/xtensa/translate.c +2 -1
index ae0feb0254..53f6f5db8f 100644
@@ -1243,7 +1243,8 @@ void xtensa_cpu_dump_state(CPUState *cs, FILE *f,
         }
     }
 
-    if (xtensa_option_enabled(env->config, XTENSA_OPTION_FP_COPROCESSOR)) {
+    if ((flags & CPU_DUMP_FPU) &&
+        xtensa_option_enabled(env->config, XTENSA_OPTION_FP_COPROCESSOR)) {
         cpu_fprintf(f, "\n");
 
         for (i = 0; i < 16; ++i) {
Signature · 1 line
2.17.0
#9 lore raw
In reply to Richard Henderson
Quoted 13 lines · Richard Henderson

With Peter's new patch for "-d fpu", it makes sense to honor this setting in as many targets as currently dump the fpu.

r~

The following changes since commit 5bcf917ee37a5efbef99f091a96db54a5276becb:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180518' into staging (2018-05-18 18:25:29 +0100)

are available in the Git repository at:

Quoted 8 lines

https://github.com/rth7680/qemu.git tags/pull-fpu-20180518

for you to fetch changes up to f29c0b170fa9e0568f2d02e764e18b00cad3a27f:

target/xtensa: Honor CPU_DUMP_FPU (2018-05-18 14:52:38 -0700)

----------------------------------------------------------------
Honor CPU_DUMP_FPU

Applied, thanks.

-- PMM