[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] riscv: disable Smdbltrp for the max cpu
From: |
Clément Léger |
Subject: |
[PATCH] riscv: disable Smdbltrp for the max cpu |
Date: |
Thu, 16 Jan 2025 10:23:45 +0100 |
When present, Smdbltrp is enabled by default and MDT needs to be cleared
to avoid generating a double trap. Since not all firmwares are currently
ready to handle that, disable it for the max cpu.
Reported-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Clément Léger <cleger@rivosinc.com>
---
target/riscv/tcg/tcg-cpu.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
index 48be24bbbe..0a137281de 100644
--- a/target/riscv/tcg/tcg-cpu.c
+++ b/target/riscv/tcg/tcg-cpu.c
@@ -1439,6 +1439,16 @@ static void riscv_init_max_cpu_extensions(Object *obj)
isa_ext_update_enabled(cpu, CPU_CFG_OFFSET(ext_smrnmi), false);
qemu_log("Smrnmi is disabled in the 'max' type CPU\n");
}
+
+ /*
+ * ext_smdbltrp requires the firmware to clear MSTATUS.MDT on startup to
+ * avoid generating a double trap. OpenSBI does not currently support it,
+ * disable it for now.
+ */
+ if (cpu->cfg.ext_smdbltrp) {
+ isa_ext_update_enabled(cpu, CPU_CFG_OFFSET(ext_smdbltrp), false);
+ qemu_log("Smdbltrp is disabled in the 'max' type CPU\n");
+ }
}
static bool riscv_cpu_has_max_extensions(Object *cpu_obj)
--
2.47.1
- [PATCH] riscv: disable Smdbltrp for the max cpu,
Clément Léger <=