diff mbox series

[3/5,RISCV_PM] Print new PM CSRs in QEMU logs

Message ID 20201014170159.26932-4-space.monkey.delivers@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/5,RISCV_PM] Add J-extension into RISC-V | expand

Commit Message

Alexey Baturo Oct. 14, 2020, 5:01 p.m. UTC
Signed-off-by: Alexey Baturo <space.monkey.delivers@gmail.com>
---
 target/riscv/cpu.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Richard Henderson Oct. 14, 2020, 6:41 p.m. UTC | #1
On 10/14/20 10:01 AM, Alexey Baturo wrote:
> +    if (riscv_has_ext(env, RVH)) {

RVJ.

> +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mmte    ", env->mmte);
> +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "upmbase ", env->upmbase);
> +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "spmbase ", env->spmbase);
> +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mpmbase ", env->mpmbase);
> +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "upmmask ", env->upmmask);
> +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "spmmask ", env->spmmask);
> +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mpmmask ", env->mpmmask);

Probably you only want to dump the set that's current.


r~
Alexey Baturo Oct. 14, 2020, 8:01 p.m. UTC | #2
First of all thank you so much for reviewing these patches!

>RVJ.
Thanks, I missed this typo, will fix it.

>Probably you only want to dump the set that's current.
I don't know for sure how anyone would be using this while debugging PM
related code, but I like the idea, so I'll try to do it, thanks!

ср, 14 окт. 2020 г. в 21:41, Richard Henderson <richard.henderson@linaro.org
>:

> On 10/14/20 10:01 AM, Alexey Baturo wrote:
> > +    if (riscv_has_ext(env, RVH)) {
>
> RVJ.
>
> > +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mmte    ",
> env->mmte);
> > +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "upmbase ",
> env->upmbase);
> > +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "spmbase ",
> env->spmbase);
> > +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mpmbase ",
> env->mpmbase);
> > +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "upmmask ",
> env->upmmask);
> > +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "spmmask ",
> env->spmmask);
> > +        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mpmmask ",
> env->mpmmask);
>
> Probably you only want to dump the set that's current.
>
>
> r~
>
diff mbox series

Patch

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index d63031eb08..8f8ee4d29c 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -255,6 +255,15 @@  static void riscv_cpu_dump_state(CPUState *cs, FILE *f, int flags)
         qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "htval ", env->htval);
         qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mtval2 ", env->mtval2);
     }
+    if (riscv_has_ext(env, RVH)) {
+        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mmte    ", env->mmte);
+        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "upmbase ", env->upmbase);
+        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "spmbase ", env->spmbase);
+        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mpmbase ", env->mpmbase);
+        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "upmmask ", env->upmmask);
+        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "spmmask ", env->spmmask);
+        qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mpmmask ", env->mpmmask);
+    }
 #endif
 
     for (i = 0; i < 32; i++) {