Skip to contentSkip to conversation

riscv: reset after crash

PATCH Superseded Heinrich Schuchardt 2 participants 3 messages Sep 26, 2020 RISC-V

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: reset after crash

If an exception occurs on ARM or x86, we call panic() which will try to reset the board. Do the same on RISC-V.

---
 arch/riscv/lib/interrupts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/lib/interrupts.c +1 -1
index 8ff40f0f36..f95cb97f92 100644
@@ -84,7 +84,7 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs)
 
 	show_regs(regs);
 	show_efi_loaded_images(epc);
-	hang();
+	panic ("Resetting CPU ...\n");
 }
 
 int interrupt_init(void)

--
2.28.0

#1 lore raw

PATCH 1/1 riscv: reset after crash

Quoted 13 lines · Heinrich Schuchardt

If an exception occurs on ARM or x86, we call panic() which will try to reset the board. Do the same on RISC-V.

---
 arch/riscv/lib/interrupts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/lib/interrupts.c +0 -0
index 8ff40f0f36..f95cb97f92 100644

arch/riscv/lib/interrupts.c static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs) · line 87

Quoted 5 lines
arch/riscv/lib/interrupts.c +1 -1
@@ -84,7 +84,7 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs)
 
 	show_regs(regs);
 	show_efi_loaded_images(epc);
-	hang();
+	panic ("Resetting CPU ...\n");

Nits: no space before parentheses.

Do we need a message here? do_panic already prints "resetting...".

--Sean

#2 lore raw

PATCH 1/1 riscv: reset after crash

Quoted 15 lines · Sean Anderson
Quoted 14 lines · Heinrich Schuchardt

If an exception occurs on ARM or x86, we call panic() which will try to reset the board. Do the same on RISC-V.

---
 arch/riscv/lib/interrupts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/lib/interrupts.c +0 -0
index 8ff40f0f36..f95cb97f92 100644
@@ -84,7 +84,7 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs)
 
Quoted 8 lines

arch/riscv/lib/interrupts.c static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs) · line 87

Quoted 4 lines
arch/riscv/lib/interrupts.c +1 -1
 	show_regs(regs);
 	show_efi_loaded_images(epc);
-	hang();
+	panic ("Resetting CPU ...\n");

Nits: no space before parentheses.

Do we need a message here? do_panic already prints "resetting...".

May be I should not have blindly copied from ARM.

With CONFIG_PANIC_HANG=y the next message will be:

### ERROR ### Please RESET the board ###

"resetting..." is printed by the respective implementation of do_reset() depending on the value of CONFIG_SYSRESET=y.

As on all three passways we have a follow up message, passing an empty string "" to panic() should be enough.

Best regards

Heinrich