Skip to contentSkip to conversation

target/riscv: silent warnings about Smdbltrp/Smrnmi being disabled

PATCH Superseded Clément Léger 3 participants 4 messages Feb 13, 2025 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/riscv: silent warnings about Smdbltrp/Smrnmi being disabled

As raised by Richard Henderson, these warnings are displayed in user only as well. Disable them for CONFIG_USER_ONLY.

---
 target/riscv/tcg/tcg-cpu.c | 4 ++++
 1 file changed, 4 insertions(+)
target/riscv/tcg/tcg-cpu.c +4 -0
index 0a137281de..4d0d16576d 100644
@@ -1437,7 +1437,9 @@ static void riscv_init_max_cpu_extensions(Object *obj)
      */
     if (cpu->cfg.ext_smrnmi) {
         isa_ext_update_enabled(cpu, CPU_CFG_OFFSET(ext_smrnmi), false);
+#ifndef CONFIG_USER_ONLY
         qemu_log("Smrnmi is disabled in the 'max' type CPU\n");
+#endif
     }
 
     /*
@@ -1447,7 +1449,9 @@ static void riscv_init_max_cpu_extensions(Object *obj)
      */
     if (cpu->cfg.ext_smdbltrp) {
         isa_ext_update_enabled(cpu, CPU_CFG_OFFSET(ext_smdbltrp), false);
+#ifndef CONFIG_USER_ONLY
         qemu_log("Smdbltrp is disabled in the 'max' type CPU\n");
+#endif
     }
 }
 
Signature · 1 line
2.47.2
#1 lore raw
Quoted 5 lines · Clément Léger

As raised by Richard Henderson, these warnings are displayed in user only as well. Disable them for CONFIG_USER_ONLY.

---

I'm second guessing having these warnings at all.

Sure they serve as a warning for us, developers, that something needs to be revisited (e.g. after an OpenSBI update). However it will degrade user experience with warnings related to something out of the user control.

Instead of adding CONFIG_USER_ONLY gates for these warnings I believe we're better of removing them. We can add TODO/FIXME tags in the code if there's something that we need to revisit at a later time.

Thanks,

Daniel

Quoted 27 lines
  target/riscv/tcg/tcg-cpu.c | 4 ++++
  1 file changed, 4 insertions(+)
target/riscv/tcg/tcg-cpu.c +4 -0
index 0a137281de..4d0d16576d 100644
@@ -1437,7 +1437,9 @@ static void riscv_init_max_cpu_extensions(Object *obj)
       */
      if (cpu->cfg.ext_smrnmi) {
          isa_ext_update_enabled(cpu, CPU_CFG_OFFSET(ext_smrnmi), false);
+#ifndef CONFIG_USER_ONLY
          qemu_log("Smrnmi is disabled in the 'max' type CPU\n");
+#endif
      }
 
      /*
@@ -1447,7 +1449,9 @@ static void riscv_init_max_cpu_extensions(Object *obj)
       */
      if (cpu->cfg.ext_smdbltrp) {
          isa_ext_update_enabled(cpu, CPU_CFG_OFFSET(ext_smdbltrp), false);
+#ifndef CONFIG_USER_ONLY
          qemu_log("Smdbltrp is disabled in the 'max' type CPU\n");
+#endif
      }
  }
 
#2 lore raw
Quoted 11 lines · Daniel Henrique Barboza
Quoted 5 lines · Clément Léger

As raised by Richard Henderson, these warnings are displayed in user only as well. Disable them for CONFIG_USER_ONLY.

---

I'm second guessing having these warnings at all.

Quoted 7 lines

Sure they serve as a warning for us, developers, that something needs to be revisited (e.g. after an OpenSBI update). However it will degrade user experience with warnings related to something out of the user control.

Instead of adding CONFIG_USER_ONLY gates for these warnings I believe we're better of removing them. We can add TODO/FIXME tags in the code if there's something that we need to revisit at a later time.

Hi Daniel,

Agreed, I'll add some TODO comment and remove these warnings then.

Thanks,

Clément

Quoted 37 lines

Thanks,

Daniel

Quoted 29 lines

  target/riscv/tcg/tcg-cpu.c | 4 ++++

  1 file changed, 4 insertions(+)
target/riscv/tcg/tcg-cpu.c +4 -0
index 0a137281de..4d0d16576d 100644
@@ -1437,7 +1437,9 @@ static void riscv_init_max_cpu_extensions(Object
 *obj)
        */
       if (cpu->cfg.ext_smrnmi) {
           isa_ext_update_enabled(cpu, CPU_CFG_OFFSET(ext_smrnmi), false);
+#ifndef CONFIG_USER_ONLY
           qemu_log("Smrnmi is disabled in the 'max' type CPU\n");
+#endif
       }
         /*
@@ -1447,7 +1449,9 @@ static void riscv_init_max_cpu_extensions(Object
 *obj)
        */
       if (cpu->cfg.ext_smdbltrp) {
           isa_ext_update_enabled(cpu, CPU_CFG_OFFSET(ext_smdbltrp),
 false);
+#ifndef CONFIG_USER_ONLY
           qemu_log("Smdbltrp is disabled in the 'max' type CPU\n");
+#endif
       }

  }

#3 lore raw
In reply to Daniel Henrique Barboza
Quoted 11 lines · Daniel Henrique Barboza
Quoted 5 lines · Clément Léger

As raised by Richard Henderson, these warnings are displayed in user only as well. Disable them for CONFIG_USER_ONLY.

---

I'm second guessing having these warnings at all.

Quoted 7 lines

Sure they serve as a warning for us, developers, that something needs to be revisited (e.g. after an OpenSBI update). However it will degrade user experience with warnings related to something out of the user control.

Instead of adding CONFIG_USER_ONLY gates for these warnings I believe we're better of removing them. We can add TODO/FIXME tags in the code if there's something that we need to revisit at a later time.

You can also convert them to trace events, which are less invasive, or warn_report(). But IIUC this case I agree a comment is good enough.

Quoted 8 lines

Thanks,

Daniel

Quoted 3 lines

  target/riscv/tcg/tcg-cpu.c | 4 ++++

  1 file changed, 4 insertions(+)