drivers: sysreset: revert support for args
cover drivers: sysreset: revert support for args
The args support for the sysreset uclass contains a logic bug. The first sysreset device implementing the request_arg callback will consume the args, not support the specified arg and thus return -EPROTONOSUPPORT which will stop the iteration over all sysreset devices.
This is an issue if one has multiple sysreset devices and each with support for different (valid) args. If a sysreset device implements a -dummy argument and another -foo and one calls reset -dummy on the U-Boot CLI, it'll depend on which sysreset device will be attempted first. If it is the one implementing -foo, it'll return it doesn't support the argument with -EPROTONOSUPPORT in which case the device implementing -dummy will never be attempted and instead we'll do a cold reset which is very likely not what's expected.
I suggest to either add an additional return code for the case where the sysreset device knows it isn't supposed to handle this argument because it isn't among the ones it supports, and thus we try other sysreset devices until we find one that says it tried and either is in progress or couldn't realize the request, or no sysreset device supports this argument and we end up doing a cold reset (but should we even try to do a cold reset if the type of reset requested by the user isn't supported?). Or just don't try piggy-backing on the reset command and have a new command instead?
Maybe I misunderstood something or misread the code, so please correct me if I'm wrong.
We've tried bringing up this issue multiple times over the last month[1][2][3] but it seems like we're left on read. This is the last resort to get attention on this patches, hopefully we don't have to get through a revert a few days before the release though there is only two working days left before the release. Sending a revert as requested by Tom[4].
I've not even build tested this, only had a cursory look at what to
revert so maybe I'm missing some patches or breaking stuff up. It's late here and I wanted to give a chance to people in Americas to have a look
at this today, or people in Asia tomorrow morning before I come to the office. I don't have time to wait for the CI to complete, but it's
running here: https://source.denx.de/u-boot/contributors/qschulz/u-boot/-/pipelines/30604
Yes the commit hash is different, I rewrote this cover letter to include the link to the CI pipeline.
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/20260623165021.GJ382693@bill-the-cat/
[4] https://lore.kernel.org/all/20260702174613.GC749385@bill-the-cat/
---
Quentin Schulz (6):
Revert "qcom_defconfig: enable psci based sysreset"
Revert "cmd: boot: fix edl being shown when not supported" Revert "doc: usage: cmd: reset: specify when the -edl option is available" Revert "cmd: boot: Add '-edl' option to reset command documentation" Revert "sysreset: Implement PSCI based reset to EDL mode for QCOM SoCs" Revert "drivers: sysreset: Add sysreset op that can take arguments"
cmd/boot.c | 6 ----- configs/qcom_defconfig | 2 -- doc/usage/cmd/reset.rst | 10 +------- drivers/firmware/psci.c | 4 ---- drivers/sysreset/Kconfig | 15 ------------ drivers/sysreset/Makefile | 1 - drivers/sysreset/sysreset-uclass.c | 37 ---------------------------- drivers/sysreset/sysreset_qcom-psci.c | 45 ----------------------------------- include/sysreset.h | 18 -------------- 9 files changed, 1 insertion(+), 137 deletions(-)
---
base-commit: f605dcee103c897b6f1a8873549a36949bd4e2a1
change-id: 20260702-revert-sysreset-4579ae458f2e
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
PATCH 1/6 Revert "qcom_defconfig: enable psci based sysreset"
From: Quentin Schulz <[email protected]>
This reverts commit 63c806ba0e1236fea500f5d8b5486196d7c20806.
The args support for the sysreset uclass contains a logic bug. The first sysreset device implementing the request_arg callback will consume the args, not support the specified arg and thus return -EPROTONOSUPPORT which will stop the iteration over all sysreset devices.
This is an issue if one has multiple sysreset devices and each with support for different (valid) args. If a sysreset device implements a -dummy argument and another -foo and one calls reset -dummy on the U-Boot CLI, it'll depend on which sysreset device will be attempted first. If it is the one implementing -foo, it'll return it doesn't support the argument with -EPROTONOSUPPORT in which case the device implementing -dummy will never be attempted and instead we'll do a cold reset which is very likely not what's expected.
--- configs/qcom_defconfig | 2 -- 1 file changed, 2 deletions(-)
configs/qcom_defconfig +0 -2
@@ -133,8 +133,6 @@ CONFIG_QCOM_RPMH=y CONFIG_SPMI_MSM=y CONFIG_SYSINFO=y CONFIG_SYSINFO_SMBIOS=y -CONFIG_SYSRESET_CMD_RESET_ARGS=y -CONFIG_SYSRESET_QCOM_PSCI=y CONFIG_SYSRESET_QCOM_PSHOLD=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y
Signature · 1 line
2.55.0
PATCH 2/6 Revert "cmd: boot: fix edl being shown when not supported"
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
This reverts commit 1076feb8a3f96e2def81485f852e9c1a451cedf4.
The args support for the sysreset uclass contains a logic bug. The first sysreset device implementing the request_arg callback will consume the args, not support the specified arg and thus return -EPROTONOSUPPORT which will stop the iteration over all sysreset devices.
This is an issue if one has multiple sysreset devices and each with support for different (valid) args. If a sysreset device implements a -dummy argument and another -foo and one calls reset -dummy on the U-Boot CLI, it'll depend on which sysreset device will be attempted first. If it is the one implementing -foo, it'll return it doesn't support the argument with -EPROTONOSUPPORT in which case the device implementing -dummy will never be attempted and instead we'll do a cold reset which is very likely not what's expected.
--- cmd/boot.c | 3 --- 1 file changed, 3 deletions(-)
cmd/boot.c +0 -3
@@ -60,11 +60,8 @@ U_BOOT_CMD( reset,2 ,0 , do_reset,"Perform RESET of the CPU" , "- cold boot without level specifier\n" -#if IS_ENABLED (CONFIG_SYSRESET_CMD_RESET_ARGS ) -// All options handled by sysreset drivers via their sysreset_ops.request_arg callback #ifdef CONFIG_SYSRESET_QCOM_PSCI "reset -edl - Boot to Emergency DownLoad mode\n" -#endif #endif"reset -w - warm reset if implemented" );
Signature · 1 line
2.55.0
PATCH 3/6 Revert "doc: usage: cmd: reset: specify when the -edl option is available"
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
This reverts commit e49c84f7bb7b69a9736e8243665b30b46075ab55.
The args support for the sysreset uclass contains a logic bug. The first sysreset device implementing the request_arg callback will consume the args, not support the specified arg and thus return -EPROTONOSUPPORT which will stop the iteration over all sysreset devices.
This is an issue if one has multiple sysreset devices and each with support for different (valid) args. If a sysreset device implements a -dummy argument and another -foo and one calls reset -dummy on the U-Boot CLI, it'll depend on which sysreset device will be attempted first. If it is the one implementing -foo, it'll return it doesn't support the argument with -EPROTONOSUPPORT in which case the device implementing -dummy will never be attempted and instead we'll do a cold reset which is very likely not what's expected.
--- doc/usage/cmd/reset.rst | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
doc/usage/cmd/reset.rst +2 -8
@@ -11,9 +11,7 @@ Synopsis :: - reset - reset -w - reset -edl + reset [-w] Description -----------
@@ -24,12 +22,8 @@ DDR and peripherals, on some boards also resets external PMIC. -w Do WARM reset: reset CPU but keep peripheral/DDR/PMIC active. -All other options require CONFIG_SYSRESET_CMD_RESET_ARGS=y. - -edl - Boot to Emergency DownLoad mode on supported Qualcomm platforms. Unsupported - platforms will print an error message but the command will successfully - return (having done nothing). Requires CONFIG_SYSRESET_QCOM_PSCI=y. + Boot to Emergency DownLoad mode on supported Qualcomm platforms. Return value ------------
Signature · 1 line
2.55.0
PATCH 4/6 Revert "cmd: boot: Add '-edl' option to reset command documentation"
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
This reverts commit ef06c5d76ff46d488df201cc679f148b0140fd7a.
The args support for the sysreset uclass contains a logic bug. The first sysreset device implementing the request_arg callback will consume the args, not support the specified arg and thus return -EPROTONOSUPPORT which will stop the iteration over all sysreset devices.
This is an issue if one has multiple sysreset devices and each with support for different (valid) args. If a sysreset device implements a -dummy argument and another -foo and one calls reset -dummy on the U-Boot CLI, it'll depend on which sysreset device will be attempted first. If it is the one implementing -foo, it'll return it doesn't support the argument with -EPROTONOSUPPORT in which case the device implementing -dummy will never be attempted and instead we'll do a cold reset which is very likely not what's expected.
--- cmd/boot.c | 3 --- doc/usage/cmd/reset.rst | 2 -- 2 files changed, 5 deletions(-)
cmd/boot.c +0 -3
@@ -60,9 +60,6 @@ U_BOOT_CMD( reset,2 ,0 , do_reset,"Perform RESET of the CPU" ,"- cold boot without level specifier\n" -#ifdef CONFIG_SYSRESET_QCOM_PSCI - "reset -edl - Boot to Emergency DownLoad mode\n" -#endif"reset -w - warm reset if implemented" );
doc/usage/cmd/reset.rst +0 -2
@@ -22,8 +22,6 @@ DDR and peripherals, on some boards also resets external PMIC. -w Do WARM reset: reset CPU but keep peripheral/DDR/PMIC active. --edl - Boot to Emergency DownLoad mode on supported Qualcomm platforms. Return value ------------
Signature · 1 line
2.55.0
PATCH 5/6 Revert "sysreset: Implement PSCI based reset to EDL mode for QCOM SoCs"
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
This reverts commit 32825eaddc37670bb87f98b338aef8238e259e72.
The args support for the sysreset uclass contains a logic bug. The first sysreset device implementing the request_arg callback will consume the args, not support the specified arg and thus return -EPROTONOSUPPORT which will stop the iteration over all sysreset devices.
This is an issue if one has multiple sysreset devices and each with support for different (valid) args. If a sysreset device implements a -dummy argument and another -foo and one calls reset -dummy on the U-Boot CLI, it'll depend on which sysreset device will be attempted first. If it is the one implementing -foo, it'll return it doesn't support the argument with -EPROTONOSUPPORT in which case the device implementing -dummy will never be attempted and instead we'll do a cold reset which is very likely not what's expected.
--- drivers/firmware/psci.c | 4 ---- drivers/sysreset/Kconfig | 7 ------ drivers/sysreset/Makefile | 1 - drivers/sysreset/sysreset_qcom-psci.c | 45 ----------------------------------- 4 files changed, 57 deletions(-)
drivers/firmware/psci.c +0 -4
@@ -186,10 +186,6 @@ static int psci_bind(struct udevice *dev) NULL);if (ret)pr_debug ("PSCI System Reset was not bound.\n" ); -if (IS_ENABLED (CONFIG_SYSRESET_QCOM_PSCI ) && -device_bind_driver (dev,"qcom_psci-sysreset" , -"qcom_psci-sysreset" ,NULL )) -pr_debug ("QCOM PSCI System Reset was not bound.\n" ); }/* From PSCI v1.0 onward we can discover services through ARM_SMCCC_FEATURE */
drivers/sysreset/Kconfig +0 -7
@@ -301,13 +301,6 @@ config SYSRESET_RAA215300 help Add support for the system reboot via the Renesas RAA215300 PMIC. -config SYSRESET_QCOM_PSCI - bool "Support reset to EDL for Qualcomm SoCs via PSCI" - depends on ARM_SMCCC - help - Add support for the reset to EDL (Emergency Download) on Qualcomm - SoCs via PSCI. - config SYSRESET_QCOM_PSHOLD bool "Support sysreset for Qualcomm SoCs via PSHOLD" help
drivers/sysreset/Makefile +0 -1
@@ -30,7 +30,6 @@ obj-$(CONFIG_SYSRESET_RESETCTL) += sysreset_resetctl.o obj-$(CONFIG_$(PHASE_)SYSRESET_AT91) += sysreset_at91.o obj-$(CONFIG_$(PHASE_)SYSRESET_X86) += sysreset_x86.o obj-$(CONFIG_SYSRESET_RAA215300) += sysreset_raa215300.o -obj-$(CONFIG_SYSRESET_QCOM_PSCI) += sysreset_qcom-psci.o obj-$(CONFIG_SYSRESET_QCOM_PSHOLD) += sysreset_qcom-pshold.o obj-$(CONFIG_TARGET_XTFPGA) += sysreset_xtfpga.o obj-$(CONFIG_SYSRESET_QEMU_VIRT_CTRL) += sysreset_qemu_virt_ctrl.o
drivers/sysreset/sysreset_qcom-psci.c deleted +0 -45
45 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 6/6 Revert "drivers: sysreset: Add sysreset op that can take arguments"
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
This reverts commit fcb48b89813b14f38b31b86b4a6ace376bd86d8b.
The args support for the sysreset uclass contains a logic bug. The first sysreset device implementing the request_arg callback will consume the args, not support the specified arg and thus return -EPROTONOSUPPORT which will stop the iteration over all sysreset devices.
This is an issue if one has multiple sysreset devices and each with support for different (valid) args. If a sysreset device implements a -dummy argument and another -foo and one calls reset -dummy on the U-Boot CLI, it'll depend on which sysreset device will be attempted first. If it is the one implementing -foo, it'll return it doesn't support the argument with -EPROTONOSUPPORT in which case the device implementing -dummy will never be attempted and instead we'll do a cold reset which is very likely not what's expected.
--- drivers/sysreset/Kconfig | 8 -------- drivers/sysreset/sysreset-uclass.c | 37 ------------------------------------- include/sysreset.h | 18 ------------------ 3 files changed, 63 deletions(-)
drivers/sysreset/Kconfig +0 -8
@@ -49,14 +49,6 @@ config SYSRESET_CMD_RESET help Enable sysreset implementation of the reset command. -config SYSRESET_CMD_RESET_ARGS - bool "Enable reset command to take arguments" - help - Pass on the arguments received by the 'reset' command to the - sysreset driver(s). The sysreset driver(s) may make use of the - additional arguments for implementing arch/board specific - functionality. - if CMD_POWEROFF config SYSRESET_CMD_POWEROFF
drivers/sysreset/sysreset-uclass.c +0 -37
@@ -32,18 +32,6 @@ int sysreset_request(struct udevice *dev, enum sysreset_t type)return ops->request (dev, type); } -#if IS_ENABLED (CONFIG_SYSRESET_CMD_RESET_ARGS ) -int sysreset_request_arg (struct udevice *dev,int argc,char *const argv[]) -{ -struct sysreset_ops *ops =sysreset_get_ops (dev); - -if (!ops->request_arg) -return -ENOSYS ; - -return ops->request_arg (dev, argc, argv); -} -#endif /* CONFIG_SYSRESET_CMD_RESET_ARGS */ -int sysreset_get_status (struct udevice *dev,char *buf,int size) {struct sysreset_ops *ops =sysreset_get_ops (dev);
@@ -83,26 +71,6 @@ int sysreset_walk(enum sysreset_t type)return ret; } -#if IS_ENABLED (CONFIG_SYSRESET_CMD_RESET_ARGS ) -int sysreset_walk_arg (int argc,char *const argv[]) -{ -struct udevice *dev; -int ret = -ENOSYS ; - -while (ret != -EINPROGRESS && ret != -EPROTONOSUPPORT ) { -for (uclass_first_device (UCLASS_SYSRESET , &dev); - dev; -uclass_next_device (&dev)) { - ret =sysreset_request_arg (dev, argc, argv); -if (ret == -EINPROGRESS || ret == -EPROTONOSUPPORT ) -break ; - } - } - -return ret; -} -#endif /* CONFIG_SYSRESET_CMD_RESET_ARGS */ -int sysreset_get_last_walk (void ) {struct udevice *dev;
@@ -164,11 +132,6 @@ int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])printf ("resetting ...\n" );mdelay (100 ); -#if IS_ENABLED (CONFIG_SYSRESET_CMD_RESET_ARGS ) -if (argc >1 &&sysreset_walk_arg (argc, argv) == -EINPROGRESS ) -return 0 ; -#endif -sysreset_walk_halt (reset_type);return 0 ;
include/sysreset.h +0 -18
@@ -43,24 +43,6 @@ struct sysreset_ops {* (in which case this method will not actually return) */ int (*request)(struct udevice *dev,enum sysreset_t type); - -/** -* @request_arg: Reset handler implementations that might need to process -* arguments given to the 'reset' command. -* -* Note that this function may return before the reset takes effect. -* -* @dev: Device to be used for system reset -* @argc: No. of items in @argv -* @argv: Arguments given to 'reset' command -* Return: -* -EINPROGRESS if the reset has started and will complete soon -* -EPROTONOSUPPORT if not supported by this device -* 0 if the reset has already happened -* (in which case this method will not actually return) -*/ -int (*request_arg)(struct udevice *dev,int argc,char *const argv[]); -/** * @get_status: get printable reset status information *
Signature · 1 line
2.55.0
Hi Quentin,
Quoted 69 lines · Quentin Schulz
The args support for the sysreset uclass contains a logic bug. The first sysreset device implementing the
request_argcallback will consume the args, not support the specified arg and thus return-EPROTONOSUPPORTwhich will stop the iteration over all sysreset devices.This is an issue if one has multiple sysreset devices and each with support for different (valid) args. If a sysreset device implements a -dummy argument and another -foo and one calls reset -dummy on the U-Boot CLI, it'll depend on which sysreset device will be attempted first. If it is the one implementing -foo, it'll return it doesn't support the argument with
-EPROTONOSUPPORTin which case the device implementing -dummy will never be attempted and instead we'll do a cold reset which is very likely not what's expected.I suggest to either add an additional return code for the case where the sysreset device knows it isn't supposed to handle this argument because it isn't among the ones it supports, and thus we try other sysreset devices until we find one that says it tried and either is in progress or couldn't realize the request, or no sysreset device supports this argument and we end up doing a cold reset (but should we even try to do a cold reset if the type of reset requested by the user isn't supported?). Or just don't try piggy-backing on the reset command and have a new command instead?
Maybe I misunderstood something or misread the code, so please correct me if I'm wrong.
We've tried bringing up this issue multiple times over the last month[1][2][3] but it seems like we're left on read. This is the last resort to get attention on this patches, hopefully we don't have to get through a revert a few days before the release though there is only two working days left before the release. Sending a revert as requested by Tom[4].
I've not even build tested this, only had a cursory look at what to
revert so maybe I'm missing some patches or breaking stuff up. It's late here and I wanted to give a chance to people in Americas to have a look
at this today, or people in Asia tomorrow morning before I come to the office. I don't have time to wait for the CI to complete, but it's
running here: https://source.denx.de/u-boot/contributors/qschulz/u-boot/-/pipelines/30604
Yes the commit hash is different, I rewrote this cover letter to include the link to the CI pipeline.[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/20260623165021.GJ382693@bill-the-cat/
[4] https://lore.kernel.org/all/20260702174613.GC749385@bill-the-cat/Signed-off-by Quentin Schulz <[email protected]>---
Quentin Schulz (6):
Revert "qcom_defconfig: enable psci based sysreset"
Revert "cmd: boot: fix edl being shown when not supported" Revert "doc: usage: cmd: reset: specify when the -edl option is available" Revert "cmd: boot: Add '-edl' option to reset command documentation" Revert "sysreset: Implement PSCI based reset to EDL mode for QCOM SoCs" Revert "drivers: sysreset: Add sysreset op that can take arguments"cmd/boot.c | 6 ----- configs/qcom_defconfig | 2 -- doc/usage/cmd/reset.rst | 10 +------- drivers/firmware/psci.c | 4 ---- drivers/sysreset/Kconfig | 15 ------------ drivers/sysreset/Makefile | 1 - drivers/sysreset/sysreset-uclass.c | 37 ---------------------------- drivers/sysreset/sysreset_qcom-psci.c | 45 ----------------------------------- include/sysreset.h | 18 -------------- 9 files changed, 1 insertion(+), 137 deletions(-)
Quoted 3 lines
---
base-commit:f605dcee103c897b6f1a8873549a36949bd4e2a1
change-id: 20260702-revert-sysreset-4579ae458f2e
Given the timing, I suppose a revert. Apart from what is mentioned here, passing argc/argv directly from a command to a driver seems wrong to me, so I think the new series should use a new reset type instead.
Regards,
SImon
Quoted 5 lines
Best regards,
--
Quentin Schulz <[email protected]>
Hi Quentin,
Quoted 27 lines · Quentin Schulz
The args support for the sysreset uclass contains a logic bug. The first sysreset device implementing the
request_argcallback will consume the args, not support the specified arg and thus return-EPROTONOSUPPORTwhich will stop the iteration over all sysreset devices.This is an issue if one has multiple sysreset devices and each with support for different (valid) args. If a sysreset device implements a -dummy argument and another -foo and one calls reset -dummy on the U-Boot CLI, it'll depend on which sysreset device will be attempted first. If it is the one implementing -foo, it'll return it doesn't support the argument with
-EPROTONOSUPPORTin which case the device implementing -dummy will never be attempted and instead we'll do a cold reset which is very likely not what's expected.I suggest to either add an additional return code for the case where the sysreset device knows it isn't supposed to handle this argument because it isn't among the ones it supports, and thus we try other sysreset devices until we find one that says it tried and either is in progress or couldn't realize the request, or no sysreset device supports this argument and we end up doing a cold reset (but should we even try to do a cold reset if the type of reset requested by the user isn't supported?). Or just don't try piggy-backing on the reset command and have a new command instead?
Maybe I misunderstood something or misread the code, so please correct me if I'm wrong.
Quoted 6 lines
We've tried bringing up this issue multiple times over the last month[1][2][3] but it seems like we're left on read. This is the last resort to get attention on this patches, hopefully we don't have to get through a revert a few days before the release though there is only two working days left before the release. Sending a revert as requested by Tom[4].
I'm so sorry I missed this feedback. That really isn't great.
I'm with you that this is a pretty fundamental issue with the implementation here and I think the best course of action is to revert it and come up with a more suitable approach that isn't so open to trivial logic bugs like this, likely with some deeper refactoring of sysreset/reboot-mode code in U-Boot.
In hindsight I think I should have pushed back harder on this implementation, this is something I'll be more cautious of in the future.
I don't have a chance today to test this today as I'm OOO but if it doesn't break other platforms then it ought to be fine on Qualcomm too, maybe Neil can give it a spin on 8650.
Tom: feel free to pick this up if you're happy with it.
Thanks,
// Casey
Quoted 43 lines
I've not even build tested this, only had a cursory look at what to
revert so maybe I'm missing some patches or breaking stuff up. It's late here and I wanted to give a chance to people in Americas to have a look
at this today, or people in Asia tomorrow morning before I come to the office. I don't have time to wait for the CI to complete, but it's
running here: https://source.denx.de/u-boot/contributors/qschulz/u-boot/-/pipelines/30604
Yes the commit hash is different, I rewrote this cover letter to include the link to the CI pipeline.[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/20260623165021.GJ382693@bill-the-cat/
[4] https://lore.kernel.org/all/20260702174613.GC749385@bill-the-cat/Signed-off-by Quentin Schulz <[email protected]>---
Quentin Schulz (6):
Revert "qcom_defconfig: enable psci based sysreset"
Revert "cmd: boot: fix edl being shown when not supported" Revert "doc: usage: cmd: reset: specify when the -edl option is available" Revert "cmd: boot: Add '-edl' option to reset command documentation" Revert "sysreset: Implement PSCI based reset to EDL mode for QCOM SoCs" Revert "drivers: sysreset: Add sysreset op that can take arguments"cmd/boot.c | 6 ----- configs/qcom_defconfig | 2 -- doc/usage/cmd/reset.rst | 10 +------- drivers/firmware/psci.c | 4 ---- drivers/sysreset/Kconfig | 15 ------------ drivers/sysreset/Makefile | 1 - drivers/sysreset/sysreset-uclass.c | 37 ---------------------------- drivers/sysreset/sysreset_qcom-psci.c | 45 ----------------------------------- include/sysreset.h | 18 -------------- 9 files changed, 1 insertion(+), 137 deletions(-)---
base-commit:f605dcee103c897b6f1a8873549a36949bd4e2a1
change-id: 20260702-revert-sysreset-4579ae458f2eBest regards,
--
Quentin Schulz <[email protected]>
Hi Casey,
Thanks for the prompt answer!
Quoted 30 lines · Casey Connolly
Hi Quentin,
Quoted 27 lines · Quentin Schulz
The args support for the sysreset uclass contains a logic bug. The first sysreset device implementing the
request_argcallback will consume the args, not support the specified arg and thus return-EPROTONOSUPPORTwhich will stop the iteration over all sysreset devices.This is an issue if one has multiple sysreset devices and each with support for different (valid) args. If a sysreset device implements a -dummy argument and another -foo and one calls reset -dummy on the U-Boot CLI, it'll depend on which sysreset device will be attempted first. If it is the one implementing -foo, it'll return it doesn't support the argument with
-EPROTONOSUPPORTin which case the device implementing -dummy will never be attempted and instead we'll do a cold reset which is very likely not what's expected.I suggest to either add an additional return code for the case where the sysreset device knows it isn't supposed to handle this argument because it isn't among the ones it supports, and thus we try other sysreset devices until we find one that says it tried and either is in progress or couldn't realize the request, or no sysreset device supports this argument and we end up doing a cold reset (but should we even try to do a cold reset if the type of reset requested by the user isn't supported?). Or just don't try piggy-backing on the reset command and have a new command instead?
Maybe I misunderstood something or misread the code, so please correct me if I'm wrong.
Quoted 9 lines
Quoted 6 lines
We've tried bringing up this issue multiple times over the last month[1][2][3] but it seems like we're left on read. This is the last resort to get attention on this patches, hopefully we don't have to get through a revert a few days before the release though there is only two working days left before the release. Sending a revert as requested by Tom[4].
I'm so sorry I missed this feedback. That really isn't great.
It happens, I'm glad you see it now :)
Quoted 4 lines
I'm with you that this is a pretty fundamental issue with the implementation here and I think the best course of action is to revert it and come up with a more suitable approach that isn't so open to trivial logic bugs like this, likely with some deeper refactoring of sysreset/reboot-mode code in U-Boot.
In hindsight I think I should have pushed back harder on this implementation, this is something I'll be more cautious of in the future.
Just to be clear I wasn't trying to shame anyone here, contributor, reviewer or maintainer. Mistakes happen.
Quoted 6 lines
Acked-by Casey Connolly <[email protected]>I don't have a chance today to test this today as I'm OOO but if it doesn't break other platforms then it ought to be fine on Qualcomm too, maybe Neil can give it a spin on 8650.
Tom: feel free to pick this up if you're happy with it.
Varada sent a series trying to fix the logic, c.f. https://lore.kernel.org/u-boot/[email protected]/T/#mf098752c30cd6a6c8e7700f61cd54cbc8f307d6d. But if you feel like we should start from a clean slate again instead then we can revert this now and take the time to implement this differently for next release. I think your feedback on what to do next is important here. But I appreciate you're OOO so we'll do without if you don't have time :)
Thanks,
Quentin
Hi Quentin,
Quoted 54 lines · Quentin Schulz
Hi Casey,
Thanks for the prompt answer!
Quoted 30 lines · Casey Connolly
Hi Quentin,
Quoted 27 lines · Quentin Schulz
The args support for the sysreset uclass contains a logic bug. The first sysreset device implementing the
request_argcallback will consume the args, not support the specified arg and thus return-EPROTONOSUPPORTwhich will stop the iteration over all sysreset devices.This is an issue if one has multiple sysreset devices and each with support for different (valid) args. If a sysreset device implements a -dummy argument and another -foo and one calls reset -dummy on the U-Boot CLI, it'll depend on which sysreset device will be attempted first. If it is the one implementing -foo, it'll return it doesn't support the argument with
-EPROTONOSUPPORTin which case the device implementing -dummy will never be attempted and instead we'll do a cold reset which is very likely not what's expected.I suggest to either add an additional return code for the case where the sysreset device knows it isn't supposed to handle this argument because it isn't among the ones it supports, and thus we try other sysreset devices until we find one that says it tried and either is in progress or couldn't realize the request, or no sysreset device supports this argument and we end up doing a cold reset (but should we even try to do a cold reset if the type of reset requested by the user isn't supported?). Or just don't try piggy-backing on the reset command and have a new command instead?
Maybe I misunderstood something or misread the code, so please correct me if I'm wrong.
Quoted 9 lines
Quoted 6 lines
We've tried bringing up this issue multiple times over the last month[1][2][3] but it seems like we're left on read. This is the last resort to get attention on this patches, hopefully we don't have to get through a revert a few days before the release though there is only two working days left before the release. Sending a revert as requested by Tom[4].
I'm so sorry I missed this feedback. That really isn't great.
It happens, I'm glad you see it now :)
Quoted 4 lines
I'm with you that this is a pretty fundamental issue with the implementation here and I think the best course of action is to revert it and come up with a more suitable approach that isn't so open to trivial logic bugs like this, likely with some deeper refactoring of sysreset/reboot-mode code in U-Boot.
In hindsight I think I should have pushed back harder on this implementation, this is something I'll be more cautious of in the future.
Just to be clear I wasn't trying to shame anyone here, contributor, reviewer or maintainer. Mistakes happen.
Quoted 8 lines
Quoted 6 lines
Acked-by Casey Connolly <[email protected]>I don't have a chance today to test this today as I'm OOO but if it doesn't break other platforms then it ought to be fine on Qualcomm too, maybe Neil can give it a spin on 8650.
Tom: feel free to pick this up if you're happy with it.
Varada sent a series trying to fix the logic, c.f. https:// lore.kernel.org/u-boot/[email protected]/T/ #mf098752c30cd6a6c8e7700f61cd54cbc8f307d6d. But if you feel like we should start from a clean slate again instead then we can revert this now and take the time to implement this differently for next release. I think your feedback on what to do next is important here. But I appreciate you're OOO so we'll do without if you don't have time :)
heh I just saw that after hitting send...
I think the original series could probably have used some more discussion before it got picked up, and the overall approach feels less than ideal particularly when the reboot-mode mechanism already exists for exactly this purpose.
imo eeping this implementation will only result in further issues down the road particularly as other vendors adopt reboot2 support, and frankly doing argument parsing in drivers just feels deeply wrong to me.
So I'd say let's revert it and go back to the drawing board with something cleaner and more scalable. The exact same functionality has gone through a lot of iterations on the Linux mailing list and it seems like they're coming up with something quite sensible in the end with a reboot-mode subnode on the psci DT node. With those DT changes in place it seems foolish to a) have this be qcom specific and b) hardcode these magic values in the driver.
I would be strongly in favour of something like the above, the "reset" command in U-Boot could then have a way to retrieve all the possible modes registered with the reboot-mode framework.
Thanks,
// Casey
Quoted 3 lines
Thanks,
Quentin