[PATCH 1/1] sandbox: make sandbox system reset configurable

To test the watchdog system reset we need to disable the default sandbox system reset.
The following settings provide the reset command via watchdog on the sandbox:
CONFIG_WDT_GPIO=n CONFIG_WDT_SANDBOX=y CONFIG_SYSRESET_SANDBOX=n CONFIG_SYSRESET_WATCHDOG=y CONFIG_SYSRESET_WATCHDOG_AUTO=y
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- drivers/sysreset/Kconfig | 7 +++++++ drivers/sysreset/Makefile | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig index 03f7fdd597..3bd38fc585 100644 --- a/drivers/sysreset/Kconfig +++ b/drivers/sysreset/Kconfig @@ -110,6 +110,13 @@ config SYSRESET_PSCI Enable PSCI SYSTEM_RESET function call. To use this, PSCI firmware must be running on your system.
+config SYSRESET_SANDBOX + bool "Enable support for Sandbox System Reset" + depends on SANDBOX + default y + help + Enable sandbox system reset implementation. + config SYSRESET_SBI bool "Enable support for SBI System Reset" depends on RISCV_SMODE && SBI_V02 diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile index 0ed3bbf356..d4b6e575be 100644 --- a/drivers/sysreset/Makefile +++ b/drivers/sysreset/Makefile @@ -6,7 +6,7 @@ obj-$(CONFIG_$(SPL_TPL_)SYSRESET) += sysreset-uclass.o obj-$(CONFIG_ARCH_ASPEED) += sysreset_ast.o obj-$(CONFIG_ARCH_ROCKCHIP) += sysreset_rockchip.o obj-$(CONFIG_ARCH_STI) += sysreset_sti.o -obj-$(CONFIG_SANDBOX) += sysreset_sandbox.o +obj-$(CONFIG_SYSRESET_SANDBOX) += sysreset_sandbox.o obj-$(CONFIG_POWEROFF_GPIO) += poweroff_gpio.o obj-$(CONFIG_SYSRESET_GPIO) += sysreset_gpio.o obj-$(CONFIG_SYSRESET_MPC83XX) += sysreset_mpc83xx.o

Hello,
On Sat, Oct 15, 2022 at 10:39:19AM +0200, Heinrich Schuchardt wrote:
To test the watchdog system reset we need to disable the default sandbox system reset.
The following settings provide the reset command via watchdog on the sandbox:
CONFIG_WDT_GPIO=n CONFIG_WDT_SANDBOX=y CONFIG_SYSRESET_SANDBOX=n CONFIG_SYSRESET_WATCHDOG=y CONFIG_SYSRESET_WATCHDOG_AUTO=y
Woudn't it be better to make this runtime configurable?
Thanks
Michal
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
drivers/sysreset/Kconfig | 7 +++++++ drivers/sysreset/Makefile | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig index 03f7fdd597..3bd38fc585 100644 --- a/drivers/sysreset/Kconfig +++ b/drivers/sysreset/Kconfig @@ -110,6 +110,13 @@ config SYSRESET_PSCI Enable PSCI SYSTEM_RESET function call. To use this, PSCI firmware must be running on your system.
+config SYSRESET_SANDBOX
- bool "Enable support for Sandbox System Reset"
- depends on SANDBOX
- default y
- help
Enable sandbox system reset implementation.
config SYSRESET_SBI bool "Enable support for SBI System Reset" depends on RISCV_SMODE && SBI_V02 diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile index 0ed3bbf356..d4b6e575be 100644 --- a/drivers/sysreset/Makefile +++ b/drivers/sysreset/Makefile @@ -6,7 +6,7 @@ obj-$(CONFIG_$(SPL_TPL_)SYSRESET) += sysreset-uclass.o obj-$(CONFIG_ARCH_ASPEED) += sysreset_ast.o obj-$(CONFIG_ARCH_ROCKCHIP) += sysreset_rockchip.o obj-$(CONFIG_ARCH_STI) += sysreset_sti.o -obj-$(CONFIG_SANDBOX) += sysreset_sandbox.o +obj-$(CONFIG_SYSRESET_SANDBOX) += sysreset_sandbox.o obj-$(CONFIG_POWEROFF_GPIO) += poweroff_gpio.o obj-$(CONFIG_SYSRESET_GPIO) += sysreset_gpio.o obj-$(CONFIG_SYSRESET_MPC83XX) += sysreset_mpc83xx.o -- 2.37.2

On 10/15/22 14:04, Michal Suchánek wrote:
Hello,
On Sat, Oct 15, 2022 at 10:39:19AM +0200, Heinrich Schuchardt wrote:
To test the watchdog system reset we need to disable the default sandbox system reset.
The following settings provide the reset command via watchdog on the sandbox:
CONFIG_WDT_GPIO=n CONFIG_WDT_SANDBOX=y CONFIG_SYSRESET_SANDBOX=n CONFIG_SYSRESET_WATCHDOG=y CONFIG_SYSRESET_WATCHDOG_AUTO=y
Woudn't it be better to make this runtime configurable?
Devices can already be removed using the unbind command and added with the bind command again.
You could get into the same state by
* unbinding all sysreset devices and the GPIO watchdog device * binding the watchdog sysreset driver
if CONFIG_SYSRESET_WATCHDOG_AUTO=y.
As the watchdog sysreset driver does not support the poweroff command enabling CONFIG_SYSRESET_WATCHDOG=y by default is not a good choice.
Actually testing the watchdog sysreset driver is beyond the scope of this patch.
Best regards
Heinrich
Thanks
Michal
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
drivers/sysreset/Kconfig | 7 +++++++ drivers/sysreset/Makefile | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig index 03f7fdd597..3bd38fc585 100644 --- a/drivers/sysreset/Kconfig +++ b/drivers/sysreset/Kconfig @@ -110,6 +110,13 @@ config SYSRESET_PSCI Enable PSCI SYSTEM_RESET function call. To use this, PSCI firmware must be running on your system.
+config SYSRESET_SANDBOX
- bool "Enable support for Sandbox System Reset"
- depends on SANDBOX
- default y
- help
Enable sandbox system reset implementation.
- config SYSRESET_SBI bool "Enable support for SBI System Reset" depends on RISCV_SMODE && SBI_V02
diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile index 0ed3bbf356..d4b6e575be 100644 --- a/drivers/sysreset/Makefile +++ b/drivers/sysreset/Makefile @@ -6,7 +6,7 @@ obj-$(CONFIG_$(SPL_TPL_)SYSRESET) += sysreset-uclass.o obj-$(CONFIG_ARCH_ASPEED) += sysreset_ast.o obj-$(CONFIG_ARCH_ROCKCHIP) += sysreset_rockchip.o obj-$(CONFIG_ARCH_STI) += sysreset_sti.o -obj-$(CONFIG_SANDBOX) += sysreset_sandbox.o +obj-$(CONFIG_SYSRESET_SANDBOX) += sysreset_sandbox.o obj-$(CONFIG_POWEROFF_GPIO) += poweroff_gpio.o obj-$(CONFIG_SYSRESET_GPIO) += sysreset_gpio.o obj-$(CONFIG_SYSRESET_MPC83XX) += sysreset_mpc83xx.o -- 2.37.2

Hi Heinrich,
On Sun, 16 Oct 2022 at 01:27, Heinrich Schuchardt heinrich.schuchardt@canonical.com wrote:
On 10/15/22 14:04, Michal Suchánek wrote:
Hello,
On Sat, Oct 15, 2022 at 10:39:19AM +0200, Heinrich Schuchardt wrote:
To test the watchdog system reset we need to disable the default sandbox system reset.
The following settings provide the reset command via watchdog on the sandbox:
CONFIG_WDT_GPIO=n CONFIG_WDT_SANDBOX=y CONFIG_SYSRESET_SANDBOX=n CONFIG_SYSRESET_WATCHDOG=y CONFIG_SYSRESET_WATCHDOG_AUTO=y
Woudn't it be better to make this runtime configurable?
Devices can already be removed using the unbind command and added with the bind command again.
You could get into the same state by
- unbinding all sysreset devices and the GPIO watchdog device
- binding the watchdog sysreset driver
if CONFIG_SYSRESET_WATCHDOG_AUTO=y.
As the watchdog sysreset driver does not support the poweroff command enabling CONFIG_SYSRESET_WATCHDOG=y by default is not a good choice.
Actually testing the watchdog sysreset driver is beyond the scope of this patch.
Hmmm we don't want to disable it at build time...as Michal says it is better to disable it at runtime, e.g. with a test flag. We do that in quite a few cases at the start of tests, to get the behaviour needed for the test.
Regards, SImon
participants (3)
-
Heinrich Schuchardt
-
Michal Suchánek
-
Simon Glass