Skip to contentSkip to conversation

board_f: Make printing reset information optional

PATCH In review Alexey Charkov 3 participants 4 messages Jul 30 – Aug 14

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board_f: Make printing reset information optional

Current code tries to print information about the reset method whenever sysreset support is enabled. This causes the core to try to bind the sysreset device in board_init_f, even if the driver doesn't support reset status reporting, causing pure waste on some platforms (e.g. on Rockchip RK3576 it increases the boot time by ~0.4s even though the driver doesn't support reset status reporting).

Make the printing of reset information optional, so that it can be enabled only on platforms where it is supported and useful.

Only four sysreset drivers actually implement the get_status() op, so default the new symbol to y wherever one of them can be in use to avoid regressing those platforms:

- sysreset_sandbox
- sysreset_mpc83xx
- sysreset_psci, whose weak stub get_status() is only overridden by i.MX9;
- the pca9450 PMIC sysreset child driver.

---
 common/board_f.c         |  4 ++--
 drivers/sysreset/Kconfig | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)
common/board_f.c +2 -2
index 85b888d4bb85..7d1f80cd7fbf 100644
@@ -122,7 +122,7 @@ static int display_text_info(void)
 	return 0;
 }
 
-#ifdef CONFIG_SYSRESET
+#ifdef CONFIG_SYSRESET_PRINT_RESETINFO
 static int print_resetinfo(void)
 {
 	struct udevice *dev;
@@ -963,7 +963,7 @@ static void initcall_run_f(void)
 	INITCALL(display_options);	/* say that we are here */
 	INITCALL(display_text_info);	/* show debugging info if required */
 	INITCALL(checkcpu);
-#if CONFIG_IS_ENABLED(SYSRESET)
+#if CONFIG_IS_ENABLED(SYSRESET_PRINT_RESETINFO)
 	INITCALL(print_resetinfo);
 #endif
 	/* display cpu info (and speed) */
drivers/sysreset/Kconfig +14 -0
index 16ef434a8d9c..a046dd02e66f 100644
@@ -43,6 +43,20 @@ config VPL_SYSRESET
 
 if SYSRESET
 
+config SYSRESET_PRINT_RESETINFO
+	bool "Print reset information during boot"
+	default y if SANDBOX
+	default y if SYSRESET_MPC83XX
+	default y if SYSRESET_PSCI && ARCH_IMX9
+	default y if DM_PMIC_PCA9450
+	help
+	  Print information about the cause of the last reset during early
+	  boot, as reported by the get_status() method of the sysreset
+	  drivers. This requires probing all sysreset devices in
+	  board_init_f(), which costs boot time, so only enable it if at
+	  least one of the sysreset drivers in use actually implements
+	  get_status().
+
 config SYSRESET_CMD_RESET
 	bool "sysreset implementation of the reset command"
 	default y

---
base-commit: 44f0dcf476140c1077ee3dbe16a80fdb6f8265c4
change-id: 20260730-resetinfo-optional-d2cb4cdf0892

Best regards,

Signature · 1 line
Alexey Charkov <[email protected]>
#1 lore raw

Hi Alexey,

Quoted 17 lines · Alexey Charkov

board_f: Make printing reset information optional

Current code tries to print information about the reset method whenever sysreset support is enabled. This causes the core to try to bind the sysreset device in board_init_f, even if the driver doesn't support reset status reporting, causing pure waste on some platforms (e.g. on Rockchip RK3576 it increases the boot time by ~0.4s even though the driver doesn't support reset status reporting).

Make the printing of reset information optional, so that it can be enabled only on platforms where it is supported and useful.

Only four sysreset drivers actually implement the get_status() op, so default the new symbol to y wherever one of them can be in use to avoid regressing those platforms:

Quoted 4 lines

- sysreset_sandbox
- sysreset_mpc83xx
- sysreset_psci, whose weak stub get_status() is only overridden by i.MX9;
- the pca9450 PMIC sysreset child driver.

This would age better if each driver implementing get_status() opted in from its own Kconfig with 'imply SYSRESET_PRINT_RESETINFO', so the next addition or removal doesn't have to touch this Kconfig too. What do you think?

Quoted 13 lines

- sysreset_sandbox
- sysreset_mpc83xx
- sysreset_psci, whose weak stub get_status() is only overridden by i.MX9;
- the pca9450 PMIC sysreset child driver.
[...]

common/board_f.c | 4 ++--

 drivers/sysreset/Kconfig | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

drivers/sysreset/Kconfig config VPL_SYSRESET · line 48

Quoted 6 lines
drivers/sysreset/Kconfig +6 -0
@@ -43,6 +43,20 @@ config VPL_SYSRESET
+config SYSRESET_PRINT_RESETINFO
+     bool "Print reset information during boot"
+     default y if SANDBOX
+     default y if SYSRESET_MPC83XX
+     default y if SYSRESET_PSCI && ARCH_IMX9
+     default y if DM_PMIC_PCA9450

If you don't want the imply approach, please note in the help text that any board adding a new get_status() implementation must flip this on, otherwise the print will silently disappear on their next defconfig regeneration.

Regards,
Simon

#2 lore raw
Quoted 41 lines · Simon Glass

Hi Alexey,

Quoted 17 lines · Alexey Charkov

board_f: Make printing reset information optional

Current code tries to print information about the reset method whenever sysreset support is enabled. This causes the core to try to bind the sysreset device in board_init_f, even if the driver doesn't support reset status reporting, causing pure waste on some platforms (e.g. on Rockchip RK3576 it increases the boot time by ~0.4s even though the driver doesn't support reset status reporting).

Make the printing of reset information optional, so that it can be enabled only on platforms where it is supported and useful.

Only four sysreset drivers actually implement the get_status() op, so default the new symbol to y wherever one of them can be in use to avoid regressing those platforms:

Quoted 4 lines

- sysreset_sandbox
- sysreset_mpc83xx
- sysreset_psci, whose weak stub get_status() is only overridden by i.MX9;
- the pca9450 PMIC sysreset child driver.

This would age better if each driver implementing get_status() opted in from its own Kconfig with 'imply SYSRESET_PRINT_RESETINFO', so the next addition or removal doesn't have to touch this Kconfig too. What do you think?

Quoted 10 lines

- sysreset_sandbox
- sysreset_mpc83xx
- sysreset_psci, whose weak stub get_status() is only overridden by i.MX9;
- the pca9450 PMIC sysreset child driver.
[...]

common/board_f.c | 4 ++--

 drivers/sysreset/Kconfig | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/sysreset/Kconfig config VPL_SYSRESET · line 48

Quoted 8 lines
drivers/sysreset/Kconfig +6 -0
@@ -43,6 +43,20 @@ config VPL_SYSRESET
+config SYSRESET_PRINT_RESETINFO
+     bool "Print reset information during boot"
+     default y if SANDBOX
+     default y if SYSRESET_MPC83XX
+     default y if SYSRESET_PSCI && ARCH_IMX9
+     default y if DM_PMIC_PCA9450

If you don't want the imply approach, please note in the help text that any board adding a new get_status() implementation must flip this on, otherwise the print will silently disappear on their next defconfig regeneration.

That's a bit of a non-sense comment.

Signature · 1 line
Tom
#3 lore raw
In reply to Alexey Charkov
Quoted 8 lines · Alexey Charkov

Current code tries to print information about the reset method whenever sysreset support is enabled. This causes the core to try to bind the sysreset device in board_init_f, even if the driver doesn't support reset status reporting, causing pure waste on some platforms (e.g. on Rockchip RK3576 it increases the boot time by ~0.4s even though the driver doesn't support reset status reporting).

[...]

Applied to u-boot/next, thanks!

[1/1] board_f: Make printing reset information optional

      commit: a1f39f70134734c7e3f061900fa988d46771da44
Signature · 1 line
Tom