All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] riscv: show registers in crash dumps by default
@ 2024-08-11 11:01 Heinrich Schuchardt
  2024-08-11 11:01 ` [PATCH 1/2] riscv: allow to enable SHOW_REGS in main U-Boot only Heinrich Schuchardt
  2024-08-11 11:01 ` [PATCH 2/2] riscv: show registers in crash dumps by default Heinrich Schuchardt
  0 siblings, 2 replies; 5+ messages in thread
From: Heinrich Schuchardt @ 2024-08-11 11:01 UTC (permalink / raw)
  To: Rick Chen, Leo, Kongyang Liu, Randolph, Michal Simek,
	Łukasz Stelmach, Yu Chien Peter Lin, Ben Dooks,
	Samuel Holland, Dan Carpenter, u-boot
  Cc: Heinrich Schuchardt

To minimize SPL size it is reasonable to disable SHOW_REGS. For main U-Boot
the size restrictions are much more relaxed.

* Provide separate Kconfig symbols for SPL and main U-Boot.
* Enable showing registers in main U-Boot by default.

Heinrich Schuchardt (2):
  riscv: allow to enable SHOW_REGS in main U-Boot only
  riscv: enable showing registers by default

 arch/riscv/Kconfig          | 13 +++++++++++++
 arch/riscv/lib/interrupts.c |  7 +++----
 2 files changed, 16 insertions(+), 4 deletions(-)

-- 
2.45.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] riscv: allow to enable SHOW_REGS in main U-Boot only
  2024-08-11 11:01 [PATCH 0/2] riscv: show registers in crash dumps by default Heinrich Schuchardt
@ 2024-08-11 11:01 ` Heinrich Schuchardt
  2024-08-13  3:26   ` Leo Liang
  2024-08-11 11:01 ` [PATCH 2/2] riscv: show registers in crash dumps by default Heinrich Schuchardt
  1 sibling, 1 reply; 5+ messages in thread
From: Heinrich Schuchardt @ 2024-08-11 11:01 UTC (permalink / raw)
  To: Rick Chen, Leo, Kongyang Liu, Randolph, Michal Simek,
	Łukasz Stelmach, Yu Chien Peter Lin, Ben Dooks,
	Samuel Holland, Dan Carpenter, u-boot
  Cc: Heinrich Schuchardt

To minimize SPL size it is reasonable to disable SHOW_REGS. For main U-Boot
the size restrictions are much more relaxed.

* Provide separate Kconfig symbols for SPL and main U-Boot.
* Add a help text.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 arch/riscv/Kconfig          | 12 ++++++++++++
 arch/riscv/lib/interrupts.c |  7 +++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index fa3b016c527..66cd512b23f 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -438,6 +438,18 @@ config AVAILABLE_HARTS
 
 config SHOW_REGS
 	bool "Show registers on unhandled exception"
+	help
+	  By default only the program counter and the return address register
+	  are shown in crash dumps. Enable this symbol to show all registers in
+	  main U-Boot.
+
+config SPL_SHOW_REGS
+	bool "In SPL show registers on unhandled exception"
+	depends on SPL
+	help
+	  By default only the program counter and the return address register
+	  are shown in crash dumps. Enable this symbol to show all registers in
+	  SPL.
 
 config RISCV_PRIV_1_9
 	bool "Use version 1.9 of the RISC-V priviledged specification"
diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c
index f9a1428a486..714cc92d03e 100644
--- a/arch/riscv/lib/interrupts.c
+++ b/arch/riscv/lib/interrupts.c
@@ -34,9 +34,8 @@ static void show_efi_loaded_images(uintptr_t epc)
 	efi_print_image_infos((void *)epc);
 }
 
-static void show_regs(struct pt_regs *regs)
+static void __maybe_unused show_regs(struct pt_regs *regs)
 {
-#ifdef CONFIG_SHOW_REGS
 	printf("\nSP:  " REG_FMT " GP:  " REG_FMT " TP:  " REG_FMT "\n",
 	       regs->sp, regs->gp, regs->tp);
 	printf("T0:  " REG_FMT " T1:  " REG_FMT " T2:  " REG_FMT "\n",
@@ -57,7 +56,6 @@ static void show_regs(struct pt_regs *regs)
 	       regs->s10, regs->s11, regs->t3);
 	printf("T4:  " REG_FMT " T5:  " REG_FMT " T6:  " REG_FMT "\n",
 	       regs->t4, regs->t5, regs->t6);
-#endif
 }
 
 static void __maybe_unused show_backtrace(struct pt_regs *regs)
@@ -157,7 +155,8 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs)
 		printf("EPC: " REG_FMT " RA: " REG_FMT " reloc adjusted\n",
 		       epc - gd->reloc_off, regs->ra - gd->reloc_off);
 
-	show_regs(regs);
+	if (CONFIG_IS_ENABLED(SHOW_REGS))
+		show_regs(regs);
 	if (CONFIG_IS_ENABLED(FRAMEPOINTER))
 		show_backtrace(regs);
 	show_code(epc);
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] riscv: show registers in crash dumps by default
  2024-08-11 11:01 [PATCH 0/2] riscv: show registers in crash dumps by default Heinrich Schuchardt
  2024-08-11 11:01 ` [PATCH 1/2] riscv: allow to enable SHOW_REGS in main U-Boot only Heinrich Schuchardt
@ 2024-08-11 11:01 ` Heinrich Schuchardt
  2024-08-13  3:26   ` Leo Liang
  1 sibling, 1 reply; 5+ messages in thread
From: Heinrich Schuchardt @ 2024-08-11 11:01 UTC (permalink / raw)
  To: Rick Chen, Leo, Kongyang Liu, Randolph, Michal Simek,
	Łukasz Stelmach, Yu Chien Peter Lin, Ben Dooks,
	Samuel Holland, Dan Carpenter, u-boot
  Cc: Heinrich Schuchardt

If an exception occurs in main U-Boot, show the registers. This makes
analyzing crashes especially in external applications easier.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 arch/riscv/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 66cd512b23f..fc79d4902de 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -437,6 +437,7 @@ config AVAILABLE_HARTS
 	  If disable this, it will send IPI by CPUs node numbers of device tree.
 
 config SHOW_REGS
+	default y
 	bool "Show registers on unhandled exception"
 	help
 	  By default only the program counter and the return address register
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] riscv: allow to enable SHOW_REGS in main U-Boot only
  2024-08-11 11:01 ` [PATCH 1/2] riscv: allow to enable SHOW_REGS in main U-Boot only Heinrich Schuchardt
@ 2024-08-13  3:26   ` Leo Liang
  0 siblings, 0 replies; 5+ messages in thread
From: Leo Liang @ 2024-08-13  3:26 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Rick Chen, Kongyang Liu, Randolph, Michal Simek,
	Łukasz Stelmach, Yu Chien Peter Lin, Ben Dooks,
	Samuel Holland, Dan Carpenter, u-boot

On Sun, Aug 11, 2024 at 01:01:03PM +0200, Heinrich Schuchardt wrote:
> [EXTERNAL MAIL]
> 
> To minimize SPL size it is reasonable to disable SHOW_REGS. For main U-Boot
> the size restrictions are much more relaxed.
> 
> * Provide separate Kconfig symbols for SPL and main U-Boot.
> * Add a help text.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  arch/riscv/Kconfig          | 12 ++++++++++++
>  arch/riscv/lib/interrupts.c |  7 +++----
>  2 files changed, 15 insertions(+), 4 deletions(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] riscv: show registers in crash dumps by default
  2024-08-11 11:01 ` [PATCH 2/2] riscv: show registers in crash dumps by default Heinrich Schuchardt
@ 2024-08-13  3:26   ` Leo Liang
  0 siblings, 0 replies; 5+ messages in thread
From: Leo Liang @ 2024-08-13  3:26 UTC (permalink / raw)
  To: Heinrich Schuchardt
  Cc: Rick Chen, Kongyang Liu, Randolph, Michal Simek,
	Łukasz Stelmach, Yu Chien Peter Lin, Ben Dooks,
	Samuel Holland, Dan Carpenter, u-boot

On Sun, Aug 11, 2024 at 01:01:04PM +0200, Heinrich Schuchardt wrote:
> [EXTERNAL MAIL]
> 
> If an exception occurs in main U-Boot, show the registers. This makes
> analyzing crashes especially in external applications easier.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  arch/riscv/Kconfig | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-13  3:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-11 11:01 [PATCH 0/2] riscv: show registers in crash dumps by default Heinrich Schuchardt
2024-08-11 11:01 ` [PATCH 1/2] riscv: allow to enable SHOW_REGS in main U-Boot only Heinrich Schuchardt
2024-08-13  3:26   ` Leo Liang
2024-08-11 11:01 ` [PATCH 2/2] riscv: show registers in crash dumps by default Heinrich Schuchardt
2024-08-13  3:26   ` Leo Liang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.