* [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2
@ 2025-07-10 9:15 Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration Shivendra Pratap
` (10 more replies)
0 siblings, 11 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 9:15 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Shivendra Pratap,
Srinivas Kandagatla, Elliot Berman, Konrad Dybcio, Konrad Dybcio
The PSCI SYSTEM_RESET2 call allows vendor firmware to define
additional reset types which could be mapped to the reboot
argument.
User-space should be able to reboot a device into different
operational boot-states supported by underlying bootloader and
firmware. Generally, some HW registers need to be written, based
on which the bootloader and firmware decide the next boot state
of device, after the reset. For example, a requirement on
Qualcomm platforms may state that reboot with "bootloader"
command, should reboot the device into bootloader flashing mode
and reboot with “edl” command, should reboot the device into an
Emergency flashing mode. Setting up such reboots on Qualcomm
devices can be inconsistent across SoC platforms and may require
setting different HW registers, where some of these registers may
not be accessible to HLOS. These knobs evolve over product
generations and require more drivers. PSCI defines a
vendor-specific reset in SYSTEM_RESET2 spec, which enables the
firmware to take care of underlying setting for any such
supported vendor-specific reboot. Qualcomm firmwares are
beginning to support and expose PSCI SYSTEM_RESET2
vendor-specific reset types to simplify driver requirements from
Linux. With such support added in the firmware, we now need a
Linux interface which can make use of the firmware calls for PSCI
vendor-specific resets. This will align such reboot requirement
across platforms and vendors.
The current psci driver supports two types of resets –
SYSTEM_RESET2 Arch warm-reset and SYSTEM_RESET cold-reset. The
patchset introduces the PSCI SYSTEM_RESET2 vendor-specific reset
into the reset path of the psci driver and aligns it to work with
reboot system call - LINUX_REBOOT_CMD_RESTART2, when used along
with a supported string-based command in “*arg”.
The patchset uses reboot-mode based commands, to define the
supported vendor reset-types commands in psci device tree node
and registers these commands with the reboot-mode framework.
The PSCI vendor-specific reset takes two arguments, being,
reset_type and cookie as defined by the spec. As the
vendor-specific reset needs two arguments reset_type and cookie
to be passes to the firmware, enhance the reboot-mode framework
to support two arguments (magic and cookie), for each reboot-mode
command, where cookie will be optional.
Along this line, the patchset also extends the reboot-mode
framework to add a non-device-based registration function which
will allow drivers to register using DT node, while keeping
backward compatibility for existing users of reboot-mode. This
will enable psci driver to register for reboot-mode and implement
a write_with_cookie function which will save the
magic(reset_type) and cookie and then use it in psci reset path
to make a vendor-specific reset call into the firmware. In
addition, the patchset will expose a sysfs entry interface within
reboot-mode which can be used by userspace to view the supported
reboot-mode commands.
The list of vendor-specific reset commands remains open due to
divergent requirements across vendors, but this can be
streamlined and standardized through dedicated device tree
bindings.
Currently three drivers register with reboot-mode framework -
syscon-reboot-mode, nvmem-reboot-mode and qcom-pon. Consolidated
list of commands currently added across various vendor DTs:
mode-loader
mode-normal
mode-bootloader
mode-charge
mode-fastboot
mode-reboot-ab-update
mode-recovery
mode-rescue
mode-shutdown-thermal
mode-shutdown-thermal-battery
Detailed list of commands being used by syscon-reboot-mode:
arm64/boot/dts/exynos/exynosautov9.dtsi:
mode-bootloader = <EXYNOSAUTOV9_BOOT_BOOTLOADER>;
mode-fastboot = <EXYNOSAUTOV9_BOOT_FASTBOOT>;
mode-recovery = <EXYNOSAUTOV9_BOOT_RECOVERY>;
arm64/boot/dts/exynos/google/gs101.dtsi:
mode-bootloader = <0xfc>;
mode-charge = <0x0a>;
mode-fastboot = <0xfa>;
mode-reboot-ab-update = <0x52>;
mode-recovery = <0xff>;
mode-rescue = <0xf9>;
mode-shutdown-thermal = <0x51>;
mode-shutdown-thermal-battery = <0x51>;
arm64/boot/dts/hisilicon/hi3660-hikey960.dts:
mode-normal = <0x77665501>;
mode-bootloader = <0x77665500>;
mode-recovery = <0x77665502>;
arm64/boot/dts/hisilicon/hi6220-hikey.dts:
mode-normal = <0x77665501>;
mode-bootloader = <0x77665500>;
mode-recovery = <0x77665502>;
arm64/boot/dts/rockchip/px30.dtsi:
mode-bootloader = <BOOT_BL_DOWNLOAD>;
mode-fastboot = <BOOT_FASTBOOT>;
mode-loader = <BOOT_BL_DOWNLOAD>;
mode-normal = <BOOT_NORMAL>;
mode-recovery = <BOOT_RECOVERY>;
arm64/boot/dts/rockchip/rk3308.dtsi:
mode-bootloader = <BOOT_BL_DOWNLOAD>;
mode-loader = <BOOT_BL_DOWNLOAD>;
mode-normal = <BOOT_NORMAL>;
mode-recovery = <BOOT_RECOVERY>;
mode-fastboot = <BOOT_FASTBOOT>;
arm64/boot/dts/rockchip/rk3566-lckfb-tspi.dts:
mode-normal = <BOOT_NORMAL>;
mode-loader = <BOOT_BL_DOWNLOAD>;
mode-recovery = <BOOT_RECOVERY>;
mode-bootloader = <BOOT_FASTBOOT>;
Detailed list of commands being used by nvmem-reboot-mode:
arm64/boot/dts/qcom/pmXXXX.dtsi:(multiple qcom DTs)
mode-recovery = <0x01>;
mode-bootloader = <0x02>;
Previous discussions around SYSTEM_RESET2:
- https://lore.kernel.org/lkml/20230724223057.1208122-2-quic_eberman@quicinc.com/T/
- https://lore.kernel.org/all/4a679542-b48d-7e11-f33a-63535a5c68cb@quicinc.com/
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Changes in V10:
- Change in reset-type binding to make cookie as a mandatory
argument.
- Change reboot-mode binding to support additional argument
"cookie".
From Lorenzo:
- Use reboot-mode framework for implementing vendor-resets.
- Modify reboot-mode framework to support two arguments
(magic and cookie).
- Expose sysfs for supported reboot-modes commands.
- List out all existing reboot-mode commands and their users.
- Added this to cover letter.
From Dmitry:
- Modify reboot-mode to support non-device based registration.
- Modify reboot-mode to create a class and device to expose
sysfs interface.
- Link to v9: https://lore.kernel.org/all/20250303-arm-psci-system_reset2-vendor-reboots-v9-0-b2cf4a20feda@oss.qualcomm.com/
Changes in v9:
- Don't fallback to architecturally defined resets from Lorenzo.
- Link to v8: https://lore.kernel.org/r/20241107-arm-psci-system_reset2-vendor-reboots-v8-0-e8715fa65cb5@quicinc.com
Changes in v8:
- Code style nits from Stephen
- Add rb3gen2
- Link to v7: https://lore.kernel.org/r/20241028-arm-psci-system_reset2-vendor-reboots-v7-0-a4c40b0ebc54@quicinc.com
Changes in v7:
- Code style nits from Stephen
- Dropped unnecessary hunk from the sa8775p-ride patch
- Link to v6: https://lore.kernel.org/r/20241018-arm-psci-system_reset2-vendor-reboots-v6-0-50cbe88b0a24@quicinc.com
Changes in v6:
- Rebase to v6.11 and fix trivial conflicts in qcm6490-idp
- Add sa8775p-ride support (same as qcm6490-idp)
- Link to v5: https://lore.kernel.org/r/20240617-arm-psci-system_reset2-vendor-reboots-v5-0-086950f650c8@quicinc.com
Changes in v5:
- Drop the nested "items" in prep for future dtschema tools
- Link to v4: https://lore.kernel.org/r/20240611-arm-psci-system_reset2-vendor-reboots-v4-0-98f55aa74ae8@quicinc.com
Changes in v4:
- Change mode- properties from uint32-matrix to uint32-array
- Restructure the reset-types node so only the restriction is in the
if/then schemas and not the entire definition
- Link to v3: https://lore.kernel.org/r/20240515-arm-psci-system_reset2-vendor-reboots-v3-0-16dd4f9c0ab4@quicinc.com
Changes in v3:
- Limit outer number of items to 1 for mode-* properties
- Move the reboot-mode for psci under a subnode "reset-types"
- Fix the DT node in qcm6490-idp so it doesn't overwrite the one from
sc7820.dtsi
- Link to v2: https://lore.kernel.org/r/20240414-arm-psci-system_reset2-vendor-reboots-v2-0-da9a055a648f@quicinc.com
Changes in v2:
- Fixes to schema as suggested by Rob and Krzysztof
- Add qcm6490 idp as first Qualcomm device to support
- Link to v1: https://lore.kernel.org/r/20231117-arm-psci-system_reset2-vendor-reboots-v1-0-03c4612153e2@quicinc.com
Changes in v1:
- Reference reboot-mode bindings as suggeted by Rob.
- Link to RFC: https://lore.kernel.org/r/20231030-arm-psci-system_reset2-vendor-reboots-v1-0-dcdd63352ad1@quicinc.com
---
Elliot Berman (4):
dt-bindings: arm: Document reboot mode magic
arm64: dts: qcom: qcm6490-idp: Add PSCI SYSTEM_RESET2 types
arm64: dts: qcom: qcs6490-rb3gen2: Add PSCI SYSTEM_RESET2 types
arm64: dts: qcom: sa8775p-ride: Add PSCI SYSTEM_RESET2 types
Shivendra Pratap (6):
power: reset: reboot-mode: Add device tree node-based registration
dt-bindings: power: reset: Document reboot-mode cookie
power: reset: reboot-mode: Add optional cookie argument
firmware: psci: Implement vendor-specific reset-types as reboot-mode
Documentation: ABI: Add sysfs-class-reboot-mode-reboot_modes
power: reset: reboot-mode: Expose sysfs for registered arguments
.../testing/sysfs-class-reboot-mode-reboot_modes | 39 ++++++
Documentation/devicetree/bindings/arm/psci.yaml | 41 ++++++
.../bindings/power/reset/reboot-mode.yaml | 12 +-
arch/arm64/boot/dts/qcom/qcm6490-idp.dts | 7 ++
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 7 ++
arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi | 7 ++
arch/arm64/boot/dts/qcom/sa8775p.dtsi | 2 +-
arch/arm64/boot/dts/qcom/sc7280.dtsi | 2 +-
drivers/firmware/psci/Kconfig | 1 +
drivers/firmware/psci/psci.c | 53 +++++++-
drivers/power/reset/reboot-mode.c | 140 +++++++++++++++++----
include/linux/reboot-mode.h | 5 +-
12 files changed, 280 insertions(+), 36 deletions(-)
---
base-commit: 58ba80c4740212c29a1cf9b48f588e60a7612209
change-id: 20250709-arm-psci-system_reset2-vendor-reboots-46c80044afcf
Best regards,
--
Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration
2025-07-10 9:15 [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Shivendra Pratap
@ 2025-07-10 9:15 ` Shivendra Pratap
2025-07-11 1:14 ` kernel test robot
` (2 more replies)
2025-07-10 9:15 ` [PATCH v10 02/10] dt-bindings: power: reset: Document reboot-mode cookie Shivendra Pratap
` (9 subsequent siblings)
10 siblings, 3 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 9:15 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Shivendra Pratap,
Srinivas Kandagatla
The reboot-mode driver does not have a strict requirement for
device-based registration. It primarily uses the device's of_node
to read mode-<cmd> properties and the device pointer for logging.
Remove the dependency on struct device and introduce support for
Device Tree (DT) node-based registration. This enables drivers
that are not associated with a struct device to leverage the
reboot-mode framework.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/reboot-mode.c | 23 +++++++++++++----------
include/linux/reboot-mode.h | 2 +-
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index fba53f638da04655e756b5f8b7d2d666d1379535..61f647b23959789a313f3af0bd967abcad45fa43 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -12,6 +12,7 @@
#include <linux/reboot-mode.h>
#define PREFIX "mode-"
+#define pr_fmt(fmt) "reboot-mode: " fmt
struct mode_info {
const char *mode;
@@ -65,14 +66,14 @@ static int reboot_mode_notify(struct notifier_block *this,
/**
* reboot_mode_register - register a reboot mode driver
* @reboot: reboot mode driver
+ * @np: Pointer to device tree node
*
* Returns: 0 on success or a negative error code on failure.
*/
-int reboot_mode_register(struct reboot_mode_driver *reboot)
+int reboot_mode_register(struct reboot_mode_driver *reboot, struct device_node *np)
{
struct mode_info *info;
struct property *prop;
- struct device_node *np = reboot->dev->of_node;
size_t len = strlen(PREFIX);
int ret;
@@ -82,16 +83,15 @@ 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);
+ 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);
+ pr_err("reboot mode %s without magic number\n", info->mode);
+ kfree(info);
continue;
}
@@ -102,8 +102,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;
}
@@ -130,11 +129,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) {
kfree_const(info->mode);
+ list_del(&info->list);
+ kfree(info);
+ }
return 0;
}
@@ -162,7 +165,7 @@ int devm_reboot_mode_register(struct device *dev,
if (!dr)
return -ENOMEM;
- rc = reboot_mode_register(reboot);
+ rc = reboot_mode_register(reboot, reboot->dev->of_node);
if (rc) {
devres_free(dr);
return rc;
diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h
index 4a2abb38d1d612ec0fdf05eb18c98b210f631b7f..36f071f4b82e1fc255d8dd679a18e537655c3179 100644
--- a/include/linux/reboot-mode.h
+++ b/include/linux/reboot-mode.h
@@ -9,7 +9,7 @@ struct reboot_mode_driver {
struct notifier_block reboot_notifier;
};
-int reboot_mode_register(struct reboot_mode_driver *reboot);
+int reboot_mode_register(struct reboot_mode_driver *reboot, struct device_node *np);
int reboot_mode_unregister(struct reboot_mode_driver *reboot);
int devm_reboot_mode_register(struct device *dev,
struct reboot_mode_driver *reboot);
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v10 02/10] dt-bindings: power: reset: Document reboot-mode cookie
2025-07-10 9:15 [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration Shivendra Pratap
@ 2025-07-10 9:15 ` Shivendra Pratap
2025-07-10 22:47 ` Rob Herring
2025-07-10 9:15 ` [PATCH v10 03/10] power: reset: reboot-mode: Add optional cookie argument Shivendra Pratap
` (8 subsequent siblings)
10 siblings, 1 reply; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 9:15 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Shivendra Pratap,
Srinivas Kandagatla
Update the reboot-mode binding to support an optional cookie
value in mode-<cmd> properties. The cookie is used to supply
additional data for reboot modes that accept two arguments.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
.../devicetree/bindings/power/reset/reboot-mode.yaml | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
index 3ddac06cec7277789b066d8426ea77d293298fac..a4d2fe1db51e0c1f34ebefddaad82b8cc0b1b34a 100644
--- a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
+++ b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
@@ -10,14 +10,15 @@ maintainers:
- Andy Yan <andy.yan@rock-chips.com>
description: |
- This driver get reboot mode arguments and call the write
- interface to store the magic value in special register
- or ram. Then the bootloader can read it and take different
- action according to the argument stored.
+ This driver gets reboot mode arguments and calls the write
+ interface to store the magic and an optional cookie value
+ in special register or ram. Then the bootloader can read it
+ and take different action according to the argument stored.
All mode properties are vendor specific, it is a indication to tell
the bootloader what to do when the system reboots, and should be named
- as mode-xxx = <magic> (xxx is mode name, magic should be a non-zero value).
+ as mode-xxx = <magic cookie> (xxx is mode name, magic should be a
+ non-zero value, cookie is optional).
For example, modes common Android platform are:
- normal: Normal reboot mode, system reboot with command "reboot".
@@ -45,5 +46,6 @@ examples:
mode-recovery = <1>;
mode-bootloader = <2>;
mode-loader = <3>;
+ mode-edl = <1 2>;
};
...
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v10 03/10] power: reset: reboot-mode: Add optional cookie argument
2025-07-10 9:15 [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 02/10] dt-bindings: power: reset: Document reboot-mode cookie Shivendra Pratap
@ 2025-07-10 9:15 ` Shivendra Pratap
2025-07-10 15:29 ` Arnd Bergmann
2025-07-10 9:15 ` [PATCH v10 04/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
` (7 subsequent siblings)
10 siblings, 1 reply; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 9:15 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Shivendra Pratap,
Srinivas Kandagatla
Current reboot-mode driver supports a single argument(magic) for
each reboot-mode. There may be uses-cases where a mode requires
an additional argument and hence 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.
Add support for storing an additional optional argument (cookie)
for each reboot-mode and introduce a write function in
reboot-mode that writes two arguments for each reboot-mode
command. Implement the read and store of additional cookie value
for each reboot-mode defined in the device tree. In case there is
no cookie specified in the reboot-mode device tree, mark the
cookie as invalid to support backward compatibility.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/reboot-mode.c | 32 ++++++++++++++++++++++----------
include/linux/reboot-mode.h | 2 ++
2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index 61f647b23959789a313f3af0bd967abcad45fa43..afadd823d62d0f7e7e645746b978cc8fecfb9ac4 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -17,11 +17,12 @@
struct mode_info {
const char *mode;
u32 magic;
+ u32 cookie;
+ bool is_cookie_valid;
struct list_head list;
};
-static unsigned int get_reboot_mode_magic(struct reboot_mode_driver *reboot,
- const char *cmd)
+static struct mode_info *get_reboot_mode_info(struct reboot_mode_driver *reboot, const char *cmd)
{
const char *normal = "normal";
struct mode_info *info;
@@ -32,11 +33,11 @@ static unsigned int get_reboot_mode_magic(struct reboot_mode_driver *reboot,
list_for_each_entry(info, &reboot->head, list)
if (!strcmp(info->mode, cmd))
- return info->magic;
+ return info;
/* try to match again, replacing characters impossible in DT */
if (strscpy(cmd_, cmd, sizeof(cmd_)) == -E2BIG)
- return 0;
+ return NULL;
strreplace(cmd_, ' ', '-');
strreplace(cmd_, ',', '-');
@@ -44,21 +45,27 @@ static unsigned int get_reboot_mode_magic(struct reboot_mode_driver *reboot,
list_for_each_entry(info, &reboot->head, list)
if (!strcmp(info->mode, cmd_))
- return info->magic;
+ return info;
- return 0;
+ return NULL;
}
static int reboot_mode_notify(struct notifier_block *this,
unsigned long mode, void *cmd)
{
struct reboot_mode_driver *reboot;
- unsigned int magic;
+ struct mode_info *info;
reboot = container_of(this, struct reboot_mode_driver, reboot_notifier);
- magic = get_reboot_mode_magic(reboot, cmd);
- if (magic)
- reboot->write(reboot, magic);
+ info = get_reboot_mode_info(reboot, cmd);
+ if (info) {
+ if (info->is_cookie_valid) {
+ reboot->write_with_cookie(reboot, info->magic, info->cookie);
+ } else {
+ if (info->magic)
+ reboot->write(reboot, info->magic);
+ }
+ }
return NOTIFY_DONE;
}
@@ -95,6 +102,11 @@ int reboot_mode_register(struct reboot_mode_driver *reboot, struct device_node *
continue;
}
+ if (of_property_read_u32_index(np, prop->name, 1, &info->cookie))
+ info->is_cookie_valid = false;
+ else
+ info->is_cookie_valid = true;
+
info->mode = kstrdup_const(prop->name + len, GFP_KERNEL);
if (!info->mode) {
ret = -ENOMEM;
diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h
index 36f071f4b82e1fc255d8dd679a18e537655c3179..cfe18cdc2559be249969bba6c022940a508dd188 100644
--- a/include/linux/reboot-mode.h
+++ b/include/linux/reboot-mode.h
@@ -6,6 +6,8 @@ struct reboot_mode_driver {
struct device *dev;
struct list_head head;
int (*write)(struct reboot_mode_driver *reboot, unsigned int magic);
+ int (*write_with_cookie)(struct reboot_mode_driver *reboot,
+ unsigned int magic, unsigned int cookie);
struct notifier_block reboot_notifier;
};
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v10 04/10] dt-bindings: arm: Document reboot mode magic
2025-07-10 9:15 [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Shivendra Pratap
` (2 preceding siblings ...)
2025-07-10 9:15 ` [PATCH v10 03/10] power: reset: reboot-mode: Add optional cookie argument Shivendra Pratap
@ 2025-07-10 9:15 ` Shivendra Pratap
2025-07-10 15:30 ` Arnd Bergmann
2025-07-10 9:15 ` [PATCH v10 05/10] firmware: psci: Implement vendor-specific reset-types as reboot-mode Shivendra Pratap
` (6 subsequent siblings)
10 siblings, 1 reply; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 9:15 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Shivendra Pratap,
Srinivas Kandagatla, Elliot Berman
From: Elliot Berman <elliot.berman@oss.qualcomm.com>
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: Elliot Berman <elliot.berman@oss.qualcomm.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
Documentation/devicetree/bindings/arm/psci.yaml | 41 +++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/Documentation/devicetree/bindings/arm/psci.yaml b/Documentation/devicetree/bindings/arm/psci.yaml
index 7360a2849b5bd1e4cbadac533c1a7228573288d4..672fc28f69ed7cfed4baf8c2185e0cd7b2024376 100644
--- a/Documentation/devicetree/bindings/arm/psci.yaml
+++ b/Documentation/devicetree/bindings/arm/psci.yaml
@@ -98,6 +98,25 @@ properties:
[1] Kernel documentation - ARM idle states bindings
Documentation/devicetree/bindings/cpu/idle-states.yaml
+ reset-types:
+ type: object
+ $ref: /schemas/power/reset/reboot-mode.yaml#
+ unevaluatedProperties: false
+ properties:
+ # "mode-normal" is just SYSTEM_RESET
+ mode-normal: false
+ patternProperties:
+ "^mode-.*$":
+ minItems: 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 is the lower 31 bits
+ of the reset_type. Both reset_type and cookie must be specified.
+ The 31st bit (vendor-resets) will be implicitly set by the driver.
+
patternProperties:
"^power-domain-":
$ref: /schemas/power/power-domain.yaml#
@@ -137,6 +156,15 @@ allOf:
required:
- cpu_off
- cpu_on
+ - if:
+ not:
+ properties:
+ compatible:
+ contains:
+ const: arm,psci-1.0
+ then:
+ properties:
+ reset-types: false
additionalProperties: false
@@ -261,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";
+
+ reset-types {
+ mode-edl = <0 0>;
+ mode-bootloader = <1 2>;
+ };
+ };
...
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v10 05/10] firmware: psci: Implement vendor-specific reset-types as reboot-mode
2025-07-10 9:15 [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Shivendra Pratap
` (3 preceding siblings ...)
2025-07-10 9:15 ` [PATCH v10 04/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
@ 2025-07-10 9:15 ` Shivendra Pratap
2025-07-10 15:45 ` Konrad Dybcio
2025-07-10 9:15 ` [PATCH v10 06/10] arm64: dts: qcom: qcm6490-idp: Add PSCI SYSTEM_RESET2 types Shivendra Pratap
` (5 subsequent siblings)
10 siblings, 1 reply; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 9:15 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Shivendra Pratap,
Srinivas Kandagatla
SoC vendors have different types of resets which are controlled
through various hardware registers. For instance, Qualcomm SoC
may have a requirement that reboot with “bootloader” command
should reboot the device to bootloader flashing mode and reboot
with “edl” should reboot the device into Emergency flashing mode.
Setting up such reboots on Qualcomm devices can be inconsistent
across SoC platforms and may require setting different HW
registers, where some of these registers may not be accessible to
HLOS. These knobs evolve over product generations and require
more drivers. PSCI spec defines, SYSTEM_RESET2, vendor-specific
reset which can help align this requirement. Add support for PSCI
SYSTEM_RESET2, vendor-specific resets and align the implementation
to allow user-space initiated reboots to trigger these resets.
Introduce a late_initcall to register PSCI vendor-specific resets
as reboot-mode arguments like reset_type and cookie. For a SoC
where, PSCI vendor-specific system_reset2 is supported, the
appropriate value gets filled to reset_type and cookie during
this reboot-mode hook registration. If the secure firmware
supports PSCI system_reset2, restart notifier will make secure
call to trigger appropriate requested reset type.
By using the above implementation, usespace will be able to issue
such resets using the reboot() system call with the "*arg"
parameter as a string based command. The commands can be defined
in PSCI device tree node as “reset-types” and are based on the
reboot-mode based commands.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/firmware/psci/Kconfig | 1 +
drivers/firmware/psci/psci.c | 53 ++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/psci/Kconfig b/drivers/firmware/psci/Kconfig
index 97944168b5e66aea1e38a7eb2d4ced8348fce64b..9d65fe7b06a6429de8a26d06f9384e5c93f36e5f 100644
--- a/drivers/firmware/psci/Kconfig
+++ b/drivers/firmware/psci/Kconfig
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
config ARM_PSCI_FW
bool
+ select REBOOT_MODE
config ARM_PSCI_CHECKER
bool "ARM PSCI checker"
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index 38ca190d4a22d6e7e0f06420e8478a2b0ec2fe6f..87293f78ed83eb33ba67ded73728729811693ea3 100644
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -13,10 +13,13 @@
#include <linux/errno.h>
#include <linux/linkage.h>
#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/printk.h>
#include <linux/psci.h>
#include <linux/reboot.h>
+#include <linux/reboot-mode.h>
#include <linux/slab.h>
#include <linux/suspend.h>
@@ -51,6 +54,14 @@ static int resident_cpu = -1;
struct psci_operations psci_ops;
static enum arm_smccc_conduit psci_conduit = SMCCC_CONDUIT_NONE;
+struct psci_vendor_sysreset2 {
+ u32 reset_type;
+ u32 cookie;
+ bool valid;
+};
+
+static struct psci_vendor_sysreset2 vendor_reset;
+
bool psci_tos_resident_on(int cpu)
{
return cpu == resident_cpu;
@@ -309,7 +320,14 @@ 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) &&
+ if (vendor_reset.valid && psci_system_reset2_supported) {
+ /*
+ * if vendor_reset.valid is true call sys reset2 with
+ * the vendor_reset(reset_type and cookie).
+ */
+ invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), vendor_reset.reset_type,
+ vendor_reset.cookie, 0);
+ } else if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) &&
psci_system_reset2_supported) {
/*
* reset_type[31] = 0 (architectural)
@@ -547,6 +565,39 @@ static const struct platform_suspend_ops psci_suspend_ops = {
.enter = psci_system_suspend_enter,
};
+static int psci_set_vendor_sys_reset2(struct reboot_mode_driver *reboot,
+ u32 reset_type, u32 cookie)
+{
+ if (psci_system_reset2_supported) {
+ vendor_reset.reset_type = PSCI_1_1_RESET_TYPE_VENDOR_START | reset_type;
+ vendor_reset.cookie = cookie;
+ vendor_reset.valid = true;
+ }
+
+ return NOTIFY_DONE;
+}
+
+static int __init psci_init_vendor_reset(void)
+{
+ struct reboot_mode_driver *reboot;
+ struct device_node *np;
+
+ np = of_find_node_by_name(NULL, "reset-types");
+ if (!np)
+ return -ENODEV;
+
+ reboot = kzalloc(sizeof(*reboot), GFP_KERNEL);
+ if (!reboot) {
+ of_node_put(np);
+ return -ENOMEM;
+ }
+
+ reboot->write_with_cookie = psci_set_vendor_sys_reset2;
+
+ return reboot_mode_register(reboot, np);
+}
+late_initcall(psci_init_vendor_reset)
+
static void __init psci_init_system_reset2(void)
{
int ret;
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v10 06/10] arm64: dts: qcom: qcm6490-idp: Add PSCI SYSTEM_RESET2 types
2025-07-10 9:15 [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Shivendra Pratap
` (4 preceding siblings ...)
2025-07-10 9:15 ` [PATCH v10 05/10] firmware: psci: Implement vendor-specific reset-types as reboot-mode Shivendra Pratap
@ 2025-07-10 9:15 ` Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 07/10] arm64: dts: qcom: qcs6490-rb3gen2: " Shivendra Pratap
` (4 subsequent siblings)
10 siblings, 0 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 9:15 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Shivendra Pratap,
Srinivas Kandagatla, Elliot Berman, Konrad Dybcio
From: Elliot Berman <elliot.berman@oss.qualcomm.com>
qcm6490-idp firmware supports vendor-defined SYSTEM_RESET2 types.
Describe the reset types: "bootloader" will cause device to reboot and
stop in the bootloader's fastboot mode. "edl" will cause device to
reboot into "emergency download mode", which permits loading images via
the Firehose protocol.
Co-developed-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Elliot Berman <elliot.berman@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/qcm6490-idp.dts | 7 +++++++
arch/arm64/boot/dts/qcom/sc7280.dtsi | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/qcm6490-idp.dts b/arch/arm64/boot/dts/qcom/qcm6490-idp.dts
index 7a155ef6492e176390faa3f2dbe419f5cfa62f0d..6de4b140ed10b0da72f3bffae524f65406d8f571 100644
--- a/arch/arm64/boot/dts/qcom/qcm6490-idp.dts
+++ b/arch/arm64/boot/dts/qcom/qcm6490-idp.dts
@@ -654,6 +654,13 @@ &pon_resin {
status = "okay";
};
+&psci {
+ reset-types {
+ mode-bootloader = <0x10001 0x2>;
+ mode-edl = <0 0x1>;
+ };
+};
+
&qupv3_id_0 {
status = "okay";
};
diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi
index 64a2abd3010018e94eb50c534a509d6b4cf2473b..e6a99ef50b9b9ade9d2a71a14fcde429f8076dd5 100644
--- a/arch/arm64/boot/dts/qcom/sc7280.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi
@@ -857,7 +857,7 @@ pmu-a78 {
interrupts = <GIC_PPI 7 IRQ_TYPE_LEVEL_LOW>;
};
- psci {
+ psci: psci {
compatible = "arm,psci-1.0";
method = "smc";
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v10 07/10] arm64: dts: qcom: qcs6490-rb3gen2: Add PSCI SYSTEM_RESET2 types
2025-07-10 9:15 [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Shivendra Pratap
` (5 preceding siblings ...)
2025-07-10 9:15 ` [PATCH v10 06/10] arm64: dts: qcom: qcm6490-idp: Add PSCI SYSTEM_RESET2 types Shivendra Pratap
@ 2025-07-10 9:15 ` Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 08/10] arm64: dts: qcom: sa8775p-ride: " Shivendra Pratap
` (3 subsequent siblings)
10 siblings, 0 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 9:15 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Shivendra Pratap,
Srinivas Kandagatla, Elliot Berman, Konrad Dybcio
From: Elliot Berman <elliot.berman@oss.qualcomm.com>
qcs6490-rb3gen2 firmware supports vendor-defined SYSTEM_RESET2 types.
Describe the reset types: "bootloader" will cause device to reboot and
stop in the bootloader's fastboot mode. "edl" will cause device to
reboot into "emergency download mode", which permits loading images via
the Firehose protocol.
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Elliot Berman <elliot.berman@oss.qualcomm.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
index 5fbcd48f2e2d839835fa464a8d5682f00557f82e..7c06fe496e800e758d59ca793785d7c2907df8dd 100644
--- a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
+++ b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
@@ -966,6 +966,13 @@ &pon_resin {
status = "okay";
};
+&psci {
+ reset-types {
+ mode-bootloader = <0x10001 0x2>;
+ mode-edl = <0 0x1>;
+ };
+};
+
&qup_uart7_cts {
/*
* Configure a bias-bus-hold on CTS to lower power
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v10 08/10] arm64: dts: qcom: sa8775p-ride: Add PSCI SYSTEM_RESET2 types
2025-07-10 9:15 [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Shivendra Pratap
` (6 preceding siblings ...)
2025-07-10 9:15 ` [PATCH v10 07/10] arm64: dts: qcom: qcs6490-rb3gen2: " Shivendra Pratap
@ 2025-07-10 9:15 ` Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 09/10] Documentation: ABI: Add sysfs-class-reboot-mode-reboot_modes Shivendra Pratap
` (2 subsequent siblings)
10 siblings, 0 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 9:15 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Shivendra Pratap,
Srinivas Kandagatla, Elliot Berman, Konrad Dybcio
From: Elliot Berman <elliot.berman@oss.qualcomm.com>
sa8775p-ride firmware supports vendor-defined SYSTEM_RESET2 types.
Describe the reset types: "bootloader" will cause device to reboot and
stop in the bootloader's fastboot mode. "edl" will cause device to
reboot into "emergency download mode", which permits loading images via
the Firehose protocol.
Co-developed-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Elliot Berman <elliot.berman@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi | 7 +++++++
arch/arm64/boot/dts/qcom/sa8775p.dtsi | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi b/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi
index 63b3031cfcc15fe2cce58c0fb7502b19f058b80c..44840c37c2f102e7939f64c8eaaf8a872ba5a140 100644
--- a/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi
+++ b/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi
@@ -874,6 +874,13 @@ &pmm8654au_3_gpios {
"GNSS_BOOT_MODE";
};
+&psci {
+ reset-types {
+ mode-bootloader = <0x10001 0x2>;
+ mode-edl = <0 0x1>;
+ };
+};
+
&qupv3_id_1 {
status = "okay";
};
diff --git a/arch/arm64/boot/dts/qcom/sa8775p.dtsi b/arch/arm64/boot/dts/qcom/sa8775p.dtsi
index fed34717460f060e6a9dfdd4e29ca4025c401b83..b1f151aff478dc268e3405ef5bdd85e67bc25cf4 100644
--- a/arch/arm64/boot/dts/qcom/sa8775p.dtsi
+++ b/arch/arm64/boot/dts/qcom/sa8775p.dtsi
@@ -622,7 +622,7 @@ pmu {
interrupts = <GIC_PPI 7 IRQ_TYPE_LEVEL_HIGH>;
};
- psci {
+ psci: psci {
compatible = "arm,psci-1.0";
method = "smc";
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v10 09/10] Documentation: ABI: Add sysfs-class-reboot-mode-reboot_modes
2025-07-10 9:15 [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Shivendra Pratap
` (7 preceding siblings ...)
2025-07-10 9:15 ` [PATCH v10 08/10] arm64: dts: qcom: sa8775p-ride: " Shivendra Pratap
@ 2025-07-10 9:15 ` Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 10/10] power: reset: reboot-mode: Expose sysfs for registered arguments Shivendra Pratap
2025-07-10 20:20 ` [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Florian Fainelli
10 siblings, 0 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 9:15 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Shivendra Pratap,
Srinivas Kandagatla
Add ABI documentation for /sys/class/reboot-mode/*/reboot_modes,
a read-only sysfs attribute exposing the list of supported
reboot-mode arguments. This file is created by reboot-mode
framework and provides a user-readable interface to query
available reboot-mode arguments.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
.../testing/sysfs-class-reboot-mode-reboot_modes | 39 ++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-class-reboot-mode-reboot_modes b/Documentation/ABI/testing/sysfs-class-reboot-mode-reboot_modes
new file mode 100644
index 0000000000000000000000000000000000000000..bf49e6c1dee6f48d791987a50c3d0b349e6714bc
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-reboot-mode-reboot_modes
@@ -0,0 +1,39 @@
+What: /sys/class/reboot-mode/<driver>/reboot_modes
+Date: July 2025
+KernelVersion: 6.16
+Contact: linux-pm@vger.kernel.org
+ Description:
+ This interface exposes the reboot-mode arguments
+ registered with the reboot-mode framework. It is
+ a read-only interface and provides a comma
+ separated list of reboot-mode arguments supported
+ on the current platform.
+ Example:
+ normal,recovery,fastboot,bootloader
+
+ The exact sysfs path may vary depending on the
+ driver that registers the arguments.
+ Example:
+ /sys/class/reboot-mode/reboot-mode/reboot_modes
+ /sys/class/reboot-mode/pon/reboot_modes
+ /sys/class/reboot-mode/reset-types/reboot_modes
+
+ The supported arguments can be used by userspace
+ to invoke device reset using the reboot() system
+ call, with the "argument" as string to "*arg"
+ parameter along with LINUX_REBOOT_CMD_RESTART2.
+ Example:
+ reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
+ LINUX_REBOOT_CMD_RESTART2, "bootloader");
+
+ A driver can expose the supported arguments by
+ registering them with the reboot-mode framework
+ using the property names that follow the
+ mode-<argument> format.
+ Example:
+ mode-bootloader, mode-recovery.
+
+ This attribute is useful for scripts or initramfs
+ logic that need to programmatically determine
+ which reboot-mode arguments are valid before
+ triggering a reboot.
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v10 10/10] power: reset: reboot-mode: Expose sysfs for registered arguments
2025-07-10 9:15 [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Shivendra Pratap
` (8 preceding siblings ...)
2025-07-10 9:15 ` [PATCH v10 09/10] Documentation: ABI: Add sysfs-class-reboot-mode-reboot_modes Shivendra Pratap
@ 2025-07-10 9:15 ` Shivendra Pratap
2025-07-10 20:20 ` [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Florian Fainelli
10 siblings, 0 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 9:15 UTC (permalink / raw)
To: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Shivendra Pratap,
Srinivas Kandagatla
Currently, there is no standardized mechanism for userspace to
discover which reboot-modes are supported on a given platform.
This limitation forces tools and scripts to rely on hardcoded
assumptions about the supported reboot-modes.
Create a class 'reboot-mode' and a device under it to expose a
sysfs interface to show the available reboot mode arguments to
userspace.
Create the device using the node name of the driver that
registers with reboot mode driver.
This results in the creation of:
/sys/class/reboot-mode/<driver>/reboot_modes
This read-only sysfs file will exposes the list of supported
reboot modes arguments provided by the driver, enabling userspace
to query the list of arguments.
Align the clean up path to maintain backward compatibility for
existing reboot-mode based drivers.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/reboot-mode.c | 95 ++++++++++++++++++++++++++++++++++-----
include/linux/reboot-mode.h | 1 +
2 files changed, 84 insertions(+), 12 deletions(-)
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index afadd823d62d0f7e7e645746b978cc8fecfb9ac4..128192d49d895beeacb180c1a92b44a5eddccc78 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -22,6 +22,8 @@ struct mode_info {
struct list_head list;
};
+static struct class *rb_class;
+
static struct mode_info *get_reboot_mode_info(struct reboot_mode_driver *reboot, const char *cmd)
{
const char *normal = "normal";
@@ -70,6 +72,79 @@ static int reboot_mode_notify(struct notifier_block *this,
return NOTIFY_DONE;
}
+static void release_reboot_mode_device(struct device *dev, void *res);
+
+static ssize_t reboot_modes_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct reboot_mode_driver **devres_reboot;
+ struct reboot_mode_driver *reboot;
+ struct mode_info *info;
+ ssize_t size = 0;
+
+ devres_reboot = devres_find(dev, release_reboot_mode_device, NULL, 0);
+ reboot = *devres_reboot;
+ list_for_each_entry(info, &reboot->head, list) {
+ size += sprintf(buf + size, "%s,", info->mode);
+ }
+
+ if (size) {
+ size += sprintf(buf + size - 1, "\n");
+ return size;
+ }
+
+ return -ENODATA;
+}
+static DEVICE_ATTR_RO(reboot_modes);
+
+static void release_reboot_mode_device(struct device *dev, void *res)
+{
+ struct reboot_mode_driver *reboot = *(struct reboot_mode_driver **)res;
+ struct mode_info *info;
+ struct mode_info *next;
+
+ unregister_reboot_notifier(&reboot->reboot_notifier);
+
+ list_for_each_entry_safe(info, next, &reboot->head, list) {
+ kfree_const(info->mode);
+ list_del(&info->list);
+ kfree(info);
+ }
+
+ device_remove_file(reboot->dev, &dev_attr_reboot_modes);
+}
+
+static int create_reboot_mode_device(struct reboot_mode_driver *reboot,
+ const char *dev_name)
+{
+ struct reboot_mode_driver **dr;
+ int ret = 0;
+
+ if (!rb_class) {
+ rb_class = class_create("reboot-mode");
+ if (IS_ERR(rb_class))
+ return PTR_ERR(rb_class);
+ }
+
+ reboot->reboot_dev = device_create(rb_class, NULL, 0, NULL, dev_name);
+ if (IS_ERR(reboot->reboot_dev))
+ return PTR_ERR(reboot->reboot_dev);
+
+ ret = device_create_file(reboot->reboot_dev, &dev_attr_reboot_modes);
+ if (ret)
+ return ret;
+
+ dr = devres_alloc(release_reboot_mode_device, sizeof(*dr), GFP_KERNEL);
+ if (!dr) {
+ device_remove_file(reboot->reboot_dev, &dev_attr_reboot_modes);
+ return -ENOMEM;
+ }
+
+ *dr = reboot;
+ devres_add(reboot->reboot_dev, dr);
+
+ return ret;
+}
+
/**
* reboot_mode_register - register a reboot mode driver
* @reboot: reboot mode driver
@@ -84,6 +159,10 @@ int reboot_mode_register(struct reboot_mode_driver *reboot, struct device_node *
size_t len = strlen(PREFIX);
int ret;
+ ret = create_reboot_mode_device(reboot, np->name ? np->name : "reboot-mode-dev");
+ if (ret)
+ return ret;
+
INIT_LIST_HEAD(&reboot->head);
for_each_property_of_node(np, prop) {
@@ -140,24 +219,16 @@ 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_safe(info, next, &reboot->head, list) {
- kfree_const(info->mode);
- list_del(&info->list);
- kfree(info);
- }
-
+ device_unregister(reboot->reboot_dev);
return 0;
}
EXPORT_SYMBOL_GPL(reboot_mode_unregister);
static void devm_reboot_mode_release(struct device *dev, void *res)
{
- reboot_mode_unregister(*(struct reboot_mode_driver **)res);
+ struct reboot_mode_driver *reboot = *(struct reboot_mode_driver **)res;
+
+ device_unregister(reboot->reboot_dev);
}
/**
diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h
index cfe18cdc2559be249969bba6c022940a508dd188..3aab8700a5961b90b07ed4d722c77484213ac6c4 100644
--- a/include/linux/reboot-mode.h
+++ b/include/linux/reboot-mode.h
@@ -4,6 +4,7 @@
struct reboot_mode_driver {
struct device *dev;
+ struct device *reboot_dev;
struct list_head head;
int (*write)(struct reboot_mode_driver *reboot, unsigned int magic);
int (*write_with_cookie)(struct reboot_mode_driver *reboot,
--
2.34.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH v10 03/10] power: reset: reboot-mode: Add optional cookie argument
2025-07-10 9:15 ` [PATCH v10 03/10] power: reset: reboot-mode: Add optional cookie argument Shivendra Pratap
@ 2025-07-10 15:29 ` Arnd Bergmann
2025-07-10 16:40 ` Shivendra Pratap
0 siblings, 1 reply; 31+ messages in thread
From: Arnd Bergmann @ 2025-07-10 15:29 UTC (permalink / raw)
To: Shivendra Pratap, Bartosz Golaszewski, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, André Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla
On Thu, Jul 10, 2025, at 11:15, Shivendra Pratap wrote:
> static int reboot_mode_notify(struct notifier_block *this,
> unsigned long mode, void *cmd)
> {
> struct reboot_mode_driver *reboot;
> - unsigned int magic;
> + struct mode_info *info;
>
> reboot = container_of(this, struct reboot_mode_driver, reboot_notifier);
> - magic = get_reboot_mode_magic(reboot, cmd);
> - if (magic)
> - reboot->write(reboot, magic);
> + info = get_reboot_mode_info(reboot, cmd);
> + if (info) {
> + if (info->is_cookie_valid) {
> + reboot->write_with_cookie(reboot, info->magic, info->cookie);
> + } else {
> + if (info->magic)
> + reboot->write(reboot, info->magic);
> + }
> + }
I don't quite see why we need two possible callbacks here, could
this be done with a single '->write' callback when you either
add another argument, or extend the existing 'magic' value
to 64 bit?
There are only a couple of drivers that provide this callback,
so it should be easy to just change them all at once.
Arnd
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 04/10] dt-bindings: arm: Document reboot mode magic
2025-07-10 9:15 ` [PATCH v10 04/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
@ 2025-07-10 15:30 ` Arnd Bergmann
2025-07-10 16:53 ` Shivendra Pratap
0 siblings, 1 reply; 31+ messages in thread
From: Arnd Bergmann @ 2025-07-10 15:30 UTC (permalink / raw)
To: Shivendra Pratap, Bartosz Golaszewski, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, André Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla,
Elliot Berman
On Thu, Jul 10, 2025, at 11:15, Shivendra Pratap wrote:
> + reset-types:
> + type: object
> + $ref: /schemas/power/reset/reboot-mode.yaml#
The other users of the reboot-mode.yaml binding all call this
node 'reboot-mode' instead of 'reset-types', can you change that
here for consistency?
Arnd
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 05/10] firmware: psci: Implement vendor-specific reset-types as reboot-mode
2025-07-10 9:15 ` [PATCH v10 05/10] firmware: psci: Implement vendor-specific reset-types as reboot-mode Shivendra Pratap
@ 2025-07-10 15:45 ` Konrad Dybcio
2025-07-10 16:34 ` Shivendra Pratap
0 siblings, 1 reply; 31+ messages in thread
From: Konrad Dybcio @ 2025-07-10 15:45 UTC (permalink / raw)
To: Shivendra Pratap, Bartosz Golaszewski, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla
On 7/10/25 11:15 AM, Shivendra Pratap wrote:
> SoC vendors have different types of resets which are controlled
> through various hardware registers. For instance, Qualcomm SoC
> may have a requirement that reboot with “bootloader” command
> should reboot the device to bootloader flashing mode and reboot
> with “edl” should reboot the device into Emergency flashing mode.
> Setting up such reboots on Qualcomm devices can be inconsistent
> across SoC platforms and may require setting different HW
> registers, where some of these registers may not be accessible to
> HLOS. These knobs evolve over product generations and require
> more drivers. PSCI spec defines, SYSTEM_RESET2, vendor-specific
> reset which can help align this requirement. Add support for PSCI
> SYSTEM_RESET2, vendor-specific resets and align the implementation
> to allow user-space initiated reboots to trigger these resets.
>
> Introduce a late_initcall to register PSCI vendor-specific resets
> as reboot-mode arguments like reset_type and cookie. For a SoC
> where, PSCI vendor-specific system_reset2 is supported, the
> appropriate value gets filled to reset_type and cookie during
> this reboot-mode hook registration. If the secure firmware
> supports PSCI system_reset2, restart notifier will make secure
> call to trigger appropriate requested reset type.
>
> By using the above implementation, usespace will be able to issue
> such resets using the reboot() system call with the "*arg"
> parameter as a string based command. The commands can be defined
> in PSCI device tree node as “reset-types” and are based on the
> reboot-mode based commands.
>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
> ---
> drivers/firmware/psci/Kconfig | 1 +
> drivers/firmware/psci/psci.c | 53 ++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 53 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/psci/Kconfig b/drivers/firmware/psci/Kconfig
> index 97944168b5e66aea1e38a7eb2d4ced8348fce64b..9d65fe7b06a6429de8a26d06f9384e5c93f36e5f 100644
> --- a/drivers/firmware/psci/Kconfig
> +++ b/drivers/firmware/psci/Kconfig
> @@ -1,6 +1,7 @@
> # SPDX-License-Identifier: GPL-2.0-only
> config ARM_PSCI_FW
> bool
> + select REBOOT_MODE
>
> config ARM_PSCI_CHECKER
> bool "ARM PSCI checker"
> diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
> index 38ca190d4a22d6e7e0f06420e8478a2b0ec2fe6f..87293f78ed83eb33ba67ded73728729811693ea3 100644
> --- a/drivers/firmware/psci/psci.c
> +++ b/drivers/firmware/psci/psci.c
> @@ -13,10 +13,13 @@
> #include <linux/errno.h>
> #include <linux/linkage.h>
> #include <linux/of.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> #include <linux/pm.h>
> #include <linux/printk.h>
> #include <linux/psci.h>
> #include <linux/reboot.h>
> +#include <linux/reboot-mode.h>
> #include <linux/slab.h>
> #include <linux/suspend.h>
>
> @@ -51,6 +54,14 @@ static int resident_cpu = -1;
> struct psci_operations psci_ops;
> static enum arm_smccc_conduit psci_conduit = SMCCC_CONDUIT_NONE;
>
> +struct psci_vendor_sysreset2 {
> + u32 reset_type;
> + u32 cookie;
> + bool valid;
> +};
> +
> +static struct psci_vendor_sysreset2 vendor_reset;
> +
> bool psci_tos_resident_on(int cpu)
> {
> return cpu == resident_cpu;
> @@ -309,7 +320,14 @@ 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) &&
> + if (vendor_reset.valid && psci_system_reset2_supported) {
> + /*
> + * if vendor_reset.valid is true call sys reset2 with
> + * the vendor_reset(reset_type and cookie).
> + */
This comment repeats the line above and below it without
bringing additional value
Konrad
> + invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), vendor_reset.reset_type,
> + vendor_reset.cookie, 0);
> + } else if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) &&
> psci_system_reset2_supported) {
> /*
> * reset_type[31] = 0 (architectural)
> @@ -547,6 +565,39 @@ static const struct platform_suspend_ops psci_suspend_ops = {
> .enter = psci_system_suspend_enter,
> };
>
> +static int psci_set_vendor_sys_reset2(struct reboot_mode_driver *reboot,
> + u32 reset_type, u32 cookie)
> +{
> + if (psci_system_reset2_supported) {
> + vendor_reset.reset_type = PSCI_1_1_RESET_TYPE_VENDOR_START | reset_type;
> + vendor_reset.cookie = cookie;
> + vendor_reset.valid = true;
> + }
> +
> + return NOTIFY_DONE;
> +}
> +
> +static int __init psci_init_vendor_reset(void)
> +{
> + struct reboot_mode_driver *reboot;
> + struct device_node *np;
> +
> + np = of_find_node_by_name(NULL, "reset-types");
> + if (!np)
> + return -ENODEV;
> +
> + reboot = kzalloc(sizeof(*reboot), GFP_KERNEL);
> + if (!reboot) {
> + of_node_put(np);
> + return -ENOMEM;
> + }
> +
> + reboot->write_with_cookie = psci_set_vendor_sys_reset2;
> +
> + return reboot_mode_register(reboot, np);
> +}
> +late_initcall(psci_init_vendor_reset)
> +
> static void __init psci_init_system_reset2(void)
> {
> int ret;
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 05/10] firmware: psci: Implement vendor-specific reset-types as reboot-mode
2025-07-10 15:45 ` Konrad Dybcio
@ 2025-07-10 16:34 ` Shivendra Pratap
0 siblings, 0 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 16:34 UTC (permalink / raw)
To: Konrad Dybcio, Bartosz Golaszewski, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla
On 7/10/2025 9:15 PM, Konrad Dybcio wrote:
> On 7/10/25 11:15 AM, Shivendra Pratap wrote:
>> SoC vendors have different types of resets which are controlled
>> through various hardware registers. For instance, Qualcomm SoC
>> may have a requirement that reboot with “bootloader” command
>> should reboot the device to bootloader flashing mode and reboot
>> with “edl” should reboot the device into Emergency flashing mode.
>> Setting up such reboots on Qualcomm devices can be inconsistent
>> across SoC platforms and may require setting different HW
>> registers, where some of these registers may not be accessible to
>> HLOS. These knobs evolve over product generations and require
>> more drivers. PSCI spec defines, SYSTEM_RESET2, vendor-specific
>> reset which can help align this requirement. Add support for PSCI
>> SYSTEM_RESET2, vendor-specific resets and align the implementation
>> to allow user-space initiated reboots to trigger these resets.
>>
>> Introduce a late_initcall to register PSCI vendor-specific resets
>> as reboot-mode arguments like reset_type and cookie. For a SoC
>> where, PSCI vendor-specific system_reset2 is supported, the
>> appropriate value gets filled to reset_type and cookie during
>> this reboot-mode hook registration. If the secure firmware
>> supports PSCI system_reset2, restart notifier will make secure
>> call to trigger appropriate requested reset type.
>>
>> By using the above implementation, usespace will be able to issue
>> such resets using the reboot() system call with the "*arg"
>> parameter as a string based command. The commands can be defined
>> in PSCI device tree node as “reset-types” and are based on the
>> reboot-mode based commands.
>>
>> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
>> ---
>> drivers/firmware/psci/Kconfig | 1 +
>> drivers/firmware/psci/psci.c | 53 ++++++++++++++++++++++++++++++++++++++++++-
>> 2 files changed, 53 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/firmware/psci/Kconfig b/drivers/firmware/psci/Kconfig
>> index 97944168b5e66aea1e38a7eb2d4ced8348fce64b..9d65fe7b06a6429de8a26d06f9384e5c93f36e5f 100644
>> --- a/drivers/firmware/psci/Kconfig
>> +++ b/drivers/firmware/psci/Kconfig
>> @@ -1,6 +1,7 @@
>> # SPDX-License-Identifier: GPL-2.0-only
>> config ARM_PSCI_FW
>> bool
>> + select REBOOT_MODE
>>
>> config ARM_PSCI_CHECKER
>> bool "ARM PSCI checker"
>> diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
>> index 38ca190d4a22d6e7e0f06420e8478a2b0ec2fe6f..87293f78ed83eb33ba67ded73728729811693ea3 100644
>> --- a/drivers/firmware/psci/psci.c
>> +++ b/drivers/firmware/psci/psci.c
>> @@ -13,10 +13,13 @@
>> #include <linux/errno.h>
>> #include <linux/linkage.h>
>> #include <linux/of.h>
>> +#include <linux/of_platform.h>
>> +#include <linux/platform_device.h>
>> #include <linux/pm.h>
>> #include <linux/printk.h>
>> #include <linux/psci.h>
>> #include <linux/reboot.h>
>> +#include <linux/reboot-mode.h>
>> #include <linux/slab.h>
>> #include <linux/suspend.h>
>>
>> @@ -51,6 +54,14 @@ static int resident_cpu = -1;
>> struct psci_operations psci_ops;
>> static enum arm_smccc_conduit psci_conduit = SMCCC_CONDUIT_NONE;
>>
>> +struct psci_vendor_sysreset2 {
>> + u32 reset_type;
>> + u32 cookie;
>> + bool valid;
>> +};
>> +
>> +static struct psci_vendor_sysreset2 vendor_reset;
>> +
>> bool psci_tos_resident_on(int cpu)
>> {
>> return cpu == resident_cpu;
>> @@ -309,7 +320,14 @@ 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) &&
>> + if (vendor_reset.valid && psci_system_reset2_supported) {
>> + /*
>> + * if vendor_reset.valid is true call sys reset2 with
>> + * the vendor_reset(reset_type and cookie).
>> + */
>
> This comment repeats the line above and below it without
> bringing additional value
Ack. will remove or modify the comment to make more sense.
thanks.
>
> Konrad
>
>> + invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), vendor_reset.reset_type,
>> + vendor_reset.cookie, 0);
>> + } else if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) &&
>> psci_system_reset2_supported) {
>> /*
>> * reset_type[31] = 0 (architectural)
>> @@ -547,6 +565,39 @@ static const struct platform_suspend_ops psci_suspend_ops = {
>> .enter = psci_system_suspend_enter,
>> };
>>
>> +static int psci_set_vendor_sys_reset2(struct reboot_mode_driver *reboot,
>> + u32 reset_type, u32 cookie)
>> +{
>> + if (psci_system_reset2_supported) {
>> + vendor_reset.reset_type = PSCI_1_1_RESET_TYPE_VENDOR_START | reset_type;
>> + vendor_reset.cookie = cookie;
>> + vendor_reset.valid = true;
>> + }
>> +
>> + return NOTIFY_DONE;
>> +}
>> +
>> +static int __init psci_init_vendor_reset(void)
>> +{
>> + struct reboot_mode_driver *reboot;
>> + struct device_node *np;
>> +
>> + np = of_find_node_by_name(NULL, "reset-types");
>> + if (!np)
>> + return -ENODEV;
>> +
>> + reboot = kzalloc(sizeof(*reboot), GFP_KERNEL);
>> + if (!reboot) {
>> + of_node_put(np);
>> + return -ENOMEM;
>> + }
>> +
>> + reboot->write_with_cookie = psci_set_vendor_sys_reset2;
>> +
>> + return reboot_mode_register(reboot, np);
>> +}
>> +late_initcall(psci_init_vendor_reset)
>> +
>> static void __init psci_init_system_reset2(void)
>> {
>> int ret;
>>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 03/10] power: reset: reboot-mode: Add optional cookie argument
2025-07-10 15:29 ` Arnd Bergmann
@ 2025-07-10 16:40 ` Shivendra Pratap
0 siblings, 0 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 16:40 UTC (permalink / raw)
To: Arnd Bergmann, Bartosz Golaszewski, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, André Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla
On 7/10/2025 8:59 PM, Arnd Bergmann wrote:
> On Thu, Jul 10, 2025, at 11:15, Shivendra Pratap wrote:
>
>> static int reboot_mode_notify(struct notifier_block *this,
>> unsigned long mode, void *cmd)
>> {
>> struct reboot_mode_driver *reboot;
>> - unsigned int magic;
>> + struct mode_info *info;
>>
>> reboot = container_of(this, struct reboot_mode_driver, reboot_notifier);
>> - magic = get_reboot_mode_magic(reboot, cmd);
>> - if (magic)
>> - reboot->write(reboot, magic);
>> + info = get_reboot_mode_info(reboot, cmd);
>> + if (info) {
>> + if (info->is_cookie_valid) {
>> + reboot->write_with_cookie(reboot, info->magic, info->cookie);
>> + } else {
>> + if (info->magic)
>> + reboot->write(reboot, info->magic);
>> + }
>> + }
>
> I don't quite see why we need two possible callbacks here, could
> this be done with a single '->write' callback when you either
> add another argument, or extend the existing 'magic' value
> to 64 bit?
>
> There are only a couple of drivers that provide this callback,
> so it should be easy to just change them all at once.
yes. Three driver. Ok. Will modify these driver's write function
prototype to accommodate the second argument.
thanks.
>
> Arnd
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 04/10] dt-bindings: arm: Document reboot mode magic
2025-07-10 15:30 ` Arnd Bergmann
@ 2025-07-10 16:53 ` Shivendra Pratap
2025-07-11 5:40 ` Arnd Bergmann
0 siblings, 1 reply; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-10 16:53 UTC (permalink / raw)
To: Arnd Bergmann, Bartosz Golaszewski, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, André Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla,
Elliot Berman
On 7/10/2025 9:00 PM, Arnd Bergmann wrote:
> On Thu, Jul 10, 2025, at 11:15, Shivendra Pratap wrote:
>
>> + reset-types:
>> + type: object
>> + $ref: /schemas/power/reset/reboot-mode.yaml#
>
> The other users of the reboot-mode.yaml binding all call this
> node 'reboot-mode' instead of 'reset-types', can you change that
> here for consistency?
nvmem-reboot-mode and syscon-reboot-mode use reboot-mode in the
device tree node name.
qcom-pon does not uses reboot-mode at its device tree node name, it
uses pon.
Kept it reset-types as this patch was already reviewed earlier and
the name makes it closer to vendor-specific reset-type.
Should we make it reboot-mode? Please suggest.
thanks.
>
> Arnd
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2
2025-07-10 9:15 [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Shivendra Pratap
` (9 preceding siblings ...)
2025-07-10 9:15 ` [PATCH v10 10/10] power: reset: reboot-mode: Expose sysfs for registered arguments Shivendra Pratap
@ 2025-07-10 20:20 ` Florian Fainelli
2025-07-11 12:41 ` Shivendra Pratap
10 siblings, 1 reply; 31+ messages in thread
From: Florian Fainelli @ 2025-07-10 20:20 UTC (permalink / raw)
To: Shivendra Pratap, Bartosz Golaszewski, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla,
Elliot Berman, Konrad Dybcio
On 7/10/25 02:15, Shivendra Pratap wrote:
> The PSCI SYSTEM_RESET2 call allows vendor firmware to define
> additional reset types which could be mapped to the reboot
> argument.
>
> User-space should be able to reboot a device into different
> operational boot-states supported by underlying bootloader and
> firmware. Generally, some HW registers need to be written, based
> on which the bootloader and firmware decide the next boot state
> of device, after the reset. For example, a requirement on
> Qualcomm platforms may state that reboot with "bootloader"
> command, should reboot the device into bootloader flashing mode
> and reboot with “edl” command, should reboot the device into an
> Emergency flashing mode. Setting up such reboots on Qualcomm
> devices can be inconsistent across SoC platforms and may require
> setting different HW registers, where some of these registers may
> not be accessible to HLOS. These knobs evolve over product
> generations and require more drivers. PSCI defines a
> vendor-specific reset in SYSTEM_RESET2 spec, which enables the
> firmware to take care of underlying setting for any such
> supported vendor-specific reboot. Qualcomm firmwares are
> beginning to support and expose PSCI SYSTEM_RESET2
> vendor-specific reset types to simplify driver requirements from
> Linux. With such support added in the firmware, we now need a
> Linux interface which can make use of the firmware calls for PSCI
> vendor-specific resets. This will align such reboot requirement
> across platforms and vendors.
>
> The current psci driver supports two types of resets –
> SYSTEM_RESET2 Arch warm-reset and SYSTEM_RESET cold-reset. The
> patchset introduces the PSCI SYSTEM_RESET2 vendor-specific reset
> into the reset path of the psci driver and aligns it to work with
> reboot system call - LINUX_REBOOT_CMD_RESTART2, when used along
> with a supported string-based command in “*arg”.
>
> The patchset uses reboot-mode based commands, to define the
> supported vendor reset-types commands in psci device tree node
> and registers these commands with the reboot-mode framework.
>
> The PSCI vendor-specific reset takes two arguments, being,
> reset_type and cookie as defined by the spec. As the
> vendor-specific reset needs two arguments reset_type and cookie
> to be passes to the firmware, enhance the reboot-mode framework
> to support two arguments (magic and cookie), for each reboot-mode
> command, where cookie will be optional.
>
> Along this line, the patchset also extends the reboot-mode
> framework to add a non-device-based registration function which
> will allow drivers to register using DT node, while keeping
> backward compatibility for existing users of reboot-mode. This
> will enable psci driver to register for reboot-mode and implement
> a write_with_cookie function which will save the
> magic(reset_type) and cookie and then use it in psci reset path
> to make a vendor-specific reset call into the firmware. In
> addition, the patchset will expose a sysfs entry interface within
> reboot-mode which can be used by userspace to view the supported
> reboot-mode commands.
>
> The list of vendor-specific reset commands remains open due to
> divergent requirements across vendors, but this can be
> streamlined and standardized through dedicated device tree
> bindings.
>
> Currently three drivers register with reboot-mode framework -
> syscon-reboot-mode, nvmem-reboot-mode and qcom-pon. Consolidated
> list of commands currently added across various vendor DTs:
> mode-loader
> mode-normal
> mode-bootloader
> mode-charge
> mode-fastboot
> mode-reboot-ab-update
> mode-recovery
> mode-rescue
> mode-shutdown-thermal
> mode-shutdown-thermal-battery
>
> Detailed list of commands being used by syscon-reboot-mode:
> arm64/boot/dts/exynos/exynosautov9.dtsi:
> mode-bootloader = <EXYNOSAUTOV9_BOOT_BOOTLOADER>;
> mode-fastboot = <EXYNOSAUTOV9_BOOT_FASTBOOT>;
> mode-recovery = <EXYNOSAUTOV9_BOOT_RECOVERY>;
>
> arm64/boot/dts/exynos/google/gs101.dtsi:
> mode-bootloader = <0xfc>;
> mode-charge = <0x0a>;
> mode-fastboot = <0xfa>;
> mode-reboot-ab-update = <0x52>;
> mode-recovery = <0xff>;
> mode-rescue = <0xf9>;
> mode-shutdown-thermal = <0x51>;
> mode-shutdown-thermal-battery = <0x51>;
>
> arm64/boot/dts/hisilicon/hi3660-hikey960.dts:
> mode-normal = <0x77665501>;
> mode-bootloader = <0x77665500>;
> mode-recovery = <0x77665502>;
>
> arm64/boot/dts/hisilicon/hi6220-hikey.dts:
> mode-normal = <0x77665501>;
> mode-bootloader = <0x77665500>;
> mode-recovery = <0x77665502>;
>
> arm64/boot/dts/rockchip/px30.dtsi:
> mode-bootloader = <BOOT_BL_DOWNLOAD>;
> mode-fastboot = <BOOT_FASTBOOT>;
> mode-loader = <BOOT_BL_DOWNLOAD>;
> mode-normal = <BOOT_NORMAL>;
> mode-recovery = <BOOT_RECOVERY>;
>
> arm64/boot/dts/rockchip/rk3308.dtsi:
> mode-bootloader = <BOOT_BL_DOWNLOAD>;
> mode-loader = <BOOT_BL_DOWNLOAD>;
> mode-normal = <BOOT_NORMAL>;
> mode-recovery = <BOOT_RECOVERY>;
> mode-fastboot = <BOOT_FASTBOOT>;
>
> arm64/boot/dts/rockchip/rk3566-lckfb-tspi.dts:
> mode-normal = <BOOT_NORMAL>;
> mode-loader = <BOOT_BL_DOWNLOAD>;
> mode-recovery = <BOOT_RECOVERY>;
> mode-bootloader = <BOOT_FASTBOOT>;
>
> Detailed list of commands being used by nvmem-reboot-mode:
> arm64/boot/dts/qcom/pmXXXX.dtsi:(multiple qcom DTs)
> mode-recovery = <0x01>;
> mode-bootloader = <0x02>;
>
> Previous discussions around SYSTEM_RESET2:
> - https://lore.kernel.org/lkml/20230724223057.1208122-2-quic_eberman@quicinc.com/T/
> - https://lore.kernel.org/all/4a679542-b48d-7e11-f33a-63535a5c68cb@quicinc.com/
>
> Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Humm, something changed compared to the last version that I tested from
Elliot which worked ok. With this patch applied and the following Device
Tree snippet:
psci {
method = "smc";
compatible = "arm,psci-0.2", "arm,psci";
cpu_on = <0xc4000003>;
cpu_suspend = <0xc4000001>;
cpu_off = <0x84000002>;
reset-types {
mode-powercycle = <0x01>;
};
};
I get the following invoking "reboot powercycle":
# reboot powercycle
[ 21.403188] Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000000 is not a phandle reference
[ 21.412032] Mem abort info:extended_property):
/rdb/waketimer@841a840:interrupts-extended: cell 0 is not a phandle
reference
[ 21.414840] ESR = 0x0000000086000004operty):
/rdb/waketimer@841a840:interrupts-extended: cell 2 is not a phandle
reference
[ 21.418601] EC = 0x21: IABT (current EL), IL = 32 bitsparent: cell
0 is not a phandle reference
[ 21.423927] SET = 0, FnV = 0: /rdb/xhci_v2@8d00000:phys: cell 0 is
not a phandle reference
[ 21.426988] EA = 0, S1PTW = 0 /rdb/sata@8b0a000/sata-port@0:phys:
cell 0 is not a phandle reference
[ 21.430138] FSC = 0x04: level 0 translation fault:phys: cell 0 is
not a phandle reference
[ 21.435054] user pgtable: 4k pages, 48-bit VAs, pgdp=000000010112c000
a phandle reference
[ 21.441508] [0000000000000000] pgd=0000000000000000,
p4d=0000000000000000handle reference
[ 21.448318] Internal error: Oops: 0000000086000004 [#1] SMPcell 0 is
not a phandle reference
[ 21.453990] Modules linked in: bdc
udc_core/thermal-zones/cpu-thermal:thermal-sensors: cell 0 is not a
phandle reference
[ 21.458188] CPU: 0 UID: 0 PID: 1566 Comm: reboot Not tainted
6.16.0-rc5-next-20250710-gdd78270edd5a #2 NONE 4)
[ 21.468032] Hardware name: BCX972160DV (DT)ases property name must
include only lowercase and '-'
[ 21.472221] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS
BTYPE=--)only lowercase and '-'
[ 21.479193] pc : 0x0s_paths): /aliases:pcie0: aliases property is not
a valid node (/pcie@8b10000)
[ 21.481388] lr : reboot_mode_notify+0x64/0x80es property name must
include only lowercase and '-'
[ 21.485760] sp : ffff80008344bbe0iases: aliases property name must
include only lowercase and '-'
[ 21.489079] x29: ffff80008344bbe0 x28: ffff0000c3bb3d00 x27:
ffff800080ab58e8ly lowercase and '-'
[ 21.496228] x26: 0000000000000000 x25: ffff0000c3bb3d00 x24:
ffff800082cf9bc8ly lowercase and '-'
[ 21.503376] x23: ffff80008344bcb8 x22: 0000000000000001 x21:
ffff0000c31b87b0
[ 21.510524] x20: 00000000fffffffc x19: ffff0000c31b8780 x18:
0000000000000000
[ 21.517673] x17: 0000000000000000 x16: 0000000000000000 x15:
0000000000000000
[ 21.524821] x14: 0000000000000000 x13: 0000000000000000 x12:
0000000000000000
[ 21.531969] x11: 0000000000000000 x10: 00007fffc02bb958 x9 :
0000000000000010
[ 21.539118] x8 : 0101010101010101 x7 : 0000000000000000 x6 :
000080c38080ffff
[ 21.546266] x5 : ffff0000c3000000 x4 : 0000808000800000 x3 :
0000000000000000
[ 21.553415] x2 : 0000000000000000 x1 : 0000000000000001 x0 :
ffff0000c31b8780
[ 21.560565] Call trace:
[ 21.563014] 0x0 (P)
[ 21.565205] notifier_call_chain+0x70/0x120
[ 21.569401] blocking_notifier_call_chain+0x4c/0x78
[ 21.574288] kernel_restart+0x30/0xc8
[ 21.577957] __do_sys_reboot+0x1c8/0x268
[ 21.581886] __arm64_sys_reboot+0x28/0x38
[ 21.585902] invoke_syscall+0x4c/0x118
[ 21.589660] el0_svc_common.constprop.0+0x44/0xe8
[ 21.594373] do_el0_svc+0x20/0x30
[ 21.597694] el0_svc+0x18/0x58
[ 21.600758] el0t_64_sync_handler+0x98/0xe0
[ 21.604947] el0t_64_sync+0x154/0x158
[ 21.608625] Code: ???????? ???????? ???????? ???????? (????????)
[ 21.614730] ---[ end trace 0000000000000000 ]---
Segmentation fault
#
--
Florian
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 02/10] dt-bindings: power: reset: Document reboot-mode cookie
2025-07-10 9:15 ` [PATCH v10 02/10] dt-bindings: power: reset: Document reboot-mode cookie Shivendra Pratap
@ 2025-07-10 22:47 ` Rob Herring
2025-07-11 12:32 ` Shivendra Pratap
0 siblings, 1 reply; 31+ messages in thread
From: Rob Herring @ 2025-07-10 22:47 UTC (permalink / raw)
To: Shivendra Pratap
Cc: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Sudeep Holla, Souvik Chakravarty, Krzysztof Kozlowski,
Conor Dooley, Andy Yan, Mark Rutland, Lorenzo Pieralisi,
Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman, Stephen Boyd, linux-pm,
linux-kernel, devicetree, linux-arm-kernel, linux-arm-msm,
Andre Draszik, Alim Akhtar, linux-samsung-soc, Wei Xu,
linux-rockchip, Baolin Wang, Sen Chu, Sean Wang, Macpaul Lin,
AngeloGioacchino Del Regno, Ray Jui, Scott Branden,
bcm-kernel-feedback-list, Nicolas Ferre, Alexandre Belloni,
Elliot Berman, Srinivas Kandagatla
On Thu, Jul 10, 2025 at 02:45:44PM +0530, Shivendra Pratap wrote:
> Update the reboot-mode binding to support an optional cookie
> value in mode-<cmd> properties. The cookie is used to supply
> additional data for reboot modes that accept two arguments.
>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
> ---
> .../devicetree/bindings/power/reset/reboot-mode.yaml | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> index 3ddac06cec7277789b066d8426ea77d293298fac..a4d2fe1db51e0c1f34ebefddaad82b8cc0b1b34a 100644
> --- a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> +++ b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
> @@ -10,14 +10,15 @@ maintainers:
> - Andy Yan <andy.yan@rock-chips.com>
>
> description: |
> - This driver get reboot mode arguments and call the write
> - interface to store the magic value in special register
> - or ram. Then the bootloader can read it and take different
> - action according to the argument stored.
> + This driver gets reboot mode arguments and calls the write
> + interface to store the magic and an optional cookie value
> + in special register or ram. Then the bootloader can read it
> + and take different action according to the argument stored.
>
> All mode properties are vendor specific, it is a indication to tell
> the bootloader what to do when the system reboots, and should be named
> - as mode-xxx = <magic> (xxx is mode name, magic should be a non-zero value).
> + as mode-xxx = <magic cookie> (xxx is mode name, magic should be a
> + non-zero value, cookie is optional).
I don't understand the distinction between magic and cookie... Isn't all
just magic values and some platform needs more than 32-bits of it?
>
> For example, modes common Android platform are:
> - normal: Normal reboot mode, system reboot with command "reboot".
> @@ -45,5 +46,6 @@ examples:
> mode-recovery = <1>;
> mode-bootloader = <2>;
> mode-loader = <3>;
> + mode-edl = <1 2>;
> };
> ...
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration
2025-07-10 9:15 ` [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration Shivendra Pratap
@ 2025-07-11 1:14 ` kernel test robot
2025-07-11 2:48 ` kernel test robot
2025-07-14 23:11 ` Dmitry Baryshkov
2 siblings, 0 replies; 31+ messages in thread
From: kernel test robot @ 2025-07-11 1:14 UTC (permalink / raw)
To: Shivendra Pratap, Bartosz Golaszewski, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: llvm, oe-kbuild-all, Stephen Boyd, linux-pm, linux-kernel,
devicetree, linux-arm-kernel, linux-arm-msm, Andre Draszik,
Alim Akhtar, linux-samsung-soc, Wei Xu
Hi Shivendra,
kernel test robot noticed the following build errors:
[auto build test ERROR on 58ba80c4740212c29a1cf9b48f588e60a7612209]
url: https://github.com/intel-lab-lkp/linux/commits/Shivendra-Pratap/power-reset-reboot-mode-Add-device-tree-node-based-registration/20250710-172104
base: 58ba80c4740212c29a1cf9b48f588e60a7612209
patch link: https://lore.kernel.org/r/20250710-arm-psci-system_reset2-vendor-reboots-v10-1-b2d3b882be85%40oss.qualcomm.com
patch subject: [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration
config: i386-buildonly-randconfig-006-20250711 (https://download.01.org/0day-ci/archive/20250711/202507110849.ahNmViin-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250711/202507110849.ahNmViin-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507110849.ahNmViin-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
>> drivers/power/reset/reboot-mode.c:15:9: warning: 'pr_fmt' macro redefined [-Wmacro-redefined]
15 | #define pr_fmt(fmt) "reboot-mode: " fmt
| ^
include/linux/printk.h:397:9: note: previous definition is here
397 | #define pr_fmt(fmt) fmt
| ^
>> drivers/power/reset/reboot-mode.c:86:10: error: call to undeclared function 'kzalloc'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
86 | info = kzalloc(sizeof(*info), GFP_KERNEL);
| ^
>> drivers/power/reset/reboot-mode.c:86:8: error: incompatible integer to pointer conversion assigning to 'struct mode_info *' from 'int' [-Wint-conversion]
86 | info = kzalloc(sizeof(*info), GFP_KERNEL);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/power/reset/reboot-mode.c:94:4: error: call to undeclared function 'kfree'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
94 | kfree(info);
| ^
drivers/power/reset/reboot-mode.c:139:3: error: call to undeclared function 'kfree'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
139 | kfree(info);
| ^
1 warning and 4 errors generated.
vim +/kzalloc +86 drivers/power/reset/reboot-mode.c
13
14 #define PREFIX "mode-"
> 15 #define pr_fmt(fmt) "reboot-mode: " fmt
16
17 struct mode_info {
18 const char *mode;
19 u32 magic;
20 struct list_head list;
21 };
22
23 static unsigned int get_reboot_mode_magic(struct reboot_mode_driver *reboot,
24 const char *cmd)
25 {
26 const char *normal = "normal";
27 struct mode_info *info;
28 char cmd_[110];
29
30 if (!cmd)
31 cmd = normal;
32
33 list_for_each_entry(info, &reboot->head, list)
34 if (!strcmp(info->mode, cmd))
35 return info->magic;
36
37 /* try to match again, replacing characters impossible in DT */
38 if (strscpy(cmd_, cmd, sizeof(cmd_)) == -E2BIG)
39 return 0;
40
41 strreplace(cmd_, ' ', '-');
42 strreplace(cmd_, ',', '-');
43 strreplace(cmd_, '/', '-');
44
45 list_for_each_entry(info, &reboot->head, list)
46 if (!strcmp(info->mode, cmd_))
47 return info->magic;
48
49 return 0;
50 }
51
52 static int reboot_mode_notify(struct notifier_block *this,
53 unsigned long mode, void *cmd)
54 {
55 struct reboot_mode_driver *reboot;
56 unsigned int magic;
57
58 reboot = container_of(this, struct reboot_mode_driver, reboot_notifier);
59 magic = get_reboot_mode_magic(reboot, cmd);
60 if (magic)
61 reboot->write(reboot, magic);
62
63 return NOTIFY_DONE;
64 }
65
66 /**
67 * reboot_mode_register - register a reboot mode driver
68 * @reboot: reboot mode driver
69 * @np: Pointer to device tree node
70 *
71 * Returns: 0 on success or a negative error code on failure.
72 */
73 int reboot_mode_register(struct reboot_mode_driver *reboot, struct device_node *np)
74 {
75 struct mode_info *info;
76 struct property *prop;
77 size_t len = strlen(PREFIX);
78 int ret;
79
80 INIT_LIST_HEAD(&reboot->head);
81
82 for_each_property_of_node(np, prop) {
83 if (strncmp(prop->name, PREFIX, len))
84 continue;
85
> 86 info = kzalloc(sizeof(*info), GFP_KERNEL);
87 if (!info) {
88 ret = -ENOMEM;
89 goto error;
90 }
91
92 if (of_property_read_u32(np, prop->name, &info->magic)) {
93 pr_err("reboot mode %s without magic number\n", info->mode);
> 94 kfree(info);
95 continue;
96 }
97
98 info->mode = kstrdup_const(prop->name + len, GFP_KERNEL);
99 if (!info->mode) {
100 ret = -ENOMEM;
101 goto error;
102 } else if (info->mode[0] == '\0') {
103 kfree_const(info->mode);
104 ret = -EINVAL;
105 pr_err("invalid mode name(%s): too short!\n", prop->name);
106 goto error;
107 }
108
109 list_add_tail(&info->list, &reboot->head);
110 }
111
112 reboot->reboot_notifier.notifier_call = reboot_mode_notify;
113 register_reboot_notifier(&reboot->reboot_notifier);
114
115 return 0;
116
117 error:
118 list_for_each_entry(info, &reboot->head, list)
119 kfree_const(info->mode);
120
121 return ret;
122 }
123 EXPORT_SYMBOL_GPL(reboot_mode_register);
124
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration
2025-07-10 9:15 ` [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration Shivendra Pratap
2025-07-11 1:14 ` kernel test robot
@ 2025-07-11 2:48 ` kernel test robot
2025-07-14 23:11 ` Dmitry Baryshkov
2 siblings, 0 replies; 31+ messages in thread
From: kernel test robot @ 2025-07-11 2:48 UTC (permalink / raw)
To: Shivendra Pratap, Bartosz Golaszewski, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: oe-kbuild-all, Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu
Hi Shivendra,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 58ba80c4740212c29a1cf9b48f588e60a7612209]
url: https://github.com/intel-lab-lkp/linux/commits/Shivendra-Pratap/power-reset-reboot-mode-Add-device-tree-node-based-registration/20250710-172104
base: 58ba80c4740212c29a1cf9b48f588e60a7612209
patch link: https://lore.kernel.org/r/20250710-arm-psci-system_reset2-vendor-reboots-v10-1-b2d3b882be85%40oss.qualcomm.com
patch subject: [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration
config: riscv-randconfig-002-20250711 (https://download.01.org/0day-ci/archive/20250711/202507111052.smU9DwLS-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 12.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250711/202507111052.smU9DwLS-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507111052.smU9DwLS-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/power/reset/reboot-mode.c:15: warning: "pr_fmt" redefined
15 | #define pr_fmt(fmt) "reboot-mode: " fmt
|
In file included from include/asm-generic/bug.h:28,
from arch/riscv/include/asm/bug.h:83,
from include/linux/bug.h:5,
from arch/riscv/include/asm/current.h:13,
from include/linux/sched.h:12,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from drivers/power/reset/reboot-mode.c:6:
include/linux/printk.h:397: note: this is the location of the previous definition
397 | #define pr_fmt(fmt) fmt
|
vim +/pr_fmt +15 drivers/power/reset/reboot-mode.c
13
14 #define PREFIX "mode-"
> 15 #define pr_fmt(fmt) "reboot-mode: " fmt
16
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 04/10] dt-bindings: arm: Document reboot mode magic
2025-07-10 16:53 ` Shivendra Pratap
@ 2025-07-11 5:40 ` Arnd Bergmann
2025-07-11 17:13 ` Shivendra Pratap
0 siblings, 1 reply; 31+ messages in thread
From: Arnd Bergmann @ 2025-07-11 5:40 UTC (permalink / raw)
To: Shivendra Pratap, Bartosz Golaszewski, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, André Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla,
Elliot Berman
On Thu, Jul 10, 2025, at 18:53, Shivendra Pratap wrote:
> On 7/10/2025 9:00 PM, Arnd Bergmann wrote:
>> On Thu, Jul 10, 2025, at 11:15, Shivendra Pratap wrote:
>>
>>> + reset-types:
>>> + type: object
>>> + $ref: /schemas/power/reset/reboot-mode.yaml#
>>
>> The other users of the reboot-mode.yaml binding all call this
>> node 'reboot-mode' instead of 'reset-types', can you change that
>> here for consistency?
> nvmem-reboot-mode and syscon-reboot-mode use reboot-mode in the
> device tree node name.
> qcom-pon does not uses reboot-mode at its device tree node name, it
> uses pon.
> Kept it reset-types as this patch was already reviewed earlier and
> the name makes it closer to vendor-specific reset-type.
> Should we make it reboot-mode? Please suggest.
Yes, I would still change that. At least all the platform-independent
drivers are consistent that way.
Arnd
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 02/10] dt-bindings: power: reset: Document reboot-mode cookie
2025-07-10 22:47 ` Rob Herring
@ 2025-07-11 12:32 ` Shivendra Pratap
2025-07-11 14:44 ` Arnd Bergmann
0 siblings, 1 reply; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-11 12:32 UTC (permalink / raw)
To: Rob Herring
Cc: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Sudeep Holla, Souvik Chakravarty, Krzysztof Kozlowski,
Conor Dooley, Andy Yan, Mark Rutland, Lorenzo Pieralisi,
Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman, Stephen Boyd, linux-pm,
linux-kernel, devicetree, linux-arm-kernel, linux-arm-msm,
Andre Draszik, Alim Akhtar, linux-samsung-soc, Wei Xu,
linux-rockchip, Baolin Wang, Sen Chu, Sean Wang, Macpaul Lin,
AngeloGioacchino Del Regno, Ray Jui, Scott Branden,
bcm-kernel-feedback-list, Nicolas Ferre, Alexandre Belloni,
Elliot Berman, Srinivas Kandagatla
On 7/11/2025 4:17 AM, Rob Herring wrote:
> On Thu, Jul 10, 2025 at 02:45:44PM +0530, Shivendra Pratap wrote:
>> Update the reboot-mode binding to support an optional cookie
>> value in mode-<cmd> properties. The cookie is used to supply
>> additional data for reboot modes that accept two arguments.
>>
>> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
>> ---
>> .../devicetree/bindings/power/reset/reboot-mode.yaml | 12 +++++++-----
>> 1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
>> index 3ddac06cec7277789b066d8426ea77d293298fac..a4d2fe1db51e0c1f34ebefddaad82b8cc0b1b34a 100644
>> --- a/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
>> +++ b/Documentation/devicetree/bindings/power/reset/reboot-mode.yaml
>> @@ -10,14 +10,15 @@ maintainers:
>> - Andy Yan <andy.yan@rock-chips.com>
>>
>> description: |
>> - This driver get reboot mode arguments and call the write
>> - interface to store the magic value in special register
>> - or ram. Then the bootloader can read it and take different
>> - action according to the argument stored.
>> + This driver gets reboot mode arguments and calls the write
>> + interface to store the magic and an optional cookie value
>> + in special register or ram. Then the bootloader can read it
>> + and take different action according to the argument stored.
>>
>> All mode properties are vendor specific, it is a indication to tell
>> the bootloader what to do when the system reboots, and should be named
>> - as mode-xxx = <magic> (xxx is mode name, magic should be a non-zero value).
>> + as mode-xxx = <magic cookie> (xxx is mode name, magic should be a
>> + non-zero value, cookie is optional).
>
> I don't understand the distinction between magic and cookie... Isn't all
> just magic values and some platform needs more than 32-bits of it?
Need two different arguments. Will try to clarify a bit below.
PSCI defines SYSTEM_RESET2 vendor-specific resets which takes two
parameters - reset_type and cookie. Both parameters are independent and
used by firmware to define different types of resets or shutdown.
As per spec:
reset_type: Values in the range 0x80000000-0xFFFFFFFF of the reset_type parameter
can be used to request vendor-specific resets or shutdowns.
cookie: the cookie parameter can be used to pass additional data to the
implementation.
Now to implement SYSTEM_RESET2 vendor-specific resets using reboot-mode
driver, we will need two separate arguments. reboot-mode already defines a
magic, which will be used as reset_type. For the second parameter requirement of
SYSTEM_RESET2, we add support for additional argument cookie.
>
>>
>> For example, modes common Android platform are:
>> - normal: Normal reboot mode, system reboot with command "reboot".
>> @@ -45,5 +46,6 @@ examples:
>> mode-recovery = <1>;
>> mode-bootloader = <2>;
>> mode-loader = <3>;
>> + mode-edl = <1 2>;
>> };
>> ...
>>
>> --
>> 2.34.1
>>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2
2025-07-10 20:20 ` [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Florian Fainelli
@ 2025-07-11 12:41 ` Shivendra Pratap
0 siblings, 0 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-11 12:41 UTC (permalink / raw)
To: Florian Fainelli, Bartosz Golaszewski, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, Andre Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla,
Elliot Berman, Konrad Dybcio
On 7/11/2025 1:50 AM, Florian Fainelli wrote:
> On 7/10/25 02:15, Shivendra Pratap wrote:
>> The PSCI SYSTEM_RESET2 call allows vendor firmware to define
>> additional reset types which could be mapped to the reboot
>> argument.
>> User-space should be able to reboot a device into different
>> operational boot-states supported by underlying bootloader and
>> firmware. Generally, some HW registers need to be written, based
>> on which the bootloader and firmware decide the next boot state
>> of device, after the reset. For example, a requirement on
>> Qualcomm platforms may state that reboot with "bootloader"
>> command, should reboot the device into bootloader flashing mode
>> and reboot with “edl” command, should reboot the device into an
>> Emergency flashing mode. Setting up such reboots on Qualcomm
>> devices can be inconsistent across SoC platforms and may require
>> setting different HW registers, where some of these registers may
>> not be accessible to HLOS. These knobs evolve over product
>> generations and require more drivers. PSCI defines a
>> vendor-specific reset in SYSTEM_RESET2 spec, which enables the
>> firmware to take care of underlying setting for any such
>> supported vendor-specific reboot. Qualcomm firmwares are
>> beginning to support and expose PSCI SYSTEM_RESET2
>> vendor-specific reset types to simplify driver requirements from
>> Linux. With such support added in the firmware, we now need a
>> Linux interface which can make use of the firmware calls for PSCI
>> vendor-specific resets. This will align such reboot requirement
>> across platforms and vendors.
>> The current psci driver supports two types of resets –
>> SYSTEM_RESET2 Arch warm-reset and SYSTEM_RESET cold-reset. The
>> patchset introduces the PSCI SYSTEM_RESET2 vendor-specific reset
>> into the reset path of the psci driver and aligns it to work with
>> reboot system call - LINUX_REBOOT_CMD_RESTART2, when used along
>> with a supported string-based command in “*arg”.
>>
>> The patchset uses reboot-mode based commands, to define the
>> supported vendor reset-types commands in psci device tree node
>> and registers these commands with the reboot-mode framework.
>>
>> The PSCI vendor-specific reset takes two arguments, being,
>> reset_type and cookie as defined by the spec. As the
>> vendor-specific reset needs two arguments reset_type and cookie
>> to be passes to the firmware, enhance the reboot-mode framework
>> to support two arguments (magic and cookie), for each reboot-mode
>> command, where cookie will be optional.
>>
>> Along this line, the patchset also extends the reboot-mode
>> framework to add a non-device-based registration function which
>> will allow drivers to register using DT node, while keeping
>> backward compatibility for existing users of reboot-mode. This
>> will enable psci driver to register for reboot-mode and implement
>> a write_with_cookie function which will save the
>> magic(reset_type) and cookie and then use it in psci reset path
>> to make a vendor-specific reset call into the firmware. In
>> addition, the patchset will expose a sysfs entry interface within
>> reboot-mode which can be used by userspace to view the supported
>> reboot-mode commands.
>>
>> The list of vendor-specific reset commands remains open due to
>> divergent requirements across vendors, but this can be
>> streamlined and standardized through dedicated device tree
>> bindings.
>>
>> Currently three drivers register with reboot-mode framework -
>> syscon-reboot-mode, nvmem-reboot-mode and qcom-pon. Consolidated
>> list of commands currently added across various vendor DTs:
>> mode-loader
>> mode-normal
>> mode-bootloader
>> mode-charge
>> mode-fastboot
>> mode-reboot-ab-update
>> mode-recovery
>> mode-rescue
>> mode-shutdown-thermal
>> mode-shutdown-thermal-battery
>>
>> Detailed list of commands being used by syscon-reboot-mode:
>> arm64/boot/dts/exynos/exynosautov9.dtsi:
>> mode-bootloader = <EXYNOSAUTOV9_BOOT_BOOTLOADER>;
>> mode-fastboot = <EXYNOSAUTOV9_BOOT_FASTBOOT>;
>> mode-recovery = <EXYNOSAUTOV9_BOOT_RECOVERY>;
>>
>> arm64/boot/dts/exynos/google/gs101.dtsi:
>> mode-bootloader = <0xfc>;
>> mode-charge = <0x0a>;
>> mode-fastboot = <0xfa>;
>> mode-reboot-ab-update = <0x52>;
>> mode-recovery = <0xff>;
>> mode-rescue = <0xf9>;
>> mode-shutdown-thermal = <0x51>;
>> mode-shutdown-thermal-battery = <0x51>;
>>
>> arm64/boot/dts/hisilicon/hi3660-hikey960.dts:
>> mode-normal = <0x77665501>;
>> mode-bootloader = <0x77665500>;
>> mode-recovery = <0x77665502>;
>>
>> arm64/boot/dts/hisilicon/hi6220-hikey.dts:
>> mode-normal = <0x77665501>;
>> mode-bootloader = <0x77665500>;
>> mode-recovery = <0x77665502>;
>>
>> arm64/boot/dts/rockchip/px30.dtsi:
>> mode-bootloader = <BOOT_BL_DOWNLOAD>;
>> mode-fastboot = <BOOT_FASTBOOT>;
>> mode-loader = <BOOT_BL_DOWNLOAD>;
>> mode-normal = <BOOT_NORMAL>;
>> mode-recovery = <BOOT_RECOVERY>;
>>
>> arm64/boot/dts/rockchip/rk3308.dtsi:
>> mode-bootloader = <BOOT_BL_DOWNLOAD>;
>> mode-loader = <BOOT_BL_DOWNLOAD>;
>> mode-normal = <BOOT_NORMAL>;
>> mode-recovery = <BOOT_RECOVERY>;
>> mode-fastboot = <BOOT_FASTBOOT>;
>>
>> arm64/boot/dts/rockchip/rk3566-lckfb-tspi.dts:
>> mode-normal = <BOOT_NORMAL>;
>> mode-loader = <BOOT_BL_DOWNLOAD>;
>> mode-recovery = <BOOT_RECOVERY>;
>> mode-bootloader = <BOOT_FASTBOOT>;
>>
>> Detailed list of commands being used by nvmem-reboot-mode:
>> arm64/boot/dts/qcom/pmXXXX.dtsi:(multiple qcom DTs)
>> mode-recovery = <0x01>;
>> mode-bootloader = <0x02>;
>>
>> Previous discussions around SYSTEM_RESET2:
>> - https://lore.kernel.org/lkml/20230724223057.1208122-2-quic_eberman@quicinc.com/T/
>> - https://lore.kernel.org/all/4a679542-b48d-7e11-f33a-63535a5c68cb@quicinc.com/
>>
>> Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
>> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
>
> Humm, something changed compared to the last version that I tested from Elliot which worked ok. With this patch applied and the following Device Tree snippet:
>
> psci {
> method = "smc";
> compatible = "arm,psci-0.2", "arm,psci";
> cpu_on = <0xc4000003>;
> cpu_suspend = <0xc4000001>;
> cpu_off = <0x84000002>;
>
> reset-types {
> mode-powercycle = <0x01>;
Yes, Now passing the cookie value is mandatory, when defining your "reset-types".
So your device tree entry should be:
mode-powercycle = <0x01 0>;
Please try by passing changing the dt entry as above.
The dt-binding document is updated and does talks about the mandatory cookie
to be passed in reset-type.
> };
> };
>
> I get the following invoking "reboot powercycle":
>
> # reboot powercycle
> [ 21.403188] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 is not a phandle reference
> [ 21.412032] Mem abort info:extended_property): /rdb/waketimer@841a840:interrupts-extended: cell 0 is not a phandle reference
> [ 21.414840] ESR = 0x0000000086000004operty): /rdb/waketimer@841a840:interrupts-extended: cell 2 is not a phandle reference
> [ 21.418601] EC = 0x21: IABT (current EL), IL = 32 bitsparent: cell 0 is not a phandle reference
> [ 21.423927] SET = 0, FnV = 0: /rdb/xhci_v2@8d00000:phys: cell 0 is not a phandle reference
> [ 21.426988] EA = 0, S1PTW = 0 /rdb/sata@8b0a000/sata-port@0:phys: cell 0 is not a phandle reference
> [ 21.430138] FSC = 0x04: level 0 translation fault:phys: cell 0 is not a phandle reference
> [ 21.435054] user pgtable: 4k pages, 48-bit VAs, pgdp=000000010112c000 a phandle reference
> [ 21.441508] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000handle reference
> [ 21.448318] Internal error: Oops: 0000000086000004 [#1] SMPcell 0 is not a phandle reference
> [ 21.453990] Modules linked in: bdc udc_core/thermal-zones/cpu-thermal:thermal-sensors: cell 0 is not a phandle reference
> [ 21.458188] CPU: 0 UID: 0 PID: 1566 Comm: reboot Not tainted 6.16.0-rc5-next-20250710-gdd78270edd5a #2 NONE 4)
> [ 21.468032] Hardware name: BCX972160DV (DT)ases property name must include only lowercase and '-'
> [ 21.472221] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)only lowercase and '-'
> [ 21.479193] pc : 0x0s_paths): /aliases:pcie0: aliases property is not a valid node (/pcie@8b10000)
> [ 21.481388] lr : reboot_mode_notify+0x64/0x80es property name must include only lowercase and '-'
> [ 21.485760] sp : ffff80008344bbe0iases: aliases property name must include only lowercase and '-'
> [ 21.489079] x29: ffff80008344bbe0 x28: ffff0000c3bb3d00 x27: ffff800080ab58e8ly lowercase and '-'
> [ 21.496228] x26: 0000000000000000 x25: ffff0000c3bb3d00 x24: ffff800082cf9bc8ly lowercase and '-'
> [ 21.503376] x23: ffff80008344bcb8 x22: 0000000000000001 x21: ffff0000c31b87b0
> [ 21.510524] x20: 00000000fffffffc x19: ffff0000c31b8780 x18: 0000000000000000
> [ 21.517673] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
> [ 21.524821] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000
> [ 21.531969] x11: 0000000000000000 x10: 00007fffc02bb958 x9 : 0000000000000010
> [ 21.539118] x8 : 0101010101010101 x7 : 0000000000000000 x6 : 000080c38080ffff
> [ 21.546266] x5 : ffff0000c3000000 x4 : 0000808000800000 x3 : 0000000000000000
> [ 21.553415] x2 : 0000000000000000 x1 : 0000000000000001 x0 : ffff0000c31b8780
> [ 21.560565] Call trace:
> [ 21.563014] 0x0 (P)
> [ 21.565205] notifier_call_chain+0x70/0x120
> [ 21.569401] blocking_notifier_call_chain+0x4c/0x78
> [ 21.574288] kernel_restart+0x30/0xc8
> [ 21.577957] __do_sys_reboot+0x1c8/0x268
> [ 21.581886] __arm64_sys_reboot+0x28/0x38
> [ 21.585902] invoke_syscall+0x4c/0x118
> [ 21.589660] el0_svc_common.constprop.0+0x44/0xe8
> [ 21.594373] do_el0_svc+0x20/0x30
> [ 21.597694] el0_svc+0x18/0x58
> [ 21.600758] el0t_64_sync_handler+0x98/0xe0
> [ 21.604947] el0t_64_sync+0x154/0x158
> [ 21.608625] Code: ???????? ???????? ???????? ???????? (????????)
> [ 21.614730] ---[ end trace 0000000000000000 ]---
> Segmentation fault
> #
>
> --
> Florian
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 02/10] dt-bindings: power: reset: Document reboot-mode cookie
2025-07-11 12:32 ` Shivendra Pratap
@ 2025-07-11 14:44 ` Arnd Bergmann
2025-07-11 17:00 ` Shivendra Pratap
0 siblings, 1 reply; 31+ messages in thread
From: Arnd Bergmann @ 2025-07-11 14:44 UTC (permalink / raw)
To: Shivendra Pratap, Rob Herring
Cc: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Sudeep Holla, Souvik Chakravarty, Krzysztof Kozlowski,
Conor Dooley, Andy Yan, Mark Rutland, Lorenzo Pieralisi,
Olof Johansson, Konrad Dybcio, cros-qcom-dts-watchers, Vinod Koul,
Catalin Marinas, Will Deacon, Florian Fainelli, Elliot Berman,
Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, André Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla
On Fri, Jul 11, 2025, at 14:32, Shivendra Pratap wrote:
> On 7/11/2025 4:17 AM, Rob Herring wrote:
>> On Thu, Jul 10, 2025 at 02:45:44PM +0530, Shivendra Pratap wrote:
>>> All mode properties are vendor specific, it is a indication to tell
>>> the bootloader what to do when the system reboots, and should be named
>>> - as mode-xxx = <magic> (xxx is mode name, magic should be a non-zero value).
>>> + as mode-xxx = <magic cookie> (xxx is mode name, magic should be a
>>> + non-zero value, cookie is optional).
>>
>> I don't understand the distinction between magic and cookie... Isn't all
>> just magic values and some platform needs more than 32-bits of it?
> Need two different arguments. Will try to clarify a bit below.
> PSCI defines SYSTEM_RESET2 vendor-specific resets which takes two
> parameters - reset_type and cookie. Both parameters are independent and
> used by firmware to define different types of resets or shutdown.
> As per spec:
> reset_type: Values in the range 0x80000000-0xFFFFFFFF of the reset_type
> parameter
> can be used to request vendor-specific resets or shutdowns.
> cookie: the cookie parameter can be used to pass additional data to the
> implementation.
I don't see any distinction here either. As Rob says, you have to
get both 32-bit numbers from DT in order to get the desired reboot-mode,
and you have to pass them both to the firmware when rebooting.
The distinction between cookie and magic value may be relevant in the
context of the psci specification, but for the Linux driver, this is
really just a 64-bit magic number.
Arnd
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 02/10] dt-bindings: power: reset: Document reboot-mode cookie
2025-07-11 14:44 ` Arnd Bergmann
@ 2025-07-11 17:00 ` Shivendra Pratap
2025-07-11 17:39 ` Arnd Bergmann
0 siblings, 1 reply; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-11 17:00 UTC (permalink / raw)
To: Arnd Bergmann, Rob Herring
Cc: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Sudeep Holla, Souvik Chakravarty, Krzysztof Kozlowski,
Conor Dooley, Andy Yan, Mark Rutland, Lorenzo Pieralisi,
Olof Johansson, Konrad Dybcio, cros-qcom-dts-watchers, Vinod Koul,
Catalin Marinas, Will Deacon, Florian Fainelli, Elliot Berman,
Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, André Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla
On 7/11/2025 8:14 PM, Arnd Bergmann wrote:
> On Fri, Jul 11, 2025, at 14:32, Shivendra Pratap wrote:
>> On 7/11/2025 4:17 AM, Rob Herring wrote:
>>> On Thu, Jul 10, 2025 at 02:45:44PM +0530, Shivendra Pratap wrote:
>>>> All mode properties are vendor specific, it is a indication to tell
>>>> the bootloader what to do when the system reboots, and should be named
>>>> - as mode-xxx = <magic> (xxx is mode name, magic should be a non-zero value).
>>>> + as mode-xxx = <magic cookie> (xxx is mode name, magic should be a
>>>> + non-zero value, cookie is optional).
>>>
>>> I don't understand the distinction between magic and cookie... Isn't all
>>> just magic values and some platform needs more than 32-bits of it?
>> Need two different arguments. Will try to clarify a bit below.
>> PSCI defines SYSTEM_RESET2 vendor-specific resets which takes two
>> parameters - reset_type and cookie. Both parameters are independent and
>> used by firmware to define different types of resets or shutdown.
>> As per spec:
>> reset_type: Values in the range 0x80000000-0xFFFFFFFF of the reset_type
>> parameter
>> can be used to request vendor-specific resets or shutdowns.
>> cookie: the cookie parameter can be used to pass additional data to the
>> implementation.
>
> I don't see any distinction here either. As Rob says, you have to
> get both 32-bit numbers from DT in order to get the desired reboot-mode,
> and you have to pass them both to the firmware when rebooting.
>
> The distinction between cookie and magic value may be relevant in the
> context of the psci specification, but for the Linux driver, this is
> really just a 64-bit magic number.
ok. then if i understand, this binding change for reboot-mode be dropped
and driver can internally handle the two 32 bit numbers?
>
> Arnd
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 04/10] dt-bindings: arm: Document reboot mode magic
2025-07-11 5:40 ` Arnd Bergmann
@ 2025-07-11 17:13 ` Shivendra Pratap
0 siblings, 0 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-11 17:13 UTC (permalink / raw)
To: Arnd Bergmann, Bartosz Golaszewski, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman
Cc: Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, André Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla,
Elliot Berman
On 7/11/2025 11:10 AM, Arnd Bergmann wrote:
> On Thu, Jul 10, 2025, at 18:53, Shivendra Pratap wrote:
>> On 7/10/2025 9:00 PM, Arnd Bergmann wrote:
>>> On Thu, Jul 10, 2025, at 11:15, Shivendra Pratap wrote:
>>>
>>>> + reset-types:
>>>> + type: object
>>>> + $ref: /schemas/power/reset/reboot-mode.yaml#
>>>
>>> The other users of the reboot-mode.yaml binding all call this
>>> node 'reboot-mode' instead of 'reset-types', can you change that
>>> here for consistency?
>> nvmem-reboot-mode and syscon-reboot-mode use reboot-mode in the
>> device tree node name.
>> qcom-pon does not uses reboot-mode at its device tree node name, it
>> uses pon.
>> Kept it reset-types as this patch was already reviewed earlier and
>> the name makes it closer to vendor-specific reset-type.
>> Should we make it reboot-mode? Please suggest.
>
> Yes, I would still change that. At least all the platform-independent
> drivers are consistent that way.
Ack. will change this to reboot-mode.
>
> Arnd
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 02/10] dt-bindings: power: reset: Document reboot-mode cookie
2025-07-11 17:00 ` Shivendra Pratap
@ 2025-07-11 17:39 ` Arnd Bergmann
2025-07-11 17:49 ` Shivendra Pratap
0 siblings, 1 reply; 31+ messages in thread
From: Arnd Bergmann @ 2025-07-11 17:39 UTC (permalink / raw)
To: Shivendra Pratap, Rob Herring
Cc: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Sudeep Holla, Souvik Chakravarty, Krzysztof Kozlowski,
Conor Dooley, Andy Yan, Mark Rutland, Lorenzo Pieralisi,
Olof Johansson, Konrad Dybcio, cros-qcom-dts-watchers, Vinod Koul,
Catalin Marinas, Will Deacon, Florian Fainelli, Elliot Berman,
Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, André Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla
On Fri, Jul 11, 2025, at 19:00, Shivendra Pratap wrote:
> On 7/11/2025 8:14 PM, Arnd Bergmann wrote:
>> On Fri, Jul 11, 2025, at 14:32, Shivendra Pratap wrote:
>>
>> The distinction between cookie and magic value may be relevant in the
>> context of the psci specification, but for the Linux driver, this is
>> really just a 64-bit magic number.
> ok. then if i understand, this binding change for reboot-mode be dropped
> and driver can internally handle the two 32 bit numbers?
Yes, if you can easily keep it internal to the psci driver, that
would work, or you could just change the callback type to take a
64-bit number and leave the interpretation up to the driver.
Arnd
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 02/10] dt-bindings: power: reset: Document reboot-mode cookie
2025-07-11 17:39 ` Arnd Bergmann
@ 2025-07-11 17:49 ` Shivendra Pratap
0 siblings, 0 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-11 17:49 UTC (permalink / raw)
To: Arnd Bergmann, Rob Herring
Cc: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Sudeep Holla, Souvik Chakravarty, Krzysztof Kozlowski,
Conor Dooley, Andy Yan, Mark Rutland, Lorenzo Pieralisi,
Olof Johansson, Konrad Dybcio, cros-qcom-dts-watchers, Vinod Koul,
Catalin Marinas, Will Deacon, Florian Fainelli, Elliot Berman,
Stephen Boyd, linux-pm, linux-kernel, devicetree,
linux-arm-kernel, linux-arm-msm, André Draszik, Alim Akhtar,
linux-samsung-soc, Wei Xu, linux-rockchip, Baolin Wang, Sen Chu,
Sean Wang, Macpaul Lin, AngeloGioacchino Del Regno, Ray Jui,
Scott Branden, bcm-kernel-feedback-list, Nicolas Ferre,
Alexandre Belloni, Elliot Berman, Srinivas Kandagatla
On 7/11/2025 11:09 PM, Arnd Bergmann wrote:
> On Fri, Jul 11, 2025, at 19:00, Shivendra Pratap wrote:
>> On 7/11/2025 8:14 PM, Arnd Bergmann wrote:
>>> On Fri, Jul 11, 2025, at 14:32, Shivendra Pratap wrote:
>>>
>>> The distinction between cookie and magic value may be relevant in the
>>> context of the psci specification, but for the Linux driver, this is
>>> really just a 64-bit magic number.
>> ok. then if i understand, this binding change for reboot-mode be dropped
>> and driver can internally handle the two 32 bit numbers?
>
> Yes, if you can easily keep it internal to the psci driver, that
> would work, or you could just change the callback type to take a
> 64-bit number and leave the interpretation up to the driver.
ok. thanks. Will try it out.
>
> Arnd
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration
2025-07-10 9:15 ` [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration Shivendra Pratap
2025-07-11 1:14 ` kernel test robot
2025-07-11 2:48 ` kernel test robot
@ 2025-07-14 23:11 ` Dmitry Baryshkov
2025-07-15 4:47 ` Shivendra Pratap
2 siblings, 1 reply; 31+ messages in thread
From: Dmitry Baryshkov @ 2025-07-14 23:11 UTC (permalink / raw)
To: Shivendra Pratap
Cc: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman, Stephen Boyd, linux-pm,
linux-kernel, devicetree, linux-arm-kernel, linux-arm-msm,
Andre Draszik, Alim Akhtar, linux-samsung-soc, Wei Xu,
linux-rockchip, Baolin Wang, Sen Chu, Sean Wang, Macpaul Lin,
AngeloGioacchino Del Regno, Ray Jui, Scott Branden,
bcm-kernel-feedback-list, Nicolas Ferre, Alexandre Belloni,
Elliot Berman, Srinivas Kandagatla
On Thu, Jul 10, 2025 at 02:45:43PM +0530, Shivendra Pratap wrote:
> The reboot-mode driver does not have a strict requirement for
> device-based registration. It primarily uses the device's of_node
> to read mode-<cmd> properties and the device pointer for logging.
>
> Remove the dependency on struct device and introduce support for
> Device Tree (DT) node-based registration. This enables drivers
> that are not associated with a struct device to leverage the
> reboot-mode framework.
>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
> ---
> drivers/power/reset/reboot-mode.c | 23 +++++++++++++----------
> include/linux/reboot-mode.h | 2 +-
> 2 files changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
> index fba53f638da04655e756b5f8b7d2d666d1379535..61f647b23959789a313f3af0bd967abcad45fa43 100644
> --- a/drivers/power/reset/reboot-mode.c
> +++ b/drivers/power/reset/reboot-mode.c
> @@ -12,6 +12,7 @@
> #include <linux/reboot-mode.h>
>
> #define PREFIX "mode-"
> +#define pr_fmt(fmt) "reboot-mode: " fmt
This wasn't really tested. If I remember correctly, it should be defined
before the first include.
>
> struct mode_info {
> const char *mode;
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration
2025-07-14 23:11 ` Dmitry Baryshkov
@ 2025-07-15 4:47 ` Shivendra Pratap
0 siblings, 0 replies; 31+ messages in thread
From: Shivendra Pratap @ 2025-07-15 4:47 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Bartosz Golaszewski, Bjorn Andersson, Sebastian Reichel,
Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Conor Dooley, Andy Yan, Mark Rutland,
Lorenzo Pieralisi, Arnd Bergmann, Olof Johansson, Konrad Dybcio,
cros-qcom-dts-watchers, Vinod Koul, Catalin Marinas, Will Deacon,
Florian Fainelli, Elliot Berman, Stephen Boyd, linux-pm,
linux-kernel, devicetree, linux-arm-kernel, linux-arm-msm,
Andre Draszik, Alim Akhtar, linux-samsung-soc, Wei Xu,
linux-rockchip, Baolin Wang, Sen Chu, Sean Wang, Macpaul Lin,
AngeloGioacchino Del Regno, Ray Jui, Scott Branden,
bcm-kernel-feedback-list, Nicolas Ferre, Alexandre Belloni,
Elliot Berman, Srinivas Kandagatla
On 7/15/2025 4:41 AM, Dmitry Baryshkov wrote:
> On Thu, Jul 10, 2025 at 02:45:43PM +0530, Shivendra Pratap wrote:
>> The reboot-mode driver does not have a strict requirement for
>> device-based registration. It primarily uses the device's of_node
>> to read mode-<cmd> properties and the device pointer for logging.
>>
>> Remove the dependency on struct device and introduce support for
>> Device Tree (DT) node-based registration. This enables drivers
>> that are not associated with a struct device to leverage the
>> reboot-mode framework.
>>
>> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
>> ---
>> drivers/power/reset/reboot-mode.c | 23 +++++++++++++----------
>> include/linux/reboot-mode.h | 2 +-
>> 2 files changed, 14 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
>> index fba53f638da04655e756b5f8b7d2d666d1379535..61f647b23959789a313f3af0bd967abcad45fa43 100644
>> --- a/drivers/power/reset/reboot-mode.c
>> +++ b/drivers/power/reset/reboot-mode.c
>> @@ -12,6 +12,7 @@
>> #include <linux/reboot-mode.h>
>>
>> #define PREFIX "mode-"
>> +#define pr_fmt(fmt) "reboot-mode: " fmt
>
> This wasn't really tested. If I remember correctly, it should be defined
> before the first include.
yes. fixing this in next patch.
>
>>
>> struct mode_info {
>> const char *mode;
>
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2025-07-15 4:47 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 9:15 [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 01/10] power: reset: reboot-mode: Add device tree node-based registration Shivendra Pratap
2025-07-11 1:14 ` kernel test robot
2025-07-11 2:48 ` kernel test robot
2025-07-14 23:11 ` Dmitry Baryshkov
2025-07-15 4:47 ` Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 02/10] dt-bindings: power: reset: Document reboot-mode cookie Shivendra Pratap
2025-07-10 22:47 ` Rob Herring
2025-07-11 12:32 ` Shivendra Pratap
2025-07-11 14:44 ` Arnd Bergmann
2025-07-11 17:00 ` Shivendra Pratap
2025-07-11 17:39 ` Arnd Bergmann
2025-07-11 17:49 ` Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 03/10] power: reset: reboot-mode: Add optional cookie argument Shivendra Pratap
2025-07-10 15:29 ` Arnd Bergmann
2025-07-10 16:40 ` Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 04/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
2025-07-10 15:30 ` Arnd Bergmann
2025-07-10 16:53 ` Shivendra Pratap
2025-07-11 5:40 ` Arnd Bergmann
2025-07-11 17:13 ` Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 05/10] firmware: psci: Implement vendor-specific reset-types as reboot-mode Shivendra Pratap
2025-07-10 15:45 ` Konrad Dybcio
2025-07-10 16:34 ` Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 06/10] arm64: dts: qcom: qcm6490-idp: Add PSCI SYSTEM_RESET2 types Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 07/10] arm64: dts: qcom: qcs6490-rb3gen2: " Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 08/10] arm64: dts: qcom: sa8775p-ride: " Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 09/10] Documentation: ABI: Add sysfs-class-reboot-mode-reboot_modes Shivendra Pratap
2025-07-10 9:15 ` [PATCH v10 10/10] power: reset: reboot-mode: Expose sysfs for registered arguments Shivendra Pratap
2025-07-10 20:20 ` [PATCH v10 00/10] Implement vendor resets for PSCI SYSTEM_RESET2 Florian Fainelli
2025-07-11 12:41 ` Shivendra Pratap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).