* [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations
2025-12-28 17:20 [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
@ 2025-12-28 17:20 ` Shivendra Pratap
2026-01-02 10:05 ` Bartosz Golaszewski
2025-12-28 17:20 ` [PATCH v19 02/10] power: reset: reboot-mode: Add support for 64 bit magic Shivendra Pratap
` (9 subsequent siblings)
10 siblings, 1 reply; 30+ messages in thread
From: Shivendra Pratap @ 2025-12-28 17:20 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Shivendra Pratap, Srinivas Kandagatla
Devres APIs are intended for use in drivers, where the managed lifetime
of resources is tied directly to the driver attach/detach cycle. In
shared subsystem code, there is no guarantee that the subsystem
functions will only be called after a driver has been attached, nor that
they will not be referenced after the managed resources have been
released during driver detach.
To ensure correct lifetime handling, avoid using devres-based
allocations in the reboot-mode and explicitly handle allocation and
cleanup of resources.
Fixes: 4fcd504edbf7 ("power: reset: add reboot mode driver")
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/reboot-mode.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index fba53f638da04655e756b5f8b7d2d666d1379535..3af6bc16a76daee686e8110b74e71b0e62b13ef8 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -3,6 +3,8 @@
* Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd
*/
+#define pr_fmt(fmt) "reboot-mode: " fmt
+
#include <linux/device.h>
#include <linux/init.h>
#include <linux/kernel.h>
@@ -10,6 +12,7 @@
#include <linux/of.h>
#include <linux/reboot.h>
#include <linux/reboot-mode.h>
+#include <linux/slab.h>
#define PREFIX "mode-"
@@ -71,9 +74,11 @@ static int reboot_mode_notify(struct notifier_block *this,
int reboot_mode_register(struct reboot_mode_driver *reboot)
{
struct mode_info *info;
+ struct mode_info *next;
struct property *prop;
struct device_node *np = reboot->dev->of_node;
size_t len = strlen(PREFIX);
+ u32 magic;
int ret;
INIT_LIST_HEAD(&reboot->head);
@@ -82,19 +87,17 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
if (strncmp(prop->name, PREFIX, len))
continue;
- info = devm_kzalloc(reboot->dev, sizeof(*info), GFP_KERNEL);
+ if (of_property_read_u32(np, prop->name, &magic)) {
+ pr_err("reboot mode %s without magic number\n", prop->name);
+ continue;
+ }
+
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) {
ret = -ENOMEM;
goto error;
}
- if (of_property_read_u32(np, prop->name, &info->magic)) {
- dev_err(reboot->dev, "reboot mode %s without magic number\n",
- info->mode);
- devm_kfree(reboot->dev, info);
- continue;
- }
-
info->mode = kstrdup_const(prop->name + len, GFP_KERNEL);
if (!info->mode) {
ret = -ENOMEM;
@@ -102,8 +105,7 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
} else if (info->mode[0] == '\0') {
kfree_const(info->mode);
ret = -EINVAL;
- dev_err(reboot->dev, "invalid mode name(%s): too short!\n",
- prop->name);
+ pr_err("invalid mode name(%s): too short!\n", prop->name);
goto error;
}
@@ -116,8 +118,12 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
return 0;
error:
- list_for_each_entry(info, &reboot->head, list)
+ kfree(info);
+ list_for_each_entry_safe(info, next, &reboot->head, list) {
+ list_del(&info->list);
kfree_const(info->mode);
+ kfree(info);
+ }
return ret;
}
@@ -130,11 +136,15 @@ EXPORT_SYMBOL_GPL(reboot_mode_register);
int reboot_mode_unregister(struct reboot_mode_driver *reboot)
{
struct mode_info *info;
+ struct mode_info *next;
unregister_reboot_notifier(&reboot->reboot_notifier);
- list_for_each_entry(info, &reboot->head, list)
+ list_for_each_entry_safe(info, next, &reboot->head, list) {
+ list_del(&info->list);
kfree_const(info->mode);
+ kfree(info);
+ }
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations
2025-12-28 17:20 ` [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations Shivendra Pratap
@ 2026-01-02 10:05 ` Bartosz Golaszewski
2026-01-05 17:53 ` Shivendra Pratap
2026-01-05 18:16 ` Shivendra Pratap
0 siblings, 2 replies; 30+ messages in thread
From: Bartosz Golaszewski @ 2026-01-02 10:05 UTC (permalink / raw)
To: Shivendra Pratap
Cc: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla
On Sun, Dec 28, 2025 at 6:20 PM Shivendra Pratap
<shivendra.pratap@oss.qualcomm.com> wrote:
>
> Devres APIs are intended for use in drivers, where the managed lifetime
> of resources is tied directly to the driver attach/detach cycle. In
> shared subsystem code, there is no guarantee that the subsystem
> functions will only be called after a driver has been attached, nor that
> they will not be referenced after the managed resources have been
> released during driver detach.
>
> To ensure correct lifetime handling, avoid using devres-based
> allocations in the reboot-mode and explicitly handle allocation and
> cleanup of resources.
>
> Fixes: 4fcd504edbf7 ("power: reset: add reboot mode driver")
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
> ---
> drivers/power/reset/reboot-mode.c | 34 ++++++++++++++++++++++------------
> 1 file changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
> index fba53f638da04655e756b5f8b7d2d666d1379535..3af6bc16a76daee686e8110b74e71b0e62b13ef8 100644
> --- a/drivers/power/reset/reboot-mode.c
> +++ b/drivers/power/reset/reboot-mode.c
> @@ -3,6 +3,8 @@
> * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd
> */
>
> +#define pr_fmt(fmt) "reboot-mode: " fmt
> +
> #include <linux/device.h>
> #include <linux/init.h>
> #include <linux/kernel.h>
> @@ -10,6 +12,7 @@
> #include <linux/of.h>
> #include <linux/reboot.h>
> #include <linux/reboot-mode.h>
> +#include <linux/slab.h>
>
> #define PREFIX "mode-"
>
> @@ -71,9 +74,11 @@ static int reboot_mode_notify(struct notifier_block *this,
> int reboot_mode_register(struct reboot_mode_driver *reboot)
> {
> struct mode_info *info;
> + struct mode_info *next;
> struct property *prop;
> struct device_node *np = reboot->dev->of_node;
> size_t len = strlen(PREFIX);
> + u32 magic;
> int ret;
>
> INIT_LIST_HEAD(&reboot->head);
> @@ -82,19 +87,17 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
> if (strncmp(prop->name, PREFIX, len))
> continue;
>
> - info = devm_kzalloc(reboot->dev, sizeof(*info), GFP_KERNEL);
> + if (of_property_read_u32(np, prop->name, &magic)) {
Please use device_property_read_u32() if you have access to a device struct.
> + pr_err("reboot mode %s without magic number\n", prop->name);
If this is an error, shouldn't we bail out?
> + continue;
> + }
> +
> + info = kzalloc(sizeof(*info), GFP_KERNEL);
> if (!info) {
> ret = -ENOMEM;
> goto error;
> }
>
> - if (of_property_read_u32(np, prop->name, &info->magic)) {
> - dev_err(reboot->dev, "reboot mode %s without magic number\n",
> - info->mode);
> - devm_kfree(reboot->dev, info);
> - continue;
> - }
> -
> info->mode = kstrdup_const(prop->name + len, GFP_KERNEL);
> if (!info->mode) {
> ret = -ENOMEM;
> @@ -102,8 +105,7 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
> } else if (info->mode[0] == '\0') {
> kfree_const(info->mode);
> ret = -EINVAL;
> - dev_err(reboot->dev, "invalid mode name(%s): too short!\n",
> - prop->name);
> + pr_err("invalid mode name(%s): too short!\n", prop->name);
> goto error;
> }
>
> @@ -116,8 +118,12 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
> return 0;
>
> error:
> - list_for_each_entry(info, &reboot->head, list)
> + kfree(info);
> + list_for_each_entry_safe(info, next, &reboot->head, list) {
> + list_del(&info->list);
> kfree_const(info->mode);
> + kfree(info);
> + }
>
> return ret;
> }
> @@ -130,11 +136,15 @@ EXPORT_SYMBOL_GPL(reboot_mode_register);
> int reboot_mode_unregister(struct reboot_mode_driver *reboot)
> {
> struct mode_info *info;
> + struct mode_info *next;
>
> unregister_reboot_notifier(&reboot->reboot_notifier);
>
> - list_for_each_entry(info, &reboot->head, list)
> + list_for_each_entry_safe(info, next, &reboot->head, list) {
> + list_del(&info->list);
> kfree_const(info->mode);
> + kfree(info);
> + }
The code is repeated here, maybe factor it out into a separate function?
>
> return 0;
> }
>
> --
> 2.34.1
>
Bart
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations
2026-01-02 10:05 ` Bartosz Golaszewski
@ 2026-01-05 17:53 ` Shivendra Pratap
2026-01-06 12:31 ` Bartosz Golaszewski
2026-01-05 18:16 ` Shivendra Pratap
1 sibling, 1 reply; 30+ messages in thread
From: Shivendra Pratap @ 2026-01-05 17:53 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla
On 1/2/2026 3:35 PM, Bartosz Golaszewski wrote:
> On Sun, Dec 28, 2025 at 6:20 PM Shivendra Pratap
> <shivendra.pratap@oss.qualcomm.com> wrote:
>>
>> Devres APIs are intended for use in drivers, where the managed lifetime
>> of resources is tied directly to the driver attach/detach cycle. In
>> shared subsystem code, there is no guarantee that the subsystem
>> functions will only be called after a driver has been attached, nor that
>> they will not be referenced after the managed resources have been
>> released during driver detach.
[SNIP..]
>>
>> @@ -71,9 +74,11 @@ static int reboot_mode_notify(struct notifier_block *this,
>> int reboot_mode_register(struct reboot_mode_driver *reboot)
>> {
>> struct mode_info *info;
>> + struct mode_info *next;
>> struct property *prop;
>> struct device_node *np = reboot->dev->of_node;
>> size_t len = strlen(PREFIX);
>> + u32 magic;
>> int ret;
>>
>> INIT_LIST_HEAD(&reboot->head);
>> @@ -82,19 +87,17 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
>> if (strncmp(prop->name, PREFIX, len))
>> continue;
>>
>> - info = devm_kzalloc(reboot->dev, sizeof(*info), GFP_KERNEL);
>> + if (of_property_read_u32(np, prop->name, &magic)) {
>
> Please use device_property_read_u32() if you have access to a device struct.
Ack. Can it go in same patch with the fixes tag?
>
>> + pr_err("reboot mode %s without magic number\n", prop->name);
>
> If this is an error, shouldn't we bail out?
>
>> + continue;
>> + }
>> +
>> + info = kzalloc(sizeof(*info), GFP_KERNEL);
>> if (!info) {
>> ret = -ENOMEM;
>> goto error;
>> }
>>
>> - if (of_property_read_u32(np, prop->name, &info->magic)) {
>> - dev_err(reboot->dev, "reboot mode %s without magic number\n",
>> - info->mode);
>> - devm_kfree(reboot->dev, info);
>> - continue;
>> - }
>> -
>> info->mode = kstrdup_const(prop->name + len, GFP_KERNEL);
>> if (!info->mode) {
>> ret = -ENOMEM;
>> @@ -102,8 +105,7 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
>> } else if (info->mode[0] == '\0') {
>> kfree_const(info->mode);
>> ret = -EINVAL;
>> - dev_err(reboot->dev, "invalid mode name(%s): too short!\n",
>> - prop->name);
>> + pr_err("invalid mode name(%s): too short!\n", prop->name);
>> goto error;
>> }
>>
>> @@ -116,8 +118,12 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
>> return 0;
>>
>> error:
>> - list_for_each_entry(info, &reboot->head, list)
>> + kfree(info);
>> + list_for_each_entry_safe(info, next, &reboot->head, list) {
>> + list_del(&info->list);
>> kfree_const(info->mode);
>> + kfree(info);
>> + }
>>
>> return ret;
>> }
>> @@ -130,11 +136,15 @@ EXPORT_SYMBOL_GPL(reboot_mode_register);
>> int reboot_mode_unregister(struct reboot_mode_driver *reboot)
>> {
>> struct mode_info *info;
>> + struct mode_info *next;
>>
>> unregister_reboot_notifier(&reboot->reboot_notifier);
>>
>> - list_for_each_entry(info, &reboot->head, list)
>> + list_for_each_entry_safe(info, next, &reboot->head, list) {
>> + list_del(&info->list);
>> kfree_const(info->mode);
>> + kfree(info);
>> + }
>
> The code is repeated here, maybe factor it out into a separate function?
Ack. let me try that.
thanks,
Shivendra
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations
2026-01-05 17:53 ` Shivendra Pratap
@ 2026-01-06 12:31 ` Bartosz Golaszewski
0 siblings, 0 replies; 30+ messages in thread
From: Bartosz Golaszewski @ 2026-01-06 12:31 UTC (permalink / raw)
To: Shivendra Pratap
Cc: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla
On Mon, Jan 5, 2026 at 6:54 PM Shivendra Pratap
<shivendra.pratap@oss.qualcomm.com> wrote:
>
> >>
> >> INIT_LIST_HEAD(&reboot->head);
> >> @@ -82,19 +87,17 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
> >> if (strncmp(prop->name, PREFIX, len))
> >> continue;
> >>
> >> - info = devm_kzalloc(reboot->dev, sizeof(*info), GFP_KERNEL);
> >> + if (of_property_read_u32(np, prop->name, &magic)) {
> >
> > Please use device_property_read_u32() if you have access to a device struct.
>
> Ack. Can it go in same patch with the fixes tag?
>
I would be fine with it but it's more a question to Sebastian as the maintainer.
Bart
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations
2026-01-02 10:05 ` Bartosz Golaszewski
2026-01-05 17:53 ` Shivendra Pratap
@ 2026-01-05 18:16 ` Shivendra Pratap
2026-01-05 21:31 ` Dmitry Baryshkov
1 sibling, 1 reply; 30+ messages in thread
From: Shivendra Pratap @ 2026-01-05 18:16 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla
On 1/2/2026 3:35 PM, Bartosz Golaszewski wrote:
> On Sun, Dec 28, 2025 at 6:20 PM Shivendra Pratap
> <shivendra.pratap@oss.qualcomm.com> wrote:
[snip]
>
>> + pr_err("reboot mode %s without magic number\n", prop->name);
>
> If this is an error, shouldn't we bail out?
>
>> + continue;
This is not an error as per original design of reboot-mode framework.
The code as of now says, if the reboot-mode node has an entry without
proper magic value, ignore it, and, process the next.
thanks,
Shivendra
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations
2026-01-05 18:16 ` Shivendra Pratap
@ 2026-01-05 21:31 ` Dmitry Baryshkov
2026-01-06 6:31 ` Shivendra Pratap
0 siblings, 1 reply; 30+ messages in thread
From: Dmitry Baryshkov @ 2026-01-05 21:31 UTC (permalink / raw)
To: Shivendra Pratap
Cc: Bartosz Golaszewski, Lorenzo Pieralisi, Arnd Bergmann,
Bjorn Andersson, Sebastian Reichel, Rob Herring, Sudeep Holla,
Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan, John Stultz,
Matthias Brugger, Moritz Fischer, Mark Rutland, Conor Dooley,
Konrad Dybcio, Florian Fainelli, Krzysztof Kozlowski, Mukesh Ojha,
Andre Draszik, Kathiravan Thirumoorthy, linux-pm, linux-kernel,
linux-arm-kernel, linux-arm-msm, devicetree, Srinivas Kandagatla
On Mon, Jan 05, 2026 at 11:46:40PM +0530, Shivendra Pratap wrote:
>
>
> On 1/2/2026 3:35 PM, Bartosz Golaszewski wrote:
> > On Sun, Dec 28, 2025 at 6:20 PM Shivendra Pratap
> > <shivendra.pratap@oss.qualcomm.com> wrote:
>
> [snip]
>
> >
> >> + pr_err("reboot mode %s without magic number\n", prop->name);
> >
> > If this is an error, shouldn't we bail out?
> >
> >> + continue;
>
> This is not an error as per original design of reboot-mode framework.
> The code as of now says, if the reboot-mode node has an entry without
> proper magic value, ignore it, and, process the next.
Then why are you using error level for the message printout?
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations
2026-01-05 21:31 ` Dmitry Baryshkov
@ 2026-01-06 6:31 ` Shivendra Pratap
2026-01-06 12:30 ` Bartosz Golaszewski
0 siblings, 1 reply; 30+ messages in thread
From: Shivendra Pratap @ 2026-01-06 6:31 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Bartosz Golaszewski, Lorenzo Pieralisi, Arnd Bergmann,
Bjorn Andersson, Sebastian Reichel, Rob Herring, Sudeep Holla,
Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan, John Stultz,
Matthias Brugger, Moritz Fischer, Mark Rutland, Conor Dooley,
Konrad Dybcio, Florian Fainelli, Krzysztof Kozlowski, Mukesh Ojha,
Andre Draszik, Kathiravan Thirumoorthy, linux-pm, linux-kernel,
linux-arm-kernel, linux-arm-msm, devicetree, Srinivas Kandagatla
On 1/6/2026 3:01 AM, Dmitry Baryshkov wrote:
> On Mon, Jan 05, 2026 at 11:46:40PM +0530, Shivendra Pratap wrote:
>>
>>
>> On 1/2/2026 3:35 PM, Bartosz Golaszewski wrote:
>>> On Sun, Dec 28, 2025 at 6:20 PM Shivendra Pratap
>>> <shivendra.pratap@oss.qualcomm.com> wrote:
>>
>> [snip]
>>
>>>
>>>> + pr_err("reboot mode %s without magic number\n", prop->name);
>>>
>>> If this is an error, shouldn't we bail out?
>>>
>>>> + continue;
>>
>> This is not an error as per original design of reboot-mode framework.
>> The code as of now says, if the reboot-mode node has an entry without
>> proper magic value, ignore it, and, process the next.
>
> Then why are you using error level for the message printout?
I have changed from dev_err to pr_err. Can make it pr_info. Will
that change need a mention in commit text?
thanks,
Shivendra
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations
2026-01-06 6:31 ` Shivendra Pratap
@ 2026-01-06 12:30 ` Bartosz Golaszewski
2026-01-06 14:47 ` Shivendra Pratap
0 siblings, 1 reply; 30+ messages in thread
From: Bartosz Golaszewski @ 2026-01-06 12:30 UTC (permalink / raw)
To: Shivendra Pratap
Cc: Dmitry Baryshkov, Lorenzo Pieralisi, Arnd Bergmann,
Bjorn Andersson, Sebastian Reichel, Rob Herring, Sudeep Holla,
Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan, John Stultz,
Matthias Brugger, Moritz Fischer, Mark Rutland, Conor Dooley,
Konrad Dybcio, Florian Fainelli, Krzysztof Kozlowski, Mukesh Ojha,
Andre Draszik, Kathiravan Thirumoorthy, linux-pm, linux-kernel,
linux-arm-kernel, linux-arm-msm, devicetree, Srinivas Kandagatla
On Tue, Jan 6, 2026 at 7:31 AM Shivendra Pratap
<shivendra.pratap@oss.qualcomm.com> wrote:
>
>
>
> On 1/6/2026 3:01 AM, Dmitry Baryshkov wrote:
> > On Mon, Jan 05, 2026 at 11:46:40PM +0530, Shivendra Pratap wrote:
> >>
> >>
> >> On 1/2/2026 3:35 PM, Bartosz Golaszewski wrote:
> >>> On Sun, Dec 28, 2025 at 6:20 PM Shivendra Pratap
> >>> <shivendra.pratap@oss.qualcomm.com> wrote:
> >>
> >> [snip]
> >>
> >>>
> >>>> + pr_err("reboot mode %s without magic number\n", prop->name);
> >>>
> >>> If this is an error, shouldn't we bail out?
> >>>
> >>>> + continue;
> >>
> >> This is not an error as per original design of reboot-mode framework.
> >> The code as of now says, if the reboot-mode node has an entry without
> >> proper magic value, ignore it, and, process the next.
> >
> > Then why are you using error level for the message printout?
>
> I have changed from dev_err to pr_err. Can make it pr_info. Will
> that change need a mention in commit text?
>
If we can ignore something safely, then I'd just use pr_debug().
Bart
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations
2026-01-06 12:30 ` Bartosz Golaszewski
@ 2026-01-06 14:47 ` Shivendra Pratap
0 siblings, 0 replies; 30+ messages in thread
From: Shivendra Pratap @ 2026-01-06 14:47 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Dmitry Baryshkov, Lorenzo Pieralisi, Arnd Bergmann,
Bjorn Andersson, Sebastian Reichel, Rob Herring, Sudeep Holla,
Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan, John Stultz,
Matthias Brugger, Moritz Fischer, Mark Rutland, Conor Dooley,
Konrad Dybcio, Florian Fainelli, Krzysztof Kozlowski, Mukesh Ojha,
Andre Draszik, Kathiravan Thirumoorthy, linux-pm, linux-kernel,
linux-arm-kernel, linux-arm-msm, devicetree, Srinivas Kandagatla
On 1/6/2026 6:00 PM, Bartosz Golaszewski wrote:
> On Tue, Jan 6, 2026 at 7:31 AM Shivendra Pratap
> <shivendra.pratap@oss.qualcomm.com> wrote:
>>
>>
>>
>> On 1/6/2026 3:01 AM, Dmitry Baryshkov wrote:
>>> On Mon, Jan 05, 2026 at 11:46:40PM +0530, Shivendra Pratap wrote:
>>>>
>>>>
>>>> On 1/2/2026 3:35 PM, Bartosz Golaszewski wrote:
>>>>> On Sun, Dec 28, 2025 at 6:20 PM Shivendra Pratap
>>>>> <shivendra.pratap@oss.qualcomm.com> wrote:
>>>>
>>>> [snip]
>>>>
>>>>>
>>>>>> + pr_err("reboot mode %s without magic number\n", prop->name);
>>>>>
>>>>> If this is an error, shouldn't we bail out?
>>>>>
>>>>>> + continue;
>>>>
>>>> This is not an error as per original design of reboot-mode framework.
>>>> The code as of now says, if the reboot-mode node has an entry without
>>>> proper magic value, ignore it, and, process the next.
>>>
>>> Then why are you using error level for the message printout?
>>
>> I have changed from dev_err to pr_err. Can make it pr_info. Will
>> that change need a mention in commit text?
>>
>
> If we can ignore something safely, then I'd just use pr_debug().
Ack.
thanks,
Shivendra
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v19 02/10] power: reset: reboot-mode: Add support for 64 bit magic
2025-12-28 17:20 [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations Shivendra Pratap
@ 2025-12-28 17:20 ` Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 03/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
` (8 subsequent siblings)
10 siblings, 0 replies; 30+ messages in thread
From: Shivendra Pratap @ 2025-12-28 17:20 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Shivendra Pratap, Srinivas Kandagatla, Umang Chheda,
Nirmesh Kumar Singh
Current reboot-mode supports a single 32-bit argument for any
supported mode. Some reboot-mode based drivers may require
passing two independent 32-bit arguments during a reboot
sequence, for uses-cases, where a mode requires an additional
argument. Such drivers may not be able to use the reboot-mode
driver. For example, ARM PSCI vendor-specific resets, need two
arguments for its operation – reset_type and cookie, to complete
the reset operation. If a driver wants to implement this
firmware-based reset, it cannot use reboot-mode framework.
Introduce 64-bit magic values in reboot-mode driver to
accommodate up-to two 32-bit arguments.
u64 magic
--------------------------------------------
| Higher 32 bit | Lower 32 bit |
| arg2 | arg1 |
--------------------------------------------
Update current reboot-mode drivers for 64-bit magic.
Reviewed-by: Umang Chheda <umang.chheda@oss.qualcomm.com>
Reviewed-by: Nirmesh Kumar Singh <nirmesh.singh@oss.qualcomm.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/nvmem-reboot-mode.c | 10 ++++++----
drivers/power/reset/qcom-pon.c | 8 +++++---
drivers/power/reset/reboot-mode.c | 24 ++++++++++++++++++------
drivers/power/reset/syscon-reboot-mode.c | 8 +++++---
include/linux/reboot-mode.h | 6 +++++-
5 files changed, 39 insertions(+), 17 deletions(-)
diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/nvmem-reboot-mode.c
index 41530b70cfc48c2a83fbbd96f523d5816960a0d1..b3d21d39b0f732254c40103db1b51fb7045ce344 100644
--- a/drivers/power/reset/nvmem-reboot-mode.c
+++ b/drivers/power/reset/nvmem-reboot-mode.c
@@ -16,15 +16,17 @@ struct nvmem_reboot_mode {
struct nvmem_cell *cell;
};
-static int nvmem_reboot_mode_write(struct reboot_mode_driver *reboot,
- unsigned int magic)
+static int nvmem_reboot_mode_write(struct reboot_mode_driver *reboot, u64 magic)
{
- int ret;
struct nvmem_reboot_mode *nvmem_rbm;
+ u32 magic_arg1;
+ int ret;
+ /* Use low 32 bits of magic for argument_1 */
+ magic_arg1 = FIELD_GET(GENMASK_ULL(31, 0), magic);
nvmem_rbm = container_of(reboot, struct nvmem_reboot_mode, reboot);
- ret = nvmem_cell_write(nvmem_rbm->cell, &magic, sizeof(magic));
+ ret = nvmem_cell_write(nvmem_rbm->cell, &magic_arg1, sizeof(magic_arg1));
if (ret < 0)
dev_err(reboot->dev, "update reboot mode bits failed\n");
diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
index 7e108982a582e8243c5c806bd4a793646b87189f..ccce1673b2ec47d02524edd44811d4f528c243e8 100644
--- a/drivers/power/reset/qcom-pon.c
+++ b/drivers/power/reset/qcom-pon.c
@@ -27,17 +27,19 @@ struct qcom_pon {
long reason_shift;
};
-static int qcom_pon_reboot_mode_write(struct reboot_mode_driver *reboot,
- unsigned int magic)
+static int qcom_pon_reboot_mode_write(struct reboot_mode_driver *reboot, u64 magic)
{
struct qcom_pon *pon = container_of
(reboot, struct qcom_pon, reboot_mode);
+ u32 magic_arg1;
int ret;
+ /* Use low 32 bits of magic for argument_1 */
+ magic_arg1 = FIELD_GET(GENMASK_ULL(31, 0), magic);
ret = regmap_update_bits(pon->regmap,
pon->baseaddr + PON_SOFT_RB_SPARE,
GENMASK(7, pon->reason_shift),
- magic << pon->reason_shift);
+ magic_arg1 << pon->reason_shift);
if (ret < 0)
dev_err(pon->dev, "update reboot mode bits failed\n");
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index 3af6bc16a76daee686e8110b74e71b0e62b13ef8..1e85f2c052c916e153c7c9ac0b184c91d7153402 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -18,12 +18,11 @@
struct mode_info {
const char *mode;
- u32 magic;
+ u64 magic;
struct list_head list;
};
-static unsigned int get_reboot_mode_magic(struct reboot_mode_driver *reboot,
- const char *cmd)
+static u64 get_reboot_mode_magic(struct reboot_mode_driver *reboot, const char *cmd)
{
const char *normal = "normal";
struct mode_info *info;
@@ -55,7 +54,7 @@ static int reboot_mode_notify(struct notifier_block *this,
unsigned long mode, void *cmd)
{
struct reboot_mode_driver *reboot;
- unsigned int magic;
+ u64 magic;
reboot = container_of(this, struct reboot_mode_driver, reboot_notifier);
magic = get_reboot_mode_magic(reboot, cmd);
@@ -78,7 +77,8 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
struct property *prop;
struct device_node *np = reboot->dev->of_node;
size_t len = strlen(PREFIX);
- u32 magic;
+ u32 magic_arg1;
+ u32 magic_arg2;
int ret;
INIT_LIST_HEAD(&reboot->head);
@@ -87,10 +87,13 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
if (strncmp(prop->name, PREFIX, len))
continue;
- if (of_property_read_u32(np, prop->name, &magic)) {
+ if (of_property_read_u32(np, prop->name, &magic_arg1)) {
pr_err("reboot mode %s without magic number\n", prop->name);
continue;
}
+ /* Default magic_arg2 to zero */
+ if (of_property_read_u32_index(np, prop->name, 1, &magic_arg2))
+ magic_arg2 = 0;
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) {
@@ -98,6 +101,15 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
goto error;
}
+ /**
+ * Format of u64 magic
+ *-------------------------------------------
+ *| Higher 32 bit | Lower 32 bit |
+ *| arg2 | arg1 |
+ *-------------------------------------------
+ */
+ info->magic = FIELD_PREP(GENMASK_ULL(63, 32), magic_arg2) |
+ FIELD_PREP(GENMASK_ULL(31, 0), magic_arg1);
info->mode = kstrdup_const(prop->name + len, GFP_KERNEL);
if (!info->mode) {
ret = -ENOMEM;
diff --git a/drivers/power/reset/syscon-reboot-mode.c b/drivers/power/reset/syscon-reboot-mode.c
index e0772c9f70f7a19cd8ec8a0b7fdbbaa7ba44afd0..eb7fc5b7d6a7ed8a833d4920991c4c40b5b13ca7 100644
--- a/drivers/power/reset/syscon-reboot-mode.c
+++ b/drivers/power/reset/syscon-reboot-mode.c
@@ -20,16 +20,18 @@ struct syscon_reboot_mode {
u32 mask;
};
-static int syscon_reboot_mode_write(struct reboot_mode_driver *reboot,
- unsigned int magic)
+static int syscon_reboot_mode_write(struct reboot_mode_driver *reboot, u64 magic)
{
struct syscon_reboot_mode *syscon_rbm;
+ u32 magic_arg1;
int ret;
+ /* Use low 32 bits of magic for argument_1 */
+ magic_arg1 = FIELD_GET(GENMASK_ULL(31, 0), magic);
syscon_rbm = container_of(reboot, struct syscon_reboot_mode, reboot);
ret = regmap_update_bits(syscon_rbm->map, syscon_rbm->offset,
- syscon_rbm->mask, magic);
+ syscon_rbm->mask, magic_arg1);
if (ret < 0)
dev_err(reboot->dev, "update reboot mode bits failed\n");
diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h
index 4a2abb38d1d612ec0fdf05eb18c98b210f631b7f..a359dc0c6dede0ac5ce67190a00d46a7e7856707 100644
--- a/include/linux/reboot-mode.h
+++ b/include/linux/reboot-mode.h
@@ -2,10 +2,14 @@
#ifndef __REBOOT_MODE_H__
#define __REBOOT_MODE_H__
+#include <linux/bitfield.h>
+#include <linux/bits.h>
+#include <linux/types.h>
+
struct reboot_mode_driver {
struct device *dev;
struct list_head head;
- int (*write)(struct reboot_mode_driver *reboot, unsigned int magic);
+ int (*write)(struct reboot_mode_driver *reboot, u64 magic);
struct notifier_block reboot_notifier;
};
--
2.34.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v19 03/10] power: reset: reboot-mode: Add support for predefined reboot modes
2025-12-28 17:20 [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 01/10] power: reset: reboot-mode: Remove devres based allocations Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 02/10] power: reset: reboot-mode: Add support for 64 bit magic Shivendra Pratap
@ 2025-12-28 17:20 ` Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 04/10] firmware: psci: Introduce command-based reset in psci_sys_reset Shivendra Pratap
` (7 subsequent siblings)
10 siblings, 0 replies; 30+ messages in thread
From: Shivendra Pratap @ 2025-12-28 17:20 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Shivendra Pratap, Srinivas Kandagatla
reboot-mode based drivers can define a reboot-mode by adding it under
the reboot-mode node in device tree. This limits such drivers, to define
any predefined reboot-modes statically within the driver and creates a
dependency on device-tree.
Introduce a list for predefined modes in the reboot-mode framework and
process the predefined reboot-modes along with the device-tree defined
reboot-modes. Modify existing reboot-mode based drivers to initialize
the predefined list-head as empty.
This patch enables a reboot mode driver to define reboot-modes through a
predefined static list, in addition to the device-tree based reboot-modes.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/nvmem-reboot-mode.c | 1 +
drivers/power/reset/qcom-pon.c | 1 +
drivers/power/reset/reboot-mode.c | 28 ++++++++++++++++++++++------
drivers/power/reset/syscon-reboot-mode.c | 1 +
include/linux/reboot-mode.h | 9 +++++++++
5 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/nvmem-reboot-mode.c
index b3d21d39b0f732254c40103db1b51fb7045ce344..b02a2af31aac52cb0ab19cf5d4d315d17c208f6e 100644
--- a/drivers/power/reset/nvmem-reboot-mode.c
+++ b/drivers/power/reset/nvmem-reboot-mode.c
@@ -44,6 +44,7 @@ static int nvmem_reboot_mode_probe(struct platform_device *pdev)
nvmem_rbm->reboot.dev = &pdev->dev;
nvmem_rbm->reboot.write = nvmem_reboot_mode_write;
+ INIT_LIST_HEAD(&nvmem_rbm->reboot.predefined_modes);
nvmem_rbm->cell = devm_nvmem_cell_get(&pdev->dev, "reboot-mode");
if (IS_ERR(nvmem_rbm->cell)) {
diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
index ccce1673b2ec47d02524edd44811d4f528c243e8..bf7b9f0bcdcc4c168aa7ff8d6494122d898814b5 100644
--- a/drivers/power/reset/qcom-pon.c
+++ b/drivers/power/reset/qcom-pon.c
@@ -75,6 +75,7 @@ static int qcom_pon_probe(struct platform_device *pdev)
pon->reboot_mode.dev = &pdev->dev;
pon->reason_shift = reason_shift;
pon->reboot_mode.write = qcom_pon_reboot_mode_write;
+ INIT_LIST_HEAD(&pon->reboot_mode.predefined_modes);
error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode);
if (error) {
dev_err(&pdev->dev, "can't register reboot mode\n");
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index 1e85f2c052c916e153c7c9ac0b184c91d7153402..877c2459a3b2e47679ee2e9fbb9b0329dc3b1e0f 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -16,12 +16,6 @@
#define PREFIX "mode-"
-struct mode_info {
- const char *mode;
- u64 magic;
- struct list_head list;
-};
-
static u64 get_reboot_mode_magic(struct reboot_mode_driver *reboot, const char *cmd)
{
const char *normal = "normal";
@@ -72,6 +66,7 @@ static int reboot_mode_notify(struct notifier_block *this,
*/
int reboot_mode_register(struct reboot_mode_driver *reboot)
{
+ struct mode_info *info_predef;
struct mode_info *info;
struct mode_info *next;
struct property *prop;
@@ -83,6 +78,9 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
INIT_LIST_HEAD(&reboot->head);
+ if (!np)
+ goto predefined_modes;
+
for_each_property_of_node(np, prop) {
if (strncmp(prop->name, PREFIX, len))
continue;
@@ -124,6 +122,24 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
list_add_tail(&info->list, &reboot->head);
}
+predefined_modes:
+ list_for_each_entry(info_predef, &reboot->predefined_modes, list) {
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
+ if (!info) {
+ ret = -ENOMEM;
+ goto error;
+ }
+
+ info->mode = kstrdup_const(info_predef->mode, GFP_KERNEL);
+ if (!info->mode) {
+ ret = -ENOMEM;
+ goto error;
+ }
+
+ info->magic = info_predef->magic;
+ list_add_tail(&info->list, &reboot->head);
+ }
+
reboot->reboot_notifier.notifier_call = reboot_mode_notify;
register_reboot_notifier(&reboot->reboot_notifier);
diff --git a/drivers/power/reset/syscon-reboot-mode.c b/drivers/power/reset/syscon-reboot-mode.c
index eb7fc5b7d6a7ed8a833d4920991c4c40b5b13ca7..74e2e14c5d87c54ac24ef63c7905b3266d736439 100644
--- a/drivers/power/reset/syscon-reboot-mode.c
+++ b/drivers/power/reset/syscon-reboot-mode.c
@@ -50,6 +50,7 @@ static int syscon_reboot_mode_probe(struct platform_device *pdev)
syscon_rbm->reboot.dev = &pdev->dev;
syscon_rbm->reboot.write = syscon_reboot_mode_write;
syscon_rbm->mask = 0xffffffff;
+ INIT_LIST_HEAD(&syscon_rbm->reboot.predefined_modes);
syscon_rbm->map = syscon_node_to_regmap(pdev->dev.parent->of_node);
if (IS_ERR(syscon_rbm->map))
diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h
index a359dc0c6dede0ac5ce67190a00d46a7e7856707..bddec9b7f94187dcb056540df79eea34c25b1d0d 100644
--- a/include/linux/reboot-mode.h
+++ b/include/linux/reboot-mode.h
@@ -4,11 +4,20 @@
#include <linux/bitfield.h>
#include <linux/bits.h>
+#include <linux/reboot.h>
#include <linux/types.h>
+struct mode_info {
+ const char *mode;
+ u64 magic;
+ struct list_head list;
+};
+
struct reboot_mode_driver {
struct device *dev;
struct list_head head;
+ /* List of predefined reboot-modes, a reboot-mode-driver may populate. */
+ struct list_head predefined_modes;
int (*write)(struct reboot_mode_driver *reboot, u64 magic);
struct notifier_block reboot_notifier;
};
--
2.34.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v19 04/10] firmware: psci: Introduce command-based reset in psci_sys_reset
2025-12-28 17:20 [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (2 preceding siblings ...)
2025-12-28 17:20 ` [PATCH v19 03/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
@ 2025-12-28 17:20 ` Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
` (6 subsequent siblings)
10 siblings, 0 replies; 30+ messages in thread
From: Shivendra Pratap @ 2025-12-28 17:20 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Shivendra Pratap, Srinivas Kandagatla
PSCI currently supports only COLD reset and ARCH WARM reset based on the
Linux reboot_mode variable. The PSCI specification now includes
SYSTEM_RESET2 for vendor-specific resets, but there's no mechanism to
issue these through psci_sys_reset.
Add a command-based reset mechanism that allows external drivers to set
the psci reset command via a new psci_set_reset_cmd() function.
The psci command-based reset is disabled by default and the
psci_sys_reset follows its original flow until a psci_reset command is
set or a kernel panic is in progress.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/firmware/psci/psci.c | 46 ++++++++++++++++++++++++++++++++++++++++++--
include/linux/psci.h | 2 ++
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index 38ca190d4a22d6e7e0f06420e8478a2b0ec2fe6f..ad7a3267276f9e26740aea99c11f171ac715f9ba 100644
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -51,6 +51,15 @@ static int resident_cpu = -1;
struct psci_operations psci_ops;
static enum arm_smccc_conduit psci_conduit = SMCCC_CONDUIT_NONE;
+struct psci_sys_reset_params {
+ u32 system_reset;
+ u32 reset_type;
+ u32 cookie;
+ bool cmd;
+};
+
+static struct psci_sys_reset_params psci_reset;
+
bool psci_tos_resident_on(int cpu)
{
return cpu == resident_cpu;
@@ -80,6 +89,29 @@ static u32 psci_cpu_suspend_feature;
static bool psci_system_reset2_supported;
static bool psci_system_off2_hibernate_supported;
+/**
+ * psci_set_reset_cmd - Sets the psci_reset_cmd for command-based
+ * reset which will be used in psci_sys_reset call.
+ *
+ * @cmd_sys_rst2: Set to true for SYSTEM_RESET2 based resets.
+ * @cmd_reset_type: Set the reset_type argument for psci_sys_reset.
+ * @cmd_cookie: Set the cookie argument for psci_sys_reset.
+ */
+void psci_set_reset_cmd(bool cmd_sys_rst2, u32 cmd_reset_type, u32 cmd_cookie)
+{
+ if (cmd_sys_rst2 && psci_system_reset2_supported) {
+ psci_reset.system_reset = PSCI_FN_NATIVE(1_1, SYSTEM_RESET2);
+ psci_reset.reset_type = cmd_reset_type;
+ psci_reset.cookie = cmd_cookie;
+ } else {
+ psci_reset.system_reset = PSCI_0_2_FN_SYSTEM_RESET;
+ psci_reset.reset_type = 0;
+ psci_reset.cookie = 0;
+ }
+ psci_reset.cmd = true;
+}
+EXPORT_SYMBOL_GPL(psci_set_reset_cmd);
+
static inline bool psci_has_ext_power_state(void)
{
return psci_cpu_suspend_feature &
@@ -309,14 +341,24 @@ static int get_set_conduit_method(const struct device_node *np)
static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
void *data)
{
- if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) &&
- psci_system_reset2_supported) {
+ if (((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) &&
+ psci_system_reset2_supported) && (panic_in_progress() || !psci_reset.cmd)) {
/*
* reset_type[31] = 0 (architectural)
* reset_type[30:0] = 0 (SYSTEM_WARM_RESET)
* cookie = 0 (ignored by the implementation)
*/
invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0);
+ } else if (!panic_in_progress() && psci_reset.cmd) {
+ /*
+ * Commands are being set in psci_set_reset_cmd
+ * This issues, SYSTEM_RESET2 arch warm reset or
+ * SYSTEM_RESET2 vendor-specific reset or
+ * a SYSTEM_RESET cold reset in accordance with
+ * the reboot-mode command.
+ */
+ invoke_psci_fn(psci_reset.system_reset, psci_reset.reset_type,
+ psci_reset.cookie, 0);
} else {
invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
}
diff --git a/include/linux/psci.h b/include/linux/psci.h
index 4ca0060a3fc42ba1ca751c7862fb4ad8dda35a4c..d13ceca88eab8932894051e7c86e806c2ad8a73a 100644
--- a/include/linux/psci.h
+++ b/include/linux/psci.h
@@ -45,8 +45,10 @@ struct psci_0_1_function_ids get_psci_0_1_function_ids(void);
#if defined(CONFIG_ARM_PSCI_FW)
int __init psci_dt_init(void);
+void psci_set_reset_cmd(bool cmd_sys_rst2, u32 cmd_reset_type, u32 cmd_cookie);
#else
static inline int psci_dt_init(void) { return 0; }
+static inline void psci_set_reset_cmd(bool cmd_sys_rst2, u32 cmd_reset_type, u32 cmd_cookie) { }
#endif
#if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)
--
2.34.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v19 05/10] dt-bindings: arm: Document reboot mode magic
2025-12-28 17:20 [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (3 preceding siblings ...)
2025-12-28 17:20 ` [PATCH v19 04/10] firmware: psci: Introduce command-based reset in psci_sys_reset Shivendra Pratap
@ 2025-12-28 17:20 ` Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
` (5 subsequent siblings)
10 siblings, 0 replies; 30+ messages in thread
From: Shivendra Pratap @ 2025-12-28 17:20 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Shivendra Pratap, Srinivas Kandagatla
Add bindings to describe vendor-specific reboot modes. Values here
correspond to valid parameters to vendor-specific reset types in PSCI
SYSTEM_RESET2 call.
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
Documentation/devicetree/bindings/arm/psci.yaml | 42 +++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/Documentation/devicetree/bindings/arm/psci.yaml b/Documentation/devicetree/bindings/arm/psci.yaml
index 6e2e0c551841111fbb0aa8c0951dca411b94035c..5fdcbf331ea5620363638feb6f8105427a87c00f 100644
--- a/Documentation/devicetree/bindings/arm/psci.yaml
+++ b/Documentation/devicetree/bindings/arm/psci.yaml
@@ -98,6 +98,26 @@ properties:
[1] Kernel documentation - ARM idle states bindings
Documentation/devicetree/bindings/cpu/idle-states.yaml
+ reboot-mode:
+ type: object
+ $ref: /schemas/power/reset/reboot-mode.yaml#
+ unevaluatedProperties: false
+ properties:
+ # "mode-normal" is just SYSTEM_RESET
+ mode-normal: false
+ patternProperties:
+ "^mode-.*$":
+ minItems: 1
+ maxItems: 2
+ description: |
+ Describes a vendor-specific reset type. The string after "mode-"
+ maps a reboot mode to the parameters in the PSCI SYSTEM_RESET2 call.
+
+ Parameters are named mode-xxx = <type[, cookie]>, where xxx is the
+ name of the magic reboot mode, type corresponds to the reset_type
+ and the values should be provided as per the PSCI SYSTEM_RESET2
+ specs. The cookie value is optional and defaulted to zero.
+
patternProperties:
"^power-domain-":
$ref: /schemas/power/power-domain.yaml#
@@ -137,6 +157,15 @@ allOf:
required:
- cpu_off
- cpu_on
+ - if:
+ not:
+ properties:
+ compatible:
+ contains:
+ const: arm,psci-1.0
+ then:
+ properties:
+ reboot-mode: false
additionalProperties: false
@@ -260,4 +289,17 @@ examples:
domain-idle-states = <&cluster_ret>, <&cluster_pwrdn>;
};
};
+
+ - |+
+
+ // Case 5: SYSTEM_RESET2 vendor resets
+ psci {
+ compatible = "arm,psci-1.0";
+ method = "smc";
+
+ reboot-mode {
+ mode-edl = <0x80000000 1>;
+ mode-bootloader = <0x80010001 2>;
+ };
+ };
...
--
2.34.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v19 06/10] power: reset: Add psci-reboot-mode driver
2025-12-28 17:20 [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (4 preceding siblings ...)
2025-12-28 17:20 ` [PATCH v19 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
@ 2025-12-28 17:20 ` Shivendra Pratap
2026-01-02 11:57 ` Bartosz Golaszewski
2025-12-28 17:20 ` [PATCH v19 07/10] arm64: dts: qcom: qcm6490: Add psci reboot-modes Shivendra Pratap
` (4 subsequent siblings)
10 siblings, 1 reply; 30+ messages in thread
From: Shivendra Pratap @ 2025-12-28 17:20 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Shivendra Pratap, Srinivas Kandagatla
PSCI supports different types of resets like COLD reset, ARCH WARM
reset, vendor-specific resets. Currently there is no common driver that
handles all supported psci resets at one place. Additionally, there is
no common mechanism to issue the supported psci resets from userspace.
Add a PSCI reboot mode driver and define two types of PSCI resets in the
driver as reboot-modes: predefined resets controlled by Linux
reboot_mode and customizable resets defined by SoC vendors in their
device tree under the psci:reboot-mode node.
Register the driver with the reboot-mode framework to interface these
resets to userspace. When userspace initiates a supported command, pass
the reset arguments to the PSCI driver to enable command-based reset.
This change allows userspace to issue supported PSCI reset commands
using the standard reboot system calls while enabling SoC vendors to
define their specific resets for PSCI.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/Kconfig | 10 +++
drivers/power/reset/Makefile | 1 +
drivers/power/reset/psci-reboot-mode.c | 111 +++++++++++++++++++++++++++++++++
3 files changed, 122 insertions(+)
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index f6c1bcbb57deff3568d6b1b326454add3b3bbf06..529d6c7d3555601f7b7e6199acd29838030fcef2 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -348,6 +348,16 @@ config NVMEM_REBOOT_MODE
then the bootloader can read it and take different
action according to the mode.
+config PSCI_REBOOT_MODE
+ bool "PSCI reboot mode driver"
+ depends on OF && ARM_PSCI_FW
+ select REBOOT_MODE
+ help
+ Say y here will enable PSCI reboot mode driver. This gets
+ the PSCI reboot mode arguments and passes them to psci
+ driver. psci driver uses these arguments for issuing
+ device reset into different boot states.
+
config POWER_MLXBF
tristate "Mellanox BlueField power handling driver"
depends on (GPIO_MLXBF2 || GPIO_MLXBF3) && ACPI
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 0e4ae6f6b5c55729cf60846d47e6fe0fec24f3cc..49774b42cdf61fd57a5b70f286c65c9d66bbc0cb 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -40,4 +40,5 @@ obj-$(CONFIG_REBOOT_MODE) += reboot-mode.o
obj-$(CONFIG_SYSCON_REBOOT_MODE) += syscon-reboot-mode.o
obj-$(CONFIG_POWER_RESET_SC27XX) += sc27xx-poweroff.o
obj-$(CONFIG_NVMEM_REBOOT_MODE) += nvmem-reboot-mode.o
+obj-$(CONFIG_PSCI_REBOOT_MODE) += psci-reboot-mode.o
obj-$(CONFIG_POWER_MLXBF) += pwr-mlxbf.o
diff --git a/drivers/power/reset/psci-reboot-mode.c b/drivers/power/reset/psci-reboot-mode.c
new file mode 100644
index 0000000000000000000000000000000000000000..499cf504071e88022fa5b5b32e26b7a674da8691
--- /dev/null
+++ b/drivers/power/reset/psci-reboot-mode.c
@@ -0,0 +1,111 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include <linux/device/faux.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/of.h>
+#include <linux/psci.h>
+#include <linux/reboot.h>
+#include <linux/reboot-mode.h>
+#include <linux/types.h>
+
+/*
+ * Predefined reboot-modes:
+ * reset_type(arg1) is zero; cookie(arg2) is stored in magic.
+ * psci_reboot_mode_set_predefined_modes to move values to higher 32 bit of magic.
+ */
+static struct mode_info psci_resets[] = {
+ { .mode = "warm", .magic = REBOOT_WARM},
+ { .mode = "soft", .magic = REBOOT_SOFT},
+ { .mode = "cold", .magic = REBOOT_COLD},
+};
+
+static void psci_reboot_mode_set_predefined_modes(struct reboot_mode_driver *reboot)
+{
+ INIT_LIST_HEAD(&reboot->predefined_modes);
+ for (u32 i = 0; i < ARRAY_SIZE(psci_resets); i++) {
+ /* Move values to higher 32 bit of magic */
+ psci_resets[i].magic = FIELD_PREP(GENMASK_ULL(63, 32), psci_resets[i].magic);
+ INIT_LIST_HEAD(&psci_resets[i].list);
+ list_add_tail(&psci_resets[i].list, &reboot->predefined_modes);
+ }
+}
+
+/*
+ * magic is 64 bit.
+ * arg1 - reset_type(Low 32 bit of magic).
+ * arg2 - cookie(High 32 bit of magic).
+ * arg2(cookie) decides the mode, If arg1(reset_type) is 0;
+ */
+static int psci_reboot_mode_write(struct reboot_mode_driver *reboot, u64 magic)
+{
+ u32 reset_type = FIELD_GET(GENMASK_ULL(31, 0), magic);
+ u32 cookie = FIELD_GET(GENMASK_ULL(63, 32), magic);
+
+ if (reset_type == 0) {
+ if (cookie == REBOOT_WARM || cookie == REBOOT_SOFT)
+ psci_set_reset_cmd(true, 0, 0);
+ else
+ psci_set_reset_cmd(false, 0, 0);
+ } else {
+ psci_set_reset_cmd(true, reset_type, cookie);
+ }
+
+ return NOTIFY_DONE;
+}
+
+static int psci_reboot_mode_probe(struct faux_device *fdev)
+{
+ struct reboot_mode_driver *reboot;
+ struct device_node *psci_np;
+ struct device_node *np;
+ int ret;
+
+ psci_np = of_find_compatible_node(NULL, NULL, "arm,psci-1.0");
+ if (!psci_np)
+ return -ENODEV;
+
+ /*
+ * Find the psci:reboot-mode node.
+ * If NULL, continue to register predefined modes.
+ * np refcount to be handled by dev;
+ * psci_np refcount is decremented by of_find_node_by_name;
+ */
+ np = of_find_node_by_name(psci_np, "reboot-mode");
+ fdev->dev.of_node = np;
+
+ reboot = devm_kzalloc(&fdev->dev, sizeof(*reboot), GFP_KERNEL);
+ if (!reboot)
+ return -ENOMEM;
+
+ psci_reboot_mode_set_predefined_modes(reboot);
+ reboot->write = psci_reboot_mode_write;
+ reboot->dev = &fdev->dev;
+
+ ret = devm_reboot_mode_register(&fdev->dev, reboot);
+ if (ret) {
+ dev_err(&fdev->dev, "devm_reboot_mode_register failed %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+
+static struct faux_device_ops psci_reboot_mode_ops = {
+ .probe = psci_reboot_mode_probe,
+};
+
+static int __init psci_reboot_mode_init(void)
+{
+ struct faux_device *fdev;
+
+ fdev = faux_device_create("psci-reboot-mode", NULL, &psci_reboot_mode_ops);
+ if (!fdev)
+ return -ENODEV;
+
+ return 0;
+}
+device_initcall(psci_reboot_mode_init);
--
2.34.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH v19 06/10] power: reset: Add psci-reboot-mode driver
2025-12-28 17:20 ` [PATCH v19 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
@ 2026-01-02 11:57 ` Bartosz Golaszewski
2026-01-05 18:05 ` Shivendra Pratap
2026-03-02 12:30 ` Shivendra Pratap
0 siblings, 2 replies; 30+ messages in thread
From: Bartosz Golaszewski @ 2026-01-02 11:57 UTC (permalink / raw)
To: Shivendra Pratap
Cc: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla
On Sun, Dec 28, 2025 at 6:21 PM Shivendra Pratap
<shivendra.pratap@oss.qualcomm.com> wrote:
>
[snip]
> +
> +static int psci_reboot_mode_probe(struct faux_device *fdev)
> +{
> + struct reboot_mode_driver *reboot;
> + struct device_node *psci_np;
> + struct device_node *np;
> + int ret;
> +
> + psci_np = of_find_compatible_node(NULL, NULL, "arm,psci-1.0");
> + if (!psci_np)
> + return -ENODEV;
> +
> + /*
> + * Find the psci:reboot-mode node.
> + * If NULL, continue to register predefined modes.
> + * np refcount to be handled by dev;
> + * psci_np refcount is decremented by of_find_node_by_name;
> + */
Can you make this comment into full sentences, I had trouble parsing
the meaning for a minute.
> + np = of_find_node_by_name(psci_np, "reboot-mode");
> + fdev->dev.of_node = np;
The logic of the device assigning its own node is a bit sketchy,
ideally this should be done before the device probes.
> +
> + reboot = devm_kzalloc(&fdev->dev, sizeof(*reboot), GFP_KERNEL);
> + if (!reboot)
> + return -ENOMEM;
> +
> + psci_reboot_mode_set_predefined_modes(reboot);
> + reboot->write = psci_reboot_mode_write;
> + reboot->dev = &fdev->dev;
> +
> + ret = devm_reboot_mode_register(&fdev->dev, reboot);
> + if (ret) {
> + dev_err(&fdev->dev, "devm_reboot_mode_register failed %d\n", ret);
> + return ret;
Use dev_err_probe().
> + }
> +
> + return 0;
> +}
> +
> +static struct faux_device_ops psci_reboot_mode_ops = {
> + .probe = psci_reboot_mode_probe,
> +};
> +
> +static int __init psci_reboot_mode_init(void)
> +{
> + struct faux_device *fdev;
> +
> + fdev = faux_device_create("psci-reboot-mode", NULL, &psci_reboot_mode_ops);
> + if (!fdev)
> + return -ENODEV;
This will always create this device for everyone who includes this
module. Move the of_find_compatible_node(NULL, NULL, "arm,psci-1.0")
call from probe() here instead and don't create the device if it
fails.
Bart
> +
> + return 0;
> +}
> +device_initcall(psci_reboot_mode_init);
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [PATCH v19 06/10] power: reset: Add psci-reboot-mode driver
2026-01-02 11:57 ` Bartosz Golaszewski
@ 2026-01-05 18:05 ` Shivendra Pratap
2026-01-06 12:34 ` Bartosz Golaszewski
2026-03-02 12:30 ` Shivendra Pratap
1 sibling, 1 reply; 30+ messages in thread
From: Shivendra Pratap @ 2026-01-05 18:05 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla
On 1/2/2026 5:27 PM, Bartosz Golaszewski wrote:
> On Sun, Dec 28, 2025 at 6:21 PM Shivendra Pratap
> <shivendra.pratap@oss.qualcomm.com> wrote:
>>
>
> [snip]
>
>> +
>> +static int psci_reboot_mode_probe(struct faux_device *fdev)
>> +{
>> + struct reboot_mode_driver *reboot;
>> + struct device_node *psci_np;
>> + struct device_node *np;
>> + int ret;
>> +
>> + psci_np = of_find_compatible_node(NULL, NULL, "arm,psci-1.0");
>> + if (!psci_np)
>> + return -ENODEV;
>> +
>> + /*
>> + * Find the psci:reboot-mode node.
>> + * If NULL, continue to register predefined modes.
>> + * np refcount to be handled by dev;
>> + * psci_np refcount is decremented by of_find_node_by_name;
>> + */
>
> Can you make this comment into full sentences, I had trouble parsing
> the meaning for a minute.
Ack.
>
>> + np = of_find_node_by_name(psci_np, "reboot-mode");
>> + fdev->dev.of_node = np;
>
> The logic of the device assigning its own node is a bit sketchy,
> ideally this should be done before the device probes.
Will move it to init. thanks.
>
>> +
>> + reboot = devm_kzalloc(&fdev->dev, sizeof(*reboot), GFP_KERNEL);
>> + if (!reboot)
>> + return -ENOMEM;
>> +
>> + psci_reboot_mode_set_predefined_modes(reboot);
>> + reboot->write = psci_reboot_mode_write;
>> + reboot->dev = &fdev->dev;
>> +
>> + ret = devm_reboot_mode_register(&fdev->dev, reboot);
>> + if (ret) {
>> + dev_err(&fdev->dev, "devm_reboot_mode_register failed %d\n", ret);
>> + return ret;
>
> Use dev_err_probe().
Ack.
>
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +static struct faux_device_ops psci_reboot_mode_ops = {
>> + .probe = psci_reboot_mode_probe,
>> +};
>> +
>> +static int __init psci_reboot_mode_init(void)
>> +{
>> + struct faux_device *fdev;
>> +
>> + fdev = faux_device_create("psci-reboot-mode", NULL, &psci_reboot_mode_ops);
>> + if (!fdev)
>> + return -ENODEV;
>
> This will always create this device for everyone who includes this
> module. Move the of_find_compatible_node(NULL, NULL, "arm,psci-1.0")
> call from probe() here instead and don't create the device if it
> fails.
Ack.
Will move both calls to init before creating the faux device.
psci_np = of_find_compatible_node(NULL, NULL, "arm,psci-1.0");
and
np = of_find_node_by_name(psci_np, "reboot-mode");
--
thanks,
Shivendra
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [PATCH v19 06/10] power: reset: Add psci-reboot-mode driver
2026-01-05 18:05 ` Shivendra Pratap
@ 2026-01-06 12:34 ` Bartosz Golaszewski
2026-01-06 14:45 ` Shivendra Pratap
0 siblings, 1 reply; 30+ messages in thread
From: Bartosz Golaszewski @ 2026-01-06 12:34 UTC (permalink / raw)
To: Shivendra Pratap
Cc: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla
On Mon, Jan 5, 2026 at 7:06 PM Shivendra Pratap
<shivendra.pratap@oss.qualcomm.com> wrote:
>
> >> +static int __init psci_reboot_mode_init(void)
> >> +{
> >> + struct faux_device *fdev;
> >> +
> >> + fdev = faux_device_create("psci-reboot-mode", NULL, &psci_reboot_mode_ops);
> >> + if (!fdev)
> >> + return -ENODEV;
> >
> > This will always create this device for everyone who includes this
> > module. Move the of_find_compatible_node(NULL, NULL, "arm,psci-1.0")
> > call from probe() here instead and don't create the device if it
> > fails.
>
> Ack.
> Will move both calls to init before creating the faux device.
>
> psci_np = of_find_compatible_node(NULL, NULL, "arm,psci-1.0");
> and
> np = of_find_node_by_name(psci_np, "reboot-mode");
> --
>
On a second glance - and I may be totally wrong - would it be possible
to switch to using the auxiliary bus and create this device from
drivers/firmware/psci/psci.c? That would be even cleaner.
Bart
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [PATCH v19 06/10] power: reset: Add psci-reboot-mode driver
2026-01-06 12:34 ` Bartosz Golaszewski
@ 2026-01-06 14:45 ` Shivendra Pratap
2026-01-06 15:06 ` Bartosz Golaszewski
0 siblings, 1 reply; 30+ messages in thread
From: Shivendra Pratap @ 2026-01-06 14:45 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla
On 1/6/2026 6:04 PM, Bartosz Golaszewski wrote:
> On Mon, Jan 5, 2026 at 7:06 PM Shivendra Pratap
> <shivendra.pratap@oss.qualcomm.com> wrote:
>>
>>>> +static int __init psci_reboot_mode_init(void)
>>>> +{
>>>> + struct faux_device *fdev;
>>>> +
>>>> + fdev = faux_device_create("psci-reboot-mode", NULL, &psci_reboot_mode_ops);
>>>> + if (!fdev)
>>>> + return -ENODEV;
>>>
>>> This will always create this device for everyone who includes this
>>> module. Move the of_find_compatible_node(NULL, NULL, "arm,psci-1.0")
>>> call from probe() here instead and don't create the device if it
>>> fails.
>>
>> Ack.
>> Will move both calls to init before creating the faux device.
>>
>> psci_np = of_find_compatible_node(NULL, NULL, "arm,psci-1.0");
>> and
>> np = of_find_node_by_name(psci_np, "reboot-mode");
>> --
>>
>
> On a second glance - and I may be totally wrong - would it be possible
> to switch to using the auxiliary bus and create this device from
> drivers/firmware/psci/psci.c? That would be even cleaner.
Till v17, device was being created in psci.c. Lorenzo wanted to move it
outside psci similar to design of cpuidle-psci.
https://lore.kernel.org/all/aRIfc9iuC2b9DqI+@lpieralisi/
thanks,
Shivendra
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [PATCH v19 06/10] power: reset: Add psci-reboot-mode driver
2026-01-06 14:45 ` Shivendra Pratap
@ 2026-01-06 15:06 ` Bartosz Golaszewski
0 siblings, 0 replies; 30+ messages in thread
From: Bartosz Golaszewski @ 2026-01-06 15:06 UTC (permalink / raw)
To: Shivendra Pratap
Cc: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla
On Tue, Jan 6, 2026 at 3:45 PM Shivendra Pratap
<shivendra.pratap@oss.qualcomm.com> wrote:
>
> On 1/6/2026 6:04 PM, Bartosz Golaszewski wrote:
> > On Mon, Jan 5, 2026 at 7:06 PM Shivendra Pratap
> > <shivendra.pratap@oss.qualcomm.com> wrote:
> >>
> >>>> +static int __init psci_reboot_mode_init(void)
> >>>> +{
> >>>> + struct faux_device *fdev;
> >>>> +
> >>>> + fdev = faux_device_create("psci-reboot-mode", NULL, &psci_reboot_mode_ops);
> >>>> + if (!fdev)
> >>>> + return -ENODEV;
> >>>
> >>> This will always create this device for everyone who includes this
> >>> module. Move the of_find_compatible_node(NULL, NULL, "arm,psci-1.0")
> >>> call from probe() here instead and don't create the device if it
> >>> fails.
> >>
> >> Ack.
> >> Will move both calls to init before creating the faux device.
> >>
> >> psci_np = of_find_compatible_node(NULL, NULL, "arm,psci-1.0");
> >> and
> >> np = of_find_node_by_name(psci_np, "reboot-mode");
> >> --
> >>
> >
> > On a second glance - and I may be totally wrong - would it be possible
> > to switch to using the auxiliary bus and create this device from
> > drivers/firmware/psci/psci.c? That would be even cleaner.
>
> Till v17, device was being created in psci.c. Lorenzo wanted to move it
> outside psci similar to design of cpuidle-psci.
>
> https://lore.kernel.org/all/aRIfc9iuC2b9DqI+@lpieralisi/
>
Thanks for the link. Right, there's no actual psci driver binding to a
struct device, rather we only have a set of functions called very
early into the boot process.
Nevermind this comment
Bart
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v19 06/10] power: reset: Add psci-reboot-mode driver
2026-01-02 11:57 ` Bartosz Golaszewski
2026-01-05 18:05 ` Shivendra Pratap
@ 2026-03-02 12:30 ` Shivendra Pratap
1 sibling, 0 replies; 30+ messages in thread
From: Shivendra Pratap @ 2026-03-02 12:30 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla
On 02-01-2026 17:27, Bartosz Golaszewski wrote:
> On Sun, Dec 28, 2025 at 6:21 PM Shivendra Pratap
> <shivendra.pratap@oss.qualcomm.com> wrote:
>>
>
> [snip]
>
>> +
>> +static int psci_reboot_mode_probe(struct faux_device *fdev)
>> +{
>> + struct reboot_mode_driver *reboot;
>> + struct device_node *psci_np;
>> + struct device_node *np;
>> + int ret;
>> +
>> + psci_np = of_find_compatible_node(NULL, NULL, "arm,psci-1.0");
>> + if (!psci_np)
>> + return -ENODEV;
>> +
>> + /*
>> + * Find the psci:reboot-mode node.
>> + * If NULL, continue to register predefined modes.
>> + * np refcount to be handled by dev;
>> + * psci_np refcount is decremented by of_find_node_by_name;
>> + */
>
> Can you make this comment into full sentences, I had trouble parsing
> the meaning for a minute.
>
>> + np = of_find_node_by_name(psci_np, "reboot-mode");
>> + fdev->dev.of_node = np;
>
> The logic of the device assigning its own node is a bit sketchy,
> ideally this should be done before the device probes.
Got one doubt while trying to move it to init.
We used a faux_device_create() in init.
faux_device_create() calls the probe function from within its
implementation, so do not find a way to set the node "fdev->dev.of_node
= np" before the probe call when using faux device.
thanks,
Shivendra
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v19 07/10] arm64: dts: qcom: qcm6490: Add psci reboot-modes
2025-12-28 17:20 [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (5 preceding siblings ...)
2025-12-28 17:20 ` [PATCH v19 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
@ 2025-12-28 17:20 ` Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 08/10] arm64: dts: qcom: lemans: " Shivendra Pratap
` (3 subsequent siblings)
10 siblings, 0 replies; 30+ messages in thread
From: Shivendra Pratap @ 2025-12-28 17:20 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Shivendra Pratap, Srinivas Kandagatla
Add PSCI SYSTEM_RESET2 reboot-modes for qcm6490-idp and qcs6490-rb3gen2
for use by the psci_reboot_mode driver.
The following modes are defined:
- bootloader: reboot into fastboot mode for fastboot flashing.
- edl: reboot into emergency download mode for image loading via
the Firehose protocol.
Support for these modes is firmware dependent and not available across
all sc7280 based boards.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/kodiak.dtsi | 2 +-
arch/arm64/boot/dts/qcom/qcm6490-idp.dts | 7 +++++++
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 7 +++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/kodiak.dtsi b/arch/arm64/boot/dts/qcom/kodiak.dtsi
index c2ccbb67f800cb9927627f991e3d97174cc73c64..e319a1894901cc9c56a89cb8b8ad0acb7a18dc99 100644
--- a/arch/arm64/boot/dts/qcom/kodiak.dtsi
+++ b/arch/arm64/boot/dts/qcom/kodiak.dtsi
@@ -858,7 +858,7 @@ pmu-a78 {
interrupts = <GIC_PPI 7 IRQ_TYPE_LEVEL_LOW>;
};
- psci {
+ psci: psci {
compatible = "arm,psci-1.0";
method = "smc";
diff --git a/arch/arm64/boot/dts/qcom/qcm6490-idp.dts b/arch/arm64/boot/dts/qcom/qcm6490-idp.dts
index 089a027c57d5caed103f41f20c01fe1294b4c950..5816cc1c033c396f49fddbbcd4b09e5a633bc804 100644
--- a/arch/arm64/boot/dts/qcom/qcm6490-idp.dts
+++ b/arch/arm64/boot/dts/qcom/qcm6490-idp.dts
@@ -695,6 +695,13 @@ &pon_resin {
status = "okay";
};
+&psci {
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
+};
+
&qupv3_id_0 {
status = "okay";
};
diff --git a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
index f29a352b0288e9ef554ecfff59820ba39bf2cdb1..6e836e476d595b7e1b69a0859cf2f697c529cbfa 100644
--- a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
+++ b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
@@ -935,6 +935,13 @@ &pon_resin {
status = "okay";
};
+&psci {
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
+};
+
&qup_uart7_cts {
/*
* Configure a bias-bus-hold on CTS to lower power
--
2.34.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v19 08/10] arm64: dts: qcom: lemans: Add psci reboot-modes
2025-12-28 17:20 [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (6 preceding siblings ...)
2025-12-28 17:20 ` [PATCH v19 07/10] arm64: dts: qcom: qcm6490: Add psci reboot-modes Shivendra Pratap
@ 2025-12-28 17:20 ` Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 09/10] arm64: dts: qcom: monaco: " Shivendra Pratap
` (2 subsequent siblings)
10 siblings, 0 replies; 30+ messages in thread
From: Shivendra Pratap @ 2025-12-28 17:20 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Shivendra Pratap, Srinivas Kandagatla
Add PSCI SYSTEM_RESET2 reboot-modes for lemans based boards, for use by
the psci_reboot_mode driver.
The following modes are defined:
- bootloader: reboot into fastboot mode for fastboot flashing.
- edl: reboot into emergency download mode for image loading via
the Firehose protocol.
Support for these modes is firmware dependent.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/lemans.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/lemans.dtsi b/arch/arm64/boot/dts/qcom/lemans.dtsi
index 0b154d57ba24e69a9d900f06bbb22baa2781cc3f..cc70316d6949c8a36280b85931c4adec9cd60f62 100644
--- a/arch/arm64/boot/dts/qcom/lemans.dtsi
+++ b/arch/arm64/boot/dts/qcom/lemans.dtsi
@@ -698,6 +698,11 @@ system_pd: power-domain-system {
#power-domain-cells = <0>;
domain-idle-states = <&cluster_sleep_apss_rsc_pc>;
};
+
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
};
reserved-memory {
--
2.34.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v19 09/10] arm64: dts: qcom: monaco: Add psci reboot-modes
2025-12-28 17:20 [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (7 preceding siblings ...)
2025-12-28 17:20 ` [PATCH v19 08/10] arm64: dts: qcom: lemans: " Shivendra Pratap
@ 2025-12-28 17:20 ` Shivendra Pratap
2025-12-28 17:20 ` [PATCH v19 10/10] arm64: dts: qcom: talos: " Shivendra Pratap
2026-01-06 11:08 ` [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
10 siblings, 0 replies; 30+ messages in thread
From: Shivendra Pratap @ 2025-12-28 17:20 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Shivendra Pratap, Srinivas Kandagatla
Add PSCI SYSTEM_RESET2 reboot-modes for monaco based boards, for use by
the psci_reboot_mode driver.
The following modes are defined:
- bootloader: reboot into fastboot mode for fastboot flashing.
- edl: reboot into emergency download mode for image loading via
the Firehose protocol.
Support for these modes is firmware dependent.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/monaco.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/monaco.dtsi b/arch/arm64/boot/dts/qcom/monaco.dtsi
index 816fa2af8a9a663b8ad176f93d2f18284a08c3d1..9c8087f870fc8889edffda63c62f4d5167729cbc 100644
--- a/arch/arm64/boot/dts/qcom/monaco.dtsi
+++ b/arch/arm64/boot/dts/qcom/monaco.dtsi
@@ -732,6 +732,11 @@ system_pd: power-domain-system {
#power-domain-cells = <0>;
domain-idle-states = <&system_sleep>;
};
+
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
};
reserved-memory {
--
2.34.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v19 10/10] arm64: dts: qcom: talos: Add psci reboot-modes
2025-12-28 17:20 [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (8 preceding siblings ...)
2025-12-28 17:20 ` [PATCH v19 09/10] arm64: dts: qcom: monaco: " Shivendra Pratap
@ 2025-12-28 17:20 ` Shivendra Pratap
2026-01-06 11:08 ` [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
10 siblings, 0 replies; 30+ messages in thread
From: Shivendra Pratap @ 2025-12-28 17:20 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, John Stultz, Matthias Brugger,
Moritz Fischer, Mark Rutland, Conor Dooley, Konrad Dybcio,
Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Shivendra Pratap, Srinivas Kandagatla, Song Xue
Add PSCI SYSTEM_RESET2 reboot-modes for talos based boards, for use by
the psci_reboot_mode driver.
The following modes are defined:
- bootloader: reboot into fastboot mode for fastboot flashing.
- edl: reboot into emergency download mode for image loading via
the Firehose protocol.
Support for these modes is firmware dependent.
Signed-off-by: Song Xue <quic_songxue@quicinc.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/talos.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/talos.dtsi b/arch/arm64/boot/dts/qcom/talos.dtsi
index 95d26e3136229f9015d49e2be22f6b28f1e842f4..11a2cfa209065776a8ae61c6e661c09bb871c400 100644
--- a/arch/arm64/boot/dts/qcom/talos.dtsi
+++ b/arch/arm64/boot/dts/qcom/talos.dtsi
@@ -613,6 +613,11 @@ cluster_pd: power-domain-cluster {
&cluster_sleep_1
&cluster_sleep_2>;
};
+
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
};
reserved-memory {
--
2.34.1
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets
2025-12-28 17:20 [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (9 preceding siblings ...)
2025-12-28 17:20 ` [PATCH v19 10/10] arm64: dts: qcom: talos: " Shivendra Pratap
@ 2026-01-06 11:08 ` Shivendra Pratap
2026-01-24 10:38 ` Shivendra Pratap
10 siblings, 1 reply; 30+ messages in thread
From: Shivendra Pratap @ 2026-01-06 11:08 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla, Umang Chheda, Nirmesh Kumar Singh, Song Xue,
Arnd Bergmann, Bjorn Andersson, Sebastian Reichel, Rob Herring,
Sudeep Holla, Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan,
Matthias Brugger, Moritz Fischer, Mark Rutland, Conor Dooley,
Konrad Dybcio, Bartosz Golaszewski
On 12/28/2025 10:50 PM, Shivendra Pratap wrote:
> Userspace should be able to initiate device reboots using the various
> PSCI SYSTEM_RESET and SYSTEM_RESET2 types defined by PSCI spec. This
> patch series introduces psci-reboot-mode driver that registers with
> reboot-mode framework to provide this functionality.
>
> The PSCI system reset calls takes two arguments: reset_type and cookie.
> It defines predefined reset types, such as warm and cold reset, and
> vendor-specific reset types which are SoC vendor specific. To support
> these requirements, the reboot-mode framework is enhanced in two key
> ways:
> 1. 64-bit magic support: Extend reboot-mode to handle two 32-bit
> arguments (reset_type and cookie) by encoding them into a single 64-bit
> magic value.
> 2. Predefined modes: Add support for predefined reboot modes in the
> framework.
>
> With these enhancements, the patch series enables:
> - Warm reset and cold reset as predefined reboot modes.
> - Vendor-specific resets exposed as tunables, configurable via the
> SoC-specific device tree.
>
> Together, these changes allow userspace to trigger all above PSCI resets
> from userspace.
>
Hi Lorenzo,
Is this patch series now converging towards the design changes you
proposed in v17? We’d like to conclude the design so we can move it
towards closure.
Thanks,
Shivendra
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets
2026-01-06 11:08 ` [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
@ 2026-01-24 10:38 ` Shivendra Pratap
2026-01-26 13:38 ` Lorenzo Pieralisi
0 siblings, 1 reply; 30+ messages in thread
From: Shivendra Pratap @ 2026-01-24 10:38 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla, Umang Chheda, Nirmesh Kumar Singh, Song Xue,
Arnd Bergmann, Bjorn Andersson, Sebastian Reichel, Rob Herring,
Sudeep Holla, Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan,
Matthias Brugger, Moritz Fischer, Mark Rutland, Conor Dooley,
Konrad Dybcio, Bartosz Golaszewski
On 1/6/2026 4:38 PM, Shivendra Pratap wrote:
>
>
> On 12/28/2025 10:50 PM, Shivendra Pratap wrote:
>> Userspace should be able to initiate device reboots using the various
>> PSCI SYSTEM_RESET and SYSTEM_RESET2 types defined by PSCI spec. This
>> patch series introduces psci-reboot-mode driver that registers with
>> reboot-mode framework to provide this functionality.
>>
>> The PSCI system reset calls takes two arguments: reset_type and cookie.
>> It defines predefined reset types, such as warm and cold reset, and
>> vendor-specific reset types which are SoC vendor specific. To support
>> these requirements, the reboot-mode framework is enhanced in two key
>> ways:
>> 1. 64-bit magic support: Extend reboot-mode to handle two 32-bit
>> arguments (reset_type and cookie) by encoding them into a single 64-bit
>> magic value.
>> 2. Predefined modes: Add support for predefined reboot modes in the
>> framework.
>>
>> With these enhancements, the patch series enables:
>> - Warm reset and cold reset as predefined reboot modes.
>> - Vendor-specific resets exposed as tunables, configurable via the
>> SoC-specific device tree.
>>
>> Together, these changes allow userspace to trigger all above PSCI resets
>> from userspace.
>>
>
> Hi Lorenzo,
>
> Is this patch series now converging towards the design changes you
> proposed in v17? We’d like to conclude the design so we can move it
> towards closure.
Hi Lorenzo,
Can you please review if the design aligns with your proposed changes?
thanks,
Shivendra
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets
2026-01-24 10:38 ` Shivendra Pratap
@ 2026-01-26 13:38 ` Lorenzo Pieralisi
2026-02-10 14:05 ` Shivendra Pratap
0 siblings, 1 reply; 30+ messages in thread
From: Lorenzo Pieralisi @ 2026-01-26 13:38 UTC (permalink / raw)
To: Shivendra Pratap
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla, Umang Chheda, Nirmesh Kumar Singh, Song Xue,
Arnd Bergmann, Bjorn Andersson, Sebastian Reichel, Rob Herring,
Sudeep Holla, Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan,
Matthias Brugger, Moritz Fischer, Mark Rutland, Conor Dooley,
Konrad Dybcio, Bartosz Golaszewski
On Sat, Jan 24, 2026 at 04:08:11PM +0530, Shivendra Pratap wrote:
>
>
> On 1/6/2026 4:38 PM, Shivendra Pratap wrote:
> >
> >
> > On 12/28/2025 10:50 PM, Shivendra Pratap wrote:
> >> Userspace should be able to initiate device reboots using the various
> >> PSCI SYSTEM_RESET and SYSTEM_RESET2 types defined by PSCI spec. This
> >> patch series introduces psci-reboot-mode driver that registers with
> >> reboot-mode framework to provide this functionality.
> >>
> >> The PSCI system reset calls takes two arguments: reset_type and cookie.
> >> It defines predefined reset types, such as warm and cold reset, and
> >> vendor-specific reset types which are SoC vendor specific. To support
> >> these requirements, the reboot-mode framework is enhanced in two key
> >> ways:
> >> 1. 64-bit magic support: Extend reboot-mode to handle two 32-bit
> >> arguments (reset_type and cookie) by encoding them into a single 64-bit
> >> magic value.
> >> 2. Predefined modes: Add support for predefined reboot modes in the
> >> framework.
> >>
> >> With these enhancements, the patch series enables:
> >> - Warm reset and cold reset as predefined reboot modes.
> >> - Vendor-specific resets exposed as tunables, configurable via the
> >> SoC-specific device tree.
> >>
> >> Together, these changes allow userspace to trigger all above PSCI resets
> >> from userspace.
> >>
> >
> > Hi Lorenzo,
> >
> > Is this patch series now converging towards the design changes you
> > proposed in v17? We’d like to conclude the design so we can move it
> > towards closure.
>
> Hi Lorenzo,
>
> Can you please review if the design aligns with your proposed changes?
I will try to do it this week.
Thanks,
Lorenzo
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets
2026-01-26 13:38 ` Lorenzo Pieralisi
@ 2026-02-10 14:05 ` Shivendra Pratap
2026-03-02 12:39 ` Shivendra Pratap
0 siblings, 1 reply; 30+ messages in thread
From: Shivendra Pratap @ 2026-02-10 14:05 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla, Umang Chheda, Nirmesh Kumar Singh, Song Xue,
Arnd Bergmann, Bjorn Andersson, Sebastian Reichel, Rob Herring,
Sudeep Holla, Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan,
Matthias Brugger, Moritz Fischer, Mark Rutland, Conor Dooley,
Konrad Dybcio, Bartosz Golaszewski
On 1/26/2026 7:08 PM, Lorenzo Pieralisi wrote:
> On Sat, Jan 24, 2026 at 04:08:11PM +0530, Shivendra Pratap wrote:
>>
>>
>> On 1/6/2026 4:38 PM, Shivendra Pratap wrote:
>>>
>>>
>>> On 12/28/2025 10:50 PM, Shivendra Pratap wrote:
>>>> Userspace should be able to initiate device reboots using the various
>>>> PSCI SYSTEM_RESET and SYSTEM_RESET2 types defined by PSCI spec. This
>>>> patch series introduces psci-reboot-mode driver that registers with
>>>> reboot-mode framework to provide this functionality.
>>>>
>>>> The PSCI system reset calls takes two arguments: reset_type and cookie.
>>>> It defines predefined reset types, such as warm and cold reset, and
>>>> vendor-specific reset types which are SoC vendor specific. To support
>>>> these requirements, the reboot-mode framework is enhanced in two key
>>>> ways:
>>>> 1. 64-bit magic support: Extend reboot-mode to handle two 32-bit
>>>> arguments (reset_type and cookie) by encoding them into a single 64-bit
>>>> magic value.
>>>> 2. Predefined modes: Add support for predefined reboot modes in the
>>>> framework.
>>>>
>>>> With these enhancements, the patch series enables:
>>>> - Warm reset and cold reset as predefined reboot modes.
>>>> - Vendor-specific resets exposed as tunables, configurable via the
>>>> SoC-specific device tree.
>>>>
>>>> Together, these changes allow userspace to trigger all above PSCI resets
>>>> from userspace.
>>>>
>>>
>>> Hi Lorenzo,
>>>
>>> Is this patch series now converging towards the design changes you
>>> proposed in v17? We’d like to conclude the design so we can move it
>>> towards closure.
>>
>> Hi Lorenzo,
>>
>> Can you please review if the design aligns with your proposed changes?
>
> I will try to do it this week.
Hi Lorenzo,
Any pointers, if the change aligns towards your suggestions about the
psci_sys_resets?
thanks,
Shivendra
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v19 00/10] Implement PSCI reboot mode driver for PSCI resets
2026-02-10 14:05 ` Shivendra Pratap
@ 2026-03-02 12:39 ` Shivendra Pratap
0 siblings, 0 replies; 30+ messages in thread
From: Shivendra Pratap @ 2026-03-02 12:39 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, devicetree,
Srinivas Kandagatla, Umang Chheda, Nirmesh Kumar Singh, Song Xue,
Arnd Bergmann, Bjorn Andersson, Sebastian Reichel, Rob Herring,
Sudeep Holla, Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan,
Matthias Brugger, Moritz Fischer, Mark Rutland, Conor Dooley,
Konrad Dybcio, Bartosz Golaszewski
On 10-02-2026 19:35, Shivendra Pratap wrote:
>
>
> On 1/26/2026 7:08 PM, Lorenzo Pieralisi wrote:
>> On Sat, Jan 24, 2026 at 04:08:11PM +0530, Shivendra Pratap wrote:
>>>
>>>
>>> On 1/6/2026 4:38 PM, Shivendra Pratap wrote:
>>>>
>>>>
>>>> On 12/28/2025 10:50 PM, Shivendra Pratap wrote:
>>>>> Userspace should be able to initiate device reboots using the various
>>>>> PSCI SYSTEM_RESET and SYSTEM_RESET2 types defined by PSCI spec. This
>>>>> patch series introduces psci-reboot-mode driver that registers with
>>>>> reboot-mode framework to provide this functionality.
>>>>>
>>>>> The PSCI system reset calls takes two arguments: reset_type and cookie.
>>>>> It defines predefined reset types, such as warm and cold reset, and
>>>>> vendor-specific reset types which are SoC vendor specific. To support
>>>>> these requirements, the reboot-mode framework is enhanced in two key
>>>>> ways:
>>>>> 1. 64-bit magic support: Extend reboot-mode to handle two 32-bit
>>>>> arguments (reset_type and cookie) by encoding them into a single 64-bit
>>>>> magic value.
>>>>> 2. Predefined modes: Add support for predefined reboot modes in the
>>>>> framework.
>>>>>
>>>>> With these enhancements, the patch series enables:
>>>>> - Warm reset and cold reset as predefined reboot modes.
>>>>> - Vendor-specific resets exposed as tunables, configurable via the
>>>>> SoC-specific device tree.
>>>>>
>>>>> Together, these changes allow userspace to trigger all above PSCI resets
>>>>> from userspace.
>>>>>
>>>>
>>>> Hi Lorenzo,
>>>>
>>>> Is this patch series now converging towards the design changes you
>>>> proposed in v17? We’d like to conclude the design so we can move it
>>>> towards closure.
>>>
>>> Hi Lorenzo,
>>>
>>> Can you please review if the design aligns with your proposed changes?
>>
>> I will try to do it this week.
>
> Hi Lorenzo,
>
> Any pointers, if the change aligns towards your suggestions about the
> psci_sys_resets?
Hi Lorenzo,
Was planning to address the current reviews to send the next version,
wanted to check if you could check this approach towards psci-reboot-modes?
thanks,
Shivendra
^ permalink raw reply [flat|nested] 30+ messages in thread