* [PATCH v18 00/10] Implement PSCI reboot mode driver for PSCI resets
@ 2025-12-23 17:07 Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 01/10] power: reset: reboot-mode: Remove devres based allocations Shivendra Pratap
` (9 more replies)
0 siblings, 10 replies; 14+ messages in thread
From: Shivendra Pratap @ 2025-12-23 17:07 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, Shivendra Pratap,
Srinivas Kandagatla, Umang Chheda, Nirmesh Kumar Singh, Song Xue
Userspace should be able to initiate device reboots using the various
PSCI SYSTEM_RESET and SYSTEM_RESET2 types defined by PSCI spec. This
patch series introduces psci-reboot-mode driver that registers with
reboot-mode framework to provide this functionality.
The PSCI system reset calls takes two arguments: reset_type and cookie.
It defines predefined reset types, such as warm and cold reset, and
vendor-specific reset types which are SoC vendor specific. To support
these requirements, the reboot-mode framework is enhanced in two key
ways:
1. 64-bit magic support: Extend reboot-mode to handle two 32-bit
arguments (reset_type and cookie) by encoding them into a single 64-bit
magic value.
2. Predefined modes: Add support for predefined reboot modes in the
framework.
With these enhancements, the patch series enables:
- Warm reset and cold reset as predefined reboot modes.
- Vendor-specific resets exposed as tunables, configurable via the
SoC-specific device tree.
Together, these changes allow userspace to trigger all above PSCI resets
from userspace.
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
On gs101 we also pass kernel-generated modes from kernel_restart()
or panic(), specifically DM verity's 'dm-verity device corrupted':
mode-dm-verity-device-corrupted = <0x50>;
- thanks Andre' for providing this.
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>;
The patch is tested on rb3Gen2, lemans-ride, lemans-evk, monaco-ride,
qcs615-ride.
@Florian/@Kathiravan, Please note that reset_type in DT needs to be
full in itself with 31st bit set. (eg: 0x80000000).
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: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Changes in v18:
power: reset: reboot-mode: Remove devres based allocations
- Update commit text for alignment. – Bart
- Read magic before assigning kzalloc(info) in reboot_mode_register. - Mukesh
- Update error handling path. - Mukesh
By Bjorn
- Expose sysfs for reboot-mode bisected to different series-
Link: https://lore.kernel.org/all/20251222-next-15nov_expose_sysfs-v21-0-244614135fd8@oss.qualcomm.com/
By Bjorn/Lorenzo/Mukesh
power: reset: reboot-mode: Add support for 64 bit magic
- Use FIELD_GET/FIELD_PREP for u64 magic wherever required.
- Update commit text and add documentation for structure of 64 bit magic.
By Lorenzo
- Remove direct reboot-mode registration by psci driver.
- Add support for predefined reboot modes in reboot-mode framework.
- Add psci-reboot-mode driver and implement a psci-resets to accommodate
all psci-resets including warm, cold and customizable vendor-resets.
By Bjorn
- Update DT patches for qcm6490, lemans, monaco and tolos.
- Update commit text to include more details – By Bjorn
For Alignment
- dt-bindings: arm: Document reboot mode magic
- Update reboot mode documentation to clarify that argument1 should provide
full value of reset_type along with the 31st bit wherever required.
- DT patches for qcm6490, lemans, monaco and tolos.
- Provide full value of reset_type including 31st bit.(eg:0x80000001).
- Link to v17: https://lore.kernel.org/r/20251109-arm-psci-system_reset2-vendor-reboots-v17-0-46e085bca4cc@oss.qualcomm.com
Changes in v17:
Remove the patch to synchronize list traversal - Bjorn
power: reset: reboot-mode: Remove devres based allocations
- Remove devres based allocations as a fix - Bartosz
power: reset: reboot-mode: Expose sysfs for registered reboot_modes
- remove devres based allocations in create_reboot_mode_device
and manually free resources on failure. - Bartosz
- Add driver data while creating reboot device and
retrive the same in reboot_mode_show. - Bartosz
- Remove the mutex lock.
firmware: psci: Implement vendor-specific resets as reboot-mode
- Call put_device(np) once processing is complete - Pavan Kondeti
Move reboot-mode to SOC DT wherever applicable - Mukesh Ojha
- Link to v16: https://lore.kernel.org/r/20251015-arm-psci-system_reset2-vendor-reboots-v16-0-b98aedaa23ee@oss.qualcomm.com
Changes in v16:
firmware: psci: Implement vendor-specific resets as reboot-mode
- Use GENMASK(31, 0) instead of 0xffffffff - by Kathiravan
- Link to v15: https://lore.kernel.org/r/20250922-arm-psci-system_reset2-vendor-reboots-v15-0-7ce3a08878f1@oss.qualcomm.com
Changes in v15:
By Sebastian:
power: reset: reboot-mode: Synchronize list traversal
- Change mutex locking to scoped_guard() and a Fixes: tag
power: reset: reboot-mode: Add device tree node-based registration
- Change reboot_mode_register external call to use fwnode
power: reset: reboot-mode: Expose sysfs for registered reboot_modes
- Use sysfs_emit_at for printing sysfs entries
- Add driver_name to struct reboot_mode_driver instead of passing
as argument
- Update reboot_mode_register, devm_reboot_mode_register and
create_reboot_mode_device for same.
firmware: psci: Implement vendor-specific resets as reboot-mode
- Update psci to use updated reboot_mode_register and store driver_name
to struct reboot_mode_driver
- Add DT nodes for PSCI SYSTEM_RESET2 types for lemans-evk, qcs8300-ride,
monaco-evk and qcs615-ride boards.
- Link to v14: https://lore.kernel.org/r/20250815-arm-psci-system_reset2-vendor-reboots-v14-0-37d29f59ac9a@oss.qualcomm.com
Changes in v14:
- mode-dm-verity-device-corrupted documented in cover letter -by André
ABI Documentation:
- Updated KernelVersion in ABI documentation to reflect base commit
version. – by André
- Revised ABI documentation to clarify space-separated format for
supported reboot-mode commands. – by André
power: reset: reboot-mode: Expose sysfs patch
- Modified `show_modes` to output a space-separated list of supported
reboot modes – by André
- Added error handling in `create_reboot_mode_device()` to ensure
proper cleanup on failure.
firmware: psci:
- Locate psci/reboot-mode node using psci compatible. - by Krzysztof,
Dmitry, Sudeep.
- Added error handling for additional code for compatible.
- Converted hex values to lowercase for consistency. – by André
- Introduced panic notifier to disable valid vendor-reset flag in
panic path. – by André
- Added check for `psci_system_reset2` before registering vendor reset
commands.
- Updated Commit text.
dts: sa8775p:
- DT file name changed from sa8775p to lemans and commit text updated
accordingly. – for dt renaming in base commit (sa8775p to lemans).
- Link to v13: https://lore.kernel.org/r/20250727-arm-psci-system_reset2-vendor-reboots-v13-0-6b8d23315898@oss.qualcomm.com
Changes in v13:
- Split patch1 into two (Synchronize list traversal and DT node-based
registration) - by Dmitry.
- Move mutex lock inside get_reboot_mode_magic - by Dmitry.
- Reorder the patches – pull patch8 for exposing reboot-mode sysfs before
psci patch - to align the change in reboot-mode sysfs patch.
- Update patch- reboot-mode: Expose sysfs for registered reboot_modes
- Introduce a driver_name in reboot_mode_register. This will be used
in sysfs creation - by Arnd.
- Update documentation and commit text for above.
- Fix release function to properly call delete attr file.
- Fix sparse warning for devres_find.
- Add error handling for devres_find.
- Split ABI documentation as a separate patch and update ABI documentation
for usage of driver-name in sysfs - by Arnd
- Update patch - psci: Implement vendor-specific resets as reboot-mode
- Fix Kconfig for CONFIG related warning.
- Add driver_name as "psci" in register call to reboot-mode - by Arnd
- Link to v12: https://lore.kernel.org/r/20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com
Changes in v12:
- Added lock for list traversals in reboot-mode - by Dmitry.
- Added proper handling for BE and LE cases in reboot-mode - by Dmitry.
- Removed type casting for u64 to u32 conversions. Added limit checks
and used bitwise operations for same - by Andrew.
- Link to v11: https://lore.kernel.org/r/20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@oss.qualcomm.com
Changes in v11:
- Remove reference of cookie in reboot-mode – Arnd/Rob
- Introduce 64-bit magic in reboot-mode to accommodate two 32-bit
arguments – Arnd
- Change reset-type to reboot-mode in psci device tree binding – Arnd
- binding no more mandates two arguments as in v10.
- dt changes done to support this binding.
- Remove obvious comments in psci reset path – Konrad
- Merge sysfs and ABI doc into single patch.
- Fix compilation issue on X86 configs.
- Fix warnings for pr_fmt.
- Link to v10: https://lore.kernel.org/all/569f154d-c714-1714-b898-83a42a38771c@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
---
Shivendra Pratap (10):
power: reset: reboot-mode: Remove devres based allocations
power: reset: reboot-mode: Add support for 64 bit magic
power: reset: reboot-mode: Add support for predefined reboot modes
firmware: psci: Introduce command-based reset in psci_sys_reset
dt-bindings: arm: Document reboot mode magic
power: reset: Add psci-reboot-mode driver
arm64: dts: qcom: qcm6490: Add psci reboot-modes
arm64: dts: qcom: lemans: Add psci reboot-modes
arm64: dts: qcom: monaco: Add psci reboot-modes
arm64: dts: qcom: talos: Add psci reboot-modes
Documentation/devicetree/bindings/arm/psci.yaml | 42 +++++++++
arch/arm64/boot/dts/qcom/kodiak.dtsi | 2 +-
arch/arm64/boot/dts/qcom/lemans.dtsi | 5 ++
arch/arm64/boot/dts/qcom/monaco.dtsi | 5 ++
arch/arm64/boot/dts/qcom/qcm6490-idp.dts | 7 ++
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 7 ++
arch/arm64/boot/dts/qcom/talos.dtsi | 5 ++
drivers/firmware/psci/psci.c | 46 +++++++++-
drivers/power/reset/Kconfig | 10 +++
drivers/power/reset/Makefile | 1 +
drivers/power/reset/nvmem-reboot-mode.c | 11 ++-
drivers/power/reset/psci-reboot-mode.c | 111 ++++++++++++++++++++++++
drivers/power/reset/qcom-pon.c | 9 +-
drivers/power/reset/reboot-mode.c | 79 ++++++++++++-----
drivers/power/reset/syscon-reboot-mode.c | 9 +-
include/linux/psci.h | 2 +
include/linux/reboot-mode.h | 15 +++-
17 files changed, 331 insertions(+), 35 deletions(-)
---
base-commit: cc3aa43b44bdb43dfbac0fcb51c56594a11338a8
change-id: 20250709-arm-psci-system_reset2-vendor-reboots-46c80044afcf
Best regards,
--
Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v18 01/10] power: reset: reboot-mode: Remove devres based allocations
2025-12-23 17:07 [PATCH v18 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
@ 2025-12-23 17:07 ` Shivendra Pratap
2025-12-25 10:16 ` kernel test robot
2025-12-23 17:07 ` [PATCH v18 02/10] power: reset: reboot-mode: Add support for 64 bit magic Shivendra Pratap
` (8 subsequent siblings)
9 siblings, 1 reply; 14+ messages in thread
From: Shivendra Pratap @ 2025-12-23 17:07 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, Shivendra Pratap,
Srinivas Kandagatla
Devres APIs are intended for use in drivers, where the managed lifetime
of resources is tied directly to the driver attach/detach cycle. In
shared subsystem code, there is no guarantee that the subsystem
functions will only be called after a driver has been attached, nor that
they will not be referenced after the managed resources have been
released during driver detach.
To ensure correct lifetime handling, avoid using devres-based
allocations in the reboot-mode and explicitly handle allocation and
cleanup of resources.
Fixes: 4fcd504edbf7 ("power: reset: add reboot mode driver")
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/reboot-mode.c | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index fba53f638da04655e756b5f8b7d2d666d1379535..4b6ae4007c4f6fb7d51520b4be2bf3cb1dff518e 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -3,6 +3,8 @@
* Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd
*/
+#define pr_fmt(fmt) "reboot-mode: " fmt
+
#include <linux/device.h>
#include <linux/init.h>
#include <linux/kernel.h>
@@ -71,9 +73,11 @@ static int reboot_mode_notify(struct notifier_block *this,
int reboot_mode_register(struct reboot_mode_driver *reboot)
{
struct mode_info *info;
+ struct mode_info *next;
struct property *prop;
struct device_node *np = reboot->dev->of_node;
size_t len = strlen(PREFIX);
+ u32 magic;
int ret;
INIT_LIST_HEAD(&reboot->head);
@@ -82,19 +86,17 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
if (strncmp(prop->name, PREFIX, len))
continue;
- info = devm_kzalloc(reboot->dev, sizeof(*info), GFP_KERNEL);
+ if (of_property_read_u32(np, prop->name, &magic)) {
+ pr_err("reboot mode %s without magic number\n", prop->name);
+ continue;
+ }
+
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) {
ret = -ENOMEM;
goto error;
}
- if (of_property_read_u32(np, prop->name, &info->magic)) {
- dev_err(reboot->dev, "reboot mode %s without magic number\n",
- info->mode);
- devm_kfree(reboot->dev, info);
- continue;
- }
-
info->mode = kstrdup_const(prop->name + len, GFP_KERNEL);
if (!info->mode) {
ret = -ENOMEM;
@@ -102,8 +104,7 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
} else if (info->mode[0] == '\0') {
kfree_const(info->mode);
ret = -EINVAL;
- dev_err(reboot->dev, "invalid mode name(%s): too short!\n",
- prop->name);
+ pr_err("invalid mode name(%s): too short!\n", prop->name);
goto error;
}
@@ -116,8 +117,12 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
return 0;
error:
- list_for_each_entry(info, &reboot->head, list)
+ kfree(info);
+ list_for_each_entry_safe(info, next, &reboot->head, list) {
+ list_del(&info->list);
kfree_const(info->mode);
+ kfree(info);
+ }
return ret;
}
@@ -130,11 +135,15 @@ EXPORT_SYMBOL_GPL(reboot_mode_register);
int reboot_mode_unregister(struct reboot_mode_driver *reboot)
{
struct mode_info *info;
+ struct mode_info *next;
unregister_reboot_notifier(&reboot->reboot_notifier);
- list_for_each_entry(info, &reboot->head, list)
+ list_for_each_entry_safe(info, next, &reboot->head, list) {
+ list_del(&info->list);
kfree_const(info->mode);
+ kfree(info);
+ }
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v18 02/10] power: reset: reboot-mode: Add support for 64 bit magic
2025-12-23 17:07 [PATCH v18 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 01/10] power: reset: reboot-mode: Remove devres based allocations Shivendra Pratap
@ 2025-12-23 17:07 ` Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 03/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
` (7 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Shivendra Pratap @ 2025-12-23 17:07 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, Shivendra Pratap,
Srinivas Kandagatla, Umang Chheda, Nirmesh Kumar Singh
Current reboot-mode supports a single 32-bit argument for any
supported mode. Some reboot-mode based drivers may require
passing two independent 32-bit arguments during a reboot
sequence, for uses-cases, where a mode requires an additional
argument. Such drivers may not be able to use the reboot-mode
driver. For example, ARM PSCI vendor-specific resets, need two
arguments for its operation – reset_type and cookie, to complete
the reset operation. If a driver wants to implement this
firmware-based reset, it cannot use reboot-mode framework.
Introduce 64-bit magic values in reboot-mode driver to
accommodate up-to two 32-bit arguments.
u64 magic
--------------------------------------------
| Higher 32 bit | Lower 32 bit |
| arg2 | arg1 |
--------------------------------------------
Update current reboot-mode drivers for 64-bit magic.
Reviewed-by: Umang Chheda <umang.chheda@oss.qualcomm.com>
Reviewed-by: Nirmesh Kumar Singh <nirmesh.singh@oss.qualcomm.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/nvmem-reboot-mode.c | 10 ++++++----
drivers/power/reset/qcom-pon.c | 8 +++++---
drivers/power/reset/reboot-mode.c | 24 ++++++++++++++++++------
drivers/power/reset/syscon-reboot-mode.c | 8 +++++---
include/linux/reboot-mode.h | 6 +++++-
5 files changed, 39 insertions(+), 17 deletions(-)
diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/nvmem-reboot-mode.c
index 41530b70cfc48c2a83fbbd96f523d5816960a0d1..b3d21d39b0f732254c40103db1b51fb7045ce344 100644
--- a/drivers/power/reset/nvmem-reboot-mode.c
+++ b/drivers/power/reset/nvmem-reboot-mode.c
@@ -16,15 +16,17 @@ struct nvmem_reboot_mode {
struct nvmem_cell *cell;
};
-static int nvmem_reboot_mode_write(struct reboot_mode_driver *reboot,
- unsigned int magic)
+static int nvmem_reboot_mode_write(struct reboot_mode_driver *reboot, u64 magic)
{
- int ret;
struct nvmem_reboot_mode *nvmem_rbm;
+ u32 magic_arg1;
+ int ret;
+ /* Use low 32 bits of magic for argument_1 */
+ magic_arg1 = FIELD_GET(GENMASK_ULL(31, 0), magic);
nvmem_rbm = container_of(reboot, struct nvmem_reboot_mode, reboot);
- ret = nvmem_cell_write(nvmem_rbm->cell, &magic, sizeof(magic));
+ ret = nvmem_cell_write(nvmem_rbm->cell, &magic_arg1, sizeof(magic_arg1));
if (ret < 0)
dev_err(reboot->dev, "update reboot mode bits failed\n");
diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
index 7e108982a582e8243c5c806bd4a793646b87189f..ccce1673b2ec47d02524edd44811d4f528c243e8 100644
--- a/drivers/power/reset/qcom-pon.c
+++ b/drivers/power/reset/qcom-pon.c
@@ -27,17 +27,19 @@ struct qcom_pon {
long reason_shift;
};
-static int qcom_pon_reboot_mode_write(struct reboot_mode_driver *reboot,
- unsigned int magic)
+static int qcom_pon_reboot_mode_write(struct reboot_mode_driver *reboot, u64 magic)
{
struct qcom_pon *pon = container_of
(reboot, struct qcom_pon, reboot_mode);
+ u32 magic_arg1;
int ret;
+ /* Use low 32 bits of magic for argument_1 */
+ magic_arg1 = FIELD_GET(GENMASK_ULL(31, 0), magic);
ret = regmap_update_bits(pon->regmap,
pon->baseaddr + PON_SOFT_RB_SPARE,
GENMASK(7, pon->reason_shift),
- magic << pon->reason_shift);
+ magic_arg1 << pon->reason_shift);
if (ret < 0)
dev_err(pon->dev, "update reboot mode bits failed\n");
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index 4b6ae4007c4f6fb7d51520b4be2bf3cb1dff518e..54adcda57e44edf2fd2cda0f752226f747aa72d7 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -17,12 +17,11 @@
struct mode_info {
const char *mode;
- u32 magic;
+ u64 magic;
struct list_head list;
};
-static unsigned int get_reboot_mode_magic(struct reboot_mode_driver *reboot,
- const char *cmd)
+static u64 get_reboot_mode_magic(struct reboot_mode_driver *reboot, const char *cmd)
{
const char *normal = "normal";
struct mode_info *info;
@@ -54,7 +53,7 @@ static int reboot_mode_notify(struct notifier_block *this,
unsigned long mode, void *cmd)
{
struct reboot_mode_driver *reboot;
- unsigned int magic;
+ u64 magic;
reboot = container_of(this, struct reboot_mode_driver, reboot_notifier);
magic = get_reboot_mode_magic(reboot, cmd);
@@ -77,7 +76,8 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
struct property *prop;
struct device_node *np = reboot->dev->of_node;
size_t len = strlen(PREFIX);
- u32 magic;
+ u32 magic_arg1;
+ u32 magic_arg2;
int ret;
INIT_LIST_HEAD(&reboot->head);
@@ -86,10 +86,13 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
if (strncmp(prop->name, PREFIX, len))
continue;
- if (of_property_read_u32(np, prop->name, &magic)) {
+ if (of_property_read_u32(np, prop->name, &magic_arg1)) {
pr_err("reboot mode %s without magic number\n", prop->name);
continue;
}
+ /* Default magic_arg2 to zero */
+ if (of_property_read_u32_index(np, prop->name, 1, &magic_arg2))
+ magic_arg2 = 0;
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) {
@@ -97,6 +100,15 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
goto error;
}
+ /**
+ * Format of u64 magic
+ *-------------------------------------------
+ *| Higher 32 bit | Lower 32 bit |
+ *| arg2 | arg1 |
+ *-------------------------------------------
+ */
+ info->magic = FIELD_PREP(GENMASK_ULL(63, 32), magic_arg2) |
+ FIELD_PREP(GENMASK_ULL(31, 0), magic_arg1);
info->mode = kstrdup_const(prop->name + len, GFP_KERNEL);
if (!info->mode) {
ret = -ENOMEM;
diff --git a/drivers/power/reset/syscon-reboot-mode.c b/drivers/power/reset/syscon-reboot-mode.c
index e0772c9f70f7a19cd8ec8a0b7fdbbaa7ba44afd0..eb7fc5b7d6a7ed8a833d4920991c4c40b5b13ca7 100644
--- a/drivers/power/reset/syscon-reboot-mode.c
+++ b/drivers/power/reset/syscon-reboot-mode.c
@@ -20,16 +20,18 @@ struct syscon_reboot_mode {
u32 mask;
};
-static int syscon_reboot_mode_write(struct reboot_mode_driver *reboot,
- unsigned int magic)
+static int syscon_reboot_mode_write(struct reboot_mode_driver *reboot, u64 magic)
{
struct syscon_reboot_mode *syscon_rbm;
+ u32 magic_arg1;
int ret;
+ /* Use low 32 bits of magic for argument_1 */
+ magic_arg1 = FIELD_GET(GENMASK_ULL(31, 0), magic);
syscon_rbm = container_of(reboot, struct syscon_reboot_mode, reboot);
ret = regmap_update_bits(syscon_rbm->map, syscon_rbm->offset,
- syscon_rbm->mask, magic);
+ syscon_rbm->mask, magic_arg1);
if (ret < 0)
dev_err(reboot->dev, "update reboot mode bits failed\n");
diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h
index 4a2abb38d1d612ec0fdf05eb18c98b210f631b7f..a359dc0c6dede0ac5ce67190a00d46a7e7856707 100644
--- a/include/linux/reboot-mode.h
+++ b/include/linux/reboot-mode.h
@@ -2,10 +2,14 @@
#ifndef __REBOOT_MODE_H__
#define __REBOOT_MODE_H__
+#include <linux/bitfield.h>
+#include <linux/bits.h>
+#include <linux/types.h>
+
struct reboot_mode_driver {
struct device *dev;
struct list_head head;
- int (*write)(struct reboot_mode_driver *reboot, unsigned int magic);
+ int (*write)(struct reboot_mode_driver *reboot, u64 magic);
struct notifier_block reboot_notifier;
};
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v18 03/10] power: reset: reboot-mode: Add support for predefined reboot modes
2025-12-23 17:07 [PATCH v18 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 01/10] power: reset: reboot-mode: Remove devres based allocations Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 02/10] power: reset: reboot-mode: Add support for 64 bit magic Shivendra Pratap
@ 2025-12-23 17:07 ` Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 04/10] firmware: psci: Introduce command-based reset in psci_sys_reset Shivendra Pratap
` (6 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Shivendra Pratap @ 2025-12-23 17:07 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, Shivendra Pratap,
Srinivas Kandagatla
reboot-mode based drivers can define a reboot-mode by adding it under
the reboot-mode node in device tree. This limits such drivers, to define
any predefined reboot-modes statically within the driver and creates a
dependency on device-tree.
Introduce a list for predefined modes in the reboot-mode framework and
process the predefined reboot-modes along with the device-tree defined
reboot-modes. Modify existing reboot-mode based drivers to initialize
the predefined list-head as empty.
This patch enables a reboot mode driver to define reboot-modes through a
predefined static list, in addition to the device-tree based reboot-modes.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/nvmem-reboot-mode.c | 1 +
drivers/power/reset/qcom-pon.c | 1 +
drivers/power/reset/reboot-mode.c | 28 ++++++++++++++++++++++------
drivers/power/reset/syscon-reboot-mode.c | 1 +
include/linux/reboot-mode.h | 9 +++++++++
5 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/nvmem-reboot-mode.c
index b3d21d39b0f732254c40103db1b51fb7045ce344..b02a2af31aac52cb0ab19cf5d4d315d17c208f6e 100644
--- a/drivers/power/reset/nvmem-reboot-mode.c
+++ b/drivers/power/reset/nvmem-reboot-mode.c
@@ -44,6 +44,7 @@ static int nvmem_reboot_mode_probe(struct platform_device *pdev)
nvmem_rbm->reboot.dev = &pdev->dev;
nvmem_rbm->reboot.write = nvmem_reboot_mode_write;
+ INIT_LIST_HEAD(&nvmem_rbm->reboot.predefined_modes);
nvmem_rbm->cell = devm_nvmem_cell_get(&pdev->dev, "reboot-mode");
if (IS_ERR(nvmem_rbm->cell)) {
diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
index ccce1673b2ec47d02524edd44811d4f528c243e8..bf7b9f0bcdcc4c168aa7ff8d6494122d898814b5 100644
--- a/drivers/power/reset/qcom-pon.c
+++ b/drivers/power/reset/qcom-pon.c
@@ -75,6 +75,7 @@ static int qcom_pon_probe(struct platform_device *pdev)
pon->reboot_mode.dev = &pdev->dev;
pon->reason_shift = reason_shift;
pon->reboot_mode.write = qcom_pon_reboot_mode_write;
+ INIT_LIST_HEAD(&pon->reboot_mode.predefined_modes);
error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode);
if (error) {
dev_err(&pdev->dev, "can't register reboot mode\n");
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index 54adcda57e44edf2fd2cda0f752226f747aa72d7..c17c61f47f069b96a9b38699de71dc1f30a807c5 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -15,12 +15,6 @@
#define PREFIX "mode-"
-struct mode_info {
- const char *mode;
- u64 magic;
- struct list_head list;
-};
-
static u64 get_reboot_mode_magic(struct reboot_mode_driver *reboot, const char *cmd)
{
const char *normal = "normal";
@@ -71,6 +65,7 @@ static int reboot_mode_notify(struct notifier_block *this,
*/
int reboot_mode_register(struct reboot_mode_driver *reboot)
{
+ struct mode_info *info_predef;
struct mode_info *info;
struct mode_info *next;
struct property *prop;
@@ -82,6 +77,9 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
INIT_LIST_HEAD(&reboot->head);
+ if (!np)
+ goto predefined_modes;
+
for_each_property_of_node(np, prop) {
if (strncmp(prop->name, PREFIX, len))
continue;
@@ -123,6 +121,24 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
list_add_tail(&info->list, &reboot->head);
}
+predefined_modes:
+ list_for_each_entry(info_predef, &reboot->predefined_modes, list) {
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
+ if (!info) {
+ ret = -ENOMEM;
+ goto error;
+ }
+
+ info->mode = kstrdup_const(info_predef->mode, GFP_KERNEL);
+ if (!info->mode) {
+ ret = -ENOMEM;
+ goto error;
+ }
+
+ info->magic = info_predef->magic;
+ list_add_tail(&info->list, &reboot->head);
+ }
+
reboot->reboot_notifier.notifier_call = reboot_mode_notify;
register_reboot_notifier(&reboot->reboot_notifier);
diff --git a/drivers/power/reset/syscon-reboot-mode.c b/drivers/power/reset/syscon-reboot-mode.c
index eb7fc5b7d6a7ed8a833d4920991c4c40b5b13ca7..74e2e14c5d87c54ac24ef63c7905b3266d736439 100644
--- a/drivers/power/reset/syscon-reboot-mode.c
+++ b/drivers/power/reset/syscon-reboot-mode.c
@@ -50,6 +50,7 @@ static int syscon_reboot_mode_probe(struct platform_device *pdev)
syscon_rbm->reboot.dev = &pdev->dev;
syscon_rbm->reboot.write = syscon_reboot_mode_write;
syscon_rbm->mask = 0xffffffff;
+ INIT_LIST_HEAD(&syscon_rbm->reboot.predefined_modes);
syscon_rbm->map = syscon_node_to_regmap(pdev->dev.parent->of_node);
if (IS_ERR(syscon_rbm->map))
diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h
index a359dc0c6dede0ac5ce67190a00d46a7e7856707..bddec9b7f94187dcb056540df79eea34c25b1d0d 100644
--- a/include/linux/reboot-mode.h
+++ b/include/linux/reboot-mode.h
@@ -4,11 +4,20 @@
#include <linux/bitfield.h>
#include <linux/bits.h>
+#include <linux/reboot.h>
#include <linux/types.h>
+struct mode_info {
+ const char *mode;
+ u64 magic;
+ struct list_head list;
+};
+
struct reboot_mode_driver {
struct device *dev;
struct list_head head;
+ /* List of predefined reboot-modes, a reboot-mode-driver may populate. */
+ struct list_head predefined_modes;
int (*write)(struct reboot_mode_driver *reboot, u64 magic);
struct notifier_block reboot_notifier;
};
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v18 04/10] firmware: psci: Introduce command-based reset in psci_sys_reset
2025-12-23 17:07 [PATCH v18 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (2 preceding siblings ...)
2025-12-23 17:07 ` [PATCH v18 03/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
@ 2025-12-23 17:07 ` Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
` (5 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Shivendra Pratap @ 2025-12-23 17:07 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, Shivendra Pratap,
Srinivas Kandagatla
PSCI currently supports only COLD reset and ARCH WARM reset based on the
Linux reboot_mode variable. The PSCI specification now includes
SYSTEM_RESET2 for vendor-specific resets, but there's no mechanism to
issue these through psci_sys_reset.
Add a command-based reset mechanism that allows external drivers to set
the psci reset command via a new psci_set_reset_cmd() function.
The psci command-based reset is disabled by default and the
psci_sys_reset follows its original flow until a psci_reset command is
set or a kernel panic is in progress.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/firmware/psci/psci.c | 46 ++++++++++++++++++++++++++++++++++++++++++--
include/linux/psci.h | 2 ++
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index 38ca190d4a22d6e7e0f06420e8478a2b0ec2fe6f..ad7a3267276f9e26740aea99c11f171ac715f9ba 100644
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -51,6 +51,15 @@ static int resident_cpu = -1;
struct psci_operations psci_ops;
static enum arm_smccc_conduit psci_conduit = SMCCC_CONDUIT_NONE;
+struct psci_sys_reset_params {
+ u32 system_reset;
+ u32 reset_type;
+ u32 cookie;
+ bool cmd;
+};
+
+static struct psci_sys_reset_params psci_reset;
+
bool psci_tos_resident_on(int cpu)
{
return cpu == resident_cpu;
@@ -80,6 +89,29 @@ static u32 psci_cpu_suspend_feature;
static bool psci_system_reset2_supported;
static bool psci_system_off2_hibernate_supported;
+/**
+ * psci_set_reset_cmd - Sets the psci_reset_cmd for command-based
+ * reset which will be used in psci_sys_reset call.
+ *
+ * @cmd_sys_rst2: Set to true for SYSTEM_RESET2 based resets.
+ * @cmd_reset_type: Set the reset_type argument for psci_sys_reset.
+ * @cmd_cookie: Set the cookie argument for psci_sys_reset.
+ */
+void psci_set_reset_cmd(bool cmd_sys_rst2, u32 cmd_reset_type, u32 cmd_cookie)
+{
+ if (cmd_sys_rst2 && psci_system_reset2_supported) {
+ psci_reset.system_reset = PSCI_FN_NATIVE(1_1, SYSTEM_RESET2);
+ psci_reset.reset_type = cmd_reset_type;
+ psci_reset.cookie = cmd_cookie;
+ } else {
+ psci_reset.system_reset = PSCI_0_2_FN_SYSTEM_RESET;
+ psci_reset.reset_type = 0;
+ psci_reset.cookie = 0;
+ }
+ psci_reset.cmd = true;
+}
+EXPORT_SYMBOL_GPL(psci_set_reset_cmd);
+
static inline bool psci_has_ext_power_state(void)
{
return psci_cpu_suspend_feature &
@@ -309,14 +341,24 @@ static int get_set_conduit_method(const struct device_node *np)
static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
void *data)
{
- if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) &&
- psci_system_reset2_supported) {
+ if (((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) &&
+ psci_system_reset2_supported) && (panic_in_progress() || !psci_reset.cmd)) {
/*
* reset_type[31] = 0 (architectural)
* reset_type[30:0] = 0 (SYSTEM_WARM_RESET)
* cookie = 0 (ignored by the implementation)
*/
invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0);
+ } else if (!panic_in_progress() && psci_reset.cmd) {
+ /*
+ * Commands are being set in psci_set_reset_cmd
+ * This issues, SYSTEM_RESET2 arch warm reset or
+ * SYSTEM_RESET2 vendor-specific reset or
+ * a SYSTEM_RESET cold reset in accordance with
+ * the reboot-mode command.
+ */
+ invoke_psci_fn(psci_reset.system_reset, psci_reset.reset_type,
+ psci_reset.cookie, 0);
} else {
invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
}
diff --git a/include/linux/psci.h b/include/linux/psci.h
index 4ca0060a3fc42ba1ca751c7862fb4ad8dda35a4c..d13ceca88eab8932894051e7c86e806c2ad8a73a 100644
--- a/include/linux/psci.h
+++ b/include/linux/psci.h
@@ -45,8 +45,10 @@ struct psci_0_1_function_ids get_psci_0_1_function_ids(void);
#if defined(CONFIG_ARM_PSCI_FW)
int __init psci_dt_init(void);
+void psci_set_reset_cmd(bool cmd_sys_rst2, u32 cmd_reset_type, u32 cmd_cookie);
#else
static inline int psci_dt_init(void) { return 0; }
+static inline void psci_set_reset_cmd(bool cmd_sys_rst2, u32 cmd_reset_type, u32 cmd_cookie) { }
#endif
#if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v18 05/10] dt-bindings: arm: Document reboot mode magic
2025-12-23 17:07 [PATCH v18 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (3 preceding siblings ...)
2025-12-23 17:07 ` [PATCH v18 04/10] firmware: psci: Introduce command-based reset in psci_sys_reset Shivendra Pratap
@ 2025-12-23 17:07 ` Shivendra Pratap
2025-12-26 11:07 ` Krzysztof Kozlowski
2025-12-23 17:07 ` [PATCH v18 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
` (4 subsequent siblings)
9 siblings, 1 reply; 14+ messages in thread
From: Shivendra Pratap @ 2025-12-23 17:07 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, Shivendra Pratap,
Srinivas Kandagatla
Add bindings to describe vendor-specific reboot modes. Values here
correspond to valid parameters to vendor-specific reset types in PSCI
SYSTEM_RESET2 call.
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
Documentation/devicetree/bindings/arm/psci.yaml | 42 +++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/Documentation/devicetree/bindings/arm/psci.yaml b/Documentation/devicetree/bindings/arm/psci.yaml
index 6e2e0c551841111fbb0aa8c0951dca411b94035c..5fdcbf331ea5620363638feb6f8105427a87c00f 100644
--- a/Documentation/devicetree/bindings/arm/psci.yaml
+++ b/Documentation/devicetree/bindings/arm/psci.yaml
@@ -98,6 +98,26 @@ properties:
[1] Kernel documentation - ARM idle states bindings
Documentation/devicetree/bindings/cpu/idle-states.yaml
+ reboot-mode:
+ type: object
+ $ref: /schemas/power/reset/reboot-mode.yaml#
+ unevaluatedProperties: false
+ properties:
+ # "mode-normal" is just SYSTEM_RESET
+ mode-normal: false
+ patternProperties:
+ "^mode-.*$":
+ minItems: 1
+ maxItems: 2
+ description: |
+ Describes a vendor-specific reset type. The string after "mode-"
+ maps a reboot mode to the parameters in the PSCI SYSTEM_RESET2 call.
+
+ Parameters are named mode-xxx = <type[, cookie]>, where xxx is the
+ name of the magic reboot mode, type corresponds to the reset_type
+ and the values should be provided as per the PSCI SYSTEM_RESET2
+ specs. The cookie value is optional and defaulted to zero.
+
patternProperties:
"^power-domain-":
$ref: /schemas/power/power-domain.yaml#
@@ -137,6 +157,15 @@ allOf:
required:
- cpu_off
- cpu_on
+ - if:
+ not:
+ properties:
+ compatible:
+ contains:
+ const: arm,psci-1.0
+ then:
+ properties:
+ reboot-mode: false
additionalProperties: false
@@ -260,4 +289,17 @@ examples:
domain-idle-states = <&cluster_ret>, <&cluster_pwrdn>;
};
};
+
+ - |+
+
+ // Case 5: SYSTEM_RESET2 vendor resets
+ psci {
+ compatible = "arm,psci-1.0";
+ method = "smc";
+
+ reboot-mode {
+ mode-edl = <0x80000000 1>;
+ mode-bootloader = <0x80010001 2>;
+ };
+ };
...
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v18 06/10] power: reset: Add psci-reboot-mode driver
2025-12-23 17:07 [PATCH v18 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (4 preceding siblings ...)
2025-12-23 17:07 ` [PATCH v18 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
@ 2025-12-23 17:07 ` Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 07/10] arm64: dts: qcom: qcm6490: Add psci reboot-modes Shivendra Pratap
` (3 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Shivendra Pratap @ 2025-12-23 17:07 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, Shivendra Pratap,
Srinivas Kandagatla
PSCI supports different types of resets like COLD reset, ARCH WARM
reset, vendor-specific resets. Currently there is no common driver that
handles all supported psci resets at one place. Additionally, there is
no common mechanism to issue the supported psci resets from userspace.
Add a PSCI reboot mode driver and define two types of PSCI resets in the
driver as reboot-modes: predefined resets controlled by Linux
reboot_mode and customizable resets defined by SoC vendors in their
device tree under the psci:reboot-mode node.
Register the driver with the reboot-mode framework to interface these
resets to userspace. When userspace initiates a supported command, pass
the reset arguments to the PSCI driver to enable command-based reset.
This change allows userspace to issue supported PSCI reset commands
using the standard reboot system calls while enabling SoC vendors to
define their specific resets for PSCI.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/Kconfig | 10 +++
drivers/power/reset/Makefile | 1 +
drivers/power/reset/psci-reboot-mode.c | 111 +++++++++++++++++++++++++++++++++
3 files changed, 122 insertions(+)
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index f6c1bcbb57deff3568d6b1b326454add3b3bbf06..529d6c7d3555601f7b7e6199acd29838030fcef2 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -348,6 +348,16 @@ config NVMEM_REBOOT_MODE
then the bootloader can read it and take different
action according to the mode.
+config PSCI_REBOOT_MODE
+ bool "PSCI reboot mode driver"
+ depends on OF && ARM_PSCI_FW
+ select REBOOT_MODE
+ help
+ Say y here will enable PSCI reboot mode driver. This gets
+ the PSCI reboot mode arguments and passes them to psci
+ driver. psci driver uses these arguments for issuing
+ device reset into different boot states.
+
config POWER_MLXBF
tristate "Mellanox BlueField power handling driver"
depends on (GPIO_MLXBF2 || GPIO_MLXBF3) && ACPI
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 0e4ae6f6b5c55729cf60846d47e6fe0fec24f3cc..49774b42cdf61fd57a5b70f286c65c9d66bbc0cb 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -40,4 +40,5 @@ obj-$(CONFIG_REBOOT_MODE) += reboot-mode.o
obj-$(CONFIG_SYSCON_REBOOT_MODE) += syscon-reboot-mode.o
obj-$(CONFIG_POWER_RESET_SC27XX) += sc27xx-poweroff.o
obj-$(CONFIG_NVMEM_REBOOT_MODE) += nvmem-reboot-mode.o
+obj-$(CONFIG_PSCI_REBOOT_MODE) += psci-reboot-mode.o
obj-$(CONFIG_POWER_MLXBF) += pwr-mlxbf.o
diff --git a/drivers/power/reset/psci-reboot-mode.c b/drivers/power/reset/psci-reboot-mode.c
new file mode 100644
index 0000000000000000000000000000000000000000..499cf504071e88022fa5b5b32e26b7a674da8691
--- /dev/null
+++ b/drivers/power/reset/psci-reboot-mode.c
@@ -0,0 +1,111 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include <linux/device/faux.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/of.h>
+#include <linux/psci.h>
+#include <linux/reboot.h>
+#include <linux/reboot-mode.h>
+#include <linux/types.h>
+
+/*
+ * Predefined reboot-modes:
+ * reset_type(arg1) is zero; cookie(arg2) is stored in magic.
+ * psci_reboot_mode_set_predefined_modes to move values to higher 32 bit of magic.
+ */
+static struct mode_info psci_resets[] = {
+ { .mode = "warm", .magic = REBOOT_WARM},
+ { .mode = "soft", .magic = REBOOT_SOFT},
+ { .mode = "cold", .magic = REBOOT_COLD},
+};
+
+static void psci_reboot_mode_set_predefined_modes(struct reboot_mode_driver *reboot)
+{
+ INIT_LIST_HEAD(&reboot->predefined_modes);
+ for (u32 i = 0; i < ARRAY_SIZE(psci_resets); i++) {
+ /* Move values to higher 32 bit of magic */
+ psci_resets[i].magic = FIELD_PREP(GENMASK_ULL(63, 32), psci_resets[i].magic);
+ INIT_LIST_HEAD(&psci_resets[i].list);
+ list_add_tail(&psci_resets[i].list, &reboot->predefined_modes);
+ }
+}
+
+/*
+ * magic is 64 bit.
+ * arg1 - reset_type(Low 32 bit of magic).
+ * arg2 - cookie(High 32 bit of magic).
+ * arg2(cookie) decides the mode, If arg1(reset_type) is 0;
+ */
+static int psci_reboot_mode_write(struct reboot_mode_driver *reboot, u64 magic)
+{
+ u32 reset_type = FIELD_GET(GENMASK_ULL(31, 0), magic);
+ u32 cookie = FIELD_GET(GENMASK_ULL(63, 32), magic);
+
+ if (reset_type == 0) {
+ if (cookie == REBOOT_WARM || cookie == REBOOT_SOFT)
+ psci_set_reset_cmd(true, 0, 0);
+ else
+ psci_set_reset_cmd(false, 0, 0);
+ } else {
+ psci_set_reset_cmd(true, reset_type, cookie);
+ }
+
+ return NOTIFY_DONE;
+}
+
+static int psci_reboot_mode_probe(struct faux_device *fdev)
+{
+ struct reboot_mode_driver *reboot;
+ struct device_node *psci_np;
+ struct device_node *np;
+ int ret;
+
+ psci_np = of_find_compatible_node(NULL, NULL, "arm,psci-1.0");
+ if (!psci_np)
+ return -ENODEV;
+
+ /*
+ * Find the psci:reboot-mode node.
+ * If NULL, continue to register predefined modes.
+ * np refcount to be handled by dev;
+ * psci_np refcount is decremented by of_find_node_by_name;
+ */
+ np = of_find_node_by_name(psci_np, "reboot-mode");
+ fdev->dev.of_node = np;
+
+ reboot = devm_kzalloc(&fdev->dev, sizeof(*reboot), GFP_KERNEL);
+ if (!reboot)
+ return -ENOMEM;
+
+ psci_reboot_mode_set_predefined_modes(reboot);
+ reboot->write = psci_reboot_mode_write;
+ reboot->dev = &fdev->dev;
+
+ ret = devm_reboot_mode_register(&fdev->dev, reboot);
+ if (ret) {
+ dev_err(&fdev->dev, "devm_reboot_mode_register failed %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+
+static struct faux_device_ops psci_reboot_mode_ops = {
+ .probe = psci_reboot_mode_probe,
+};
+
+static int __init psci_reboot_mode_init(void)
+{
+ struct faux_device *fdev;
+
+ fdev = faux_device_create("psci-reboot-mode", NULL, &psci_reboot_mode_ops);
+ if (!fdev)
+ return -ENODEV;
+
+ return 0;
+}
+device_initcall(psci_reboot_mode_init);
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v18 07/10] arm64: dts: qcom: qcm6490: Add psci reboot-modes
2025-12-23 17:07 [PATCH v18 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (5 preceding siblings ...)
2025-12-23 17:07 ` [PATCH v18 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
@ 2025-12-23 17:07 ` Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 08/10] arm64: dts: qcom: lemans: " Shivendra Pratap
` (2 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Shivendra Pratap @ 2025-12-23 17:07 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, Shivendra Pratap,
Srinivas Kandagatla
Add PSCI SYSTEM_RESET2 reboot-modes for qcm6490-idp and qcs6490-rb3gen2
for use by the psci_reboot_mode driver.
The following modes are defined:
- bootloader: reboot into fastboot mode for fastboot flashing.
- edl: reboot into emergency download mode for image loading via
the Firehose protocol.
Support for these modes is firmware dependent and not available across
all sc7280 based boards.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/kodiak.dtsi | 2 +-
arch/arm64/boot/dts/qcom/qcm6490-idp.dts | 7 +++++++
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 7 +++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/kodiak.dtsi b/arch/arm64/boot/dts/qcom/kodiak.dtsi
index c2ccbb67f800cb9927627f991e3d97174cc73c64..e319a1894901cc9c56a89cb8b8ad0acb7a18dc99 100644
--- a/arch/arm64/boot/dts/qcom/kodiak.dtsi
+++ b/arch/arm64/boot/dts/qcom/kodiak.dtsi
@@ -858,7 +858,7 @@ pmu-a78 {
interrupts = <GIC_PPI 7 IRQ_TYPE_LEVEL_LOW>;
};
- psci {
+ psci: psci {
compatible = "arm,psci-1.0";
method = "smc";
diff --git a/arch/arm64/boot/dts/qcom/qcm6490-idp.dts b/arch/arm64/boot/dts/qcom/qcm6490-idp.dts
index 089a027c57d5caed103f41f20c01fe1294b4c950..5816cc1c033c396f49fddbbcd4b09e5a633bc804 100644
--- a/arch/arm64/boot/dts/qcom/qcm6490-idp.dts
+++ b/arch/arm64/boot/dts/qcom/qcm6490-idp.dts
@@ -695,6 +695,13 @@ &pon_resin {
status = "okay";
};
+&psci {
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
+};
+
&qupv3_id_0 {
status = "okay";
};
diff --git a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
index f29a352b0288e9ef554ecfff59820ba39bf2cdb1..6e836e476d595b7e1b69a0859cf2f697c529cbfa 100644
--- a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
+++ b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
@@ -935,6 +935,13 @@ &pon_resin {
status = "okay";
};
+&psci {
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
+};
+
&qup_uart7_cts {
/*
* Configure a bias-bus-hold on CTS to lower power
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v18 08/10] arm64: dts: qcom: lemans: Add psci reboot-modes
2025-12-23 17:07 [PATCH v18 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (6 preceding siblings ...)
2025-12-23 17:07 ` [PATCH v18 07/10] arm64: dts: qcom: qcm6490: Add psci reboot-modes Shivendra Pratap
@ 2025-12-23 17:07 ` Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 09/10] arm64: dts: qcom: monaco: " Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 10/10] arm64: dts: qcom: talos: " Shivendra Pratap
9 siblings, 0 replies; 14+ messages in thread
From: Shivendra Pratap @ 2025-12-23 17:07 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, Shivendra Pratap,
Srinivas Kandagatla
Add PSCI SYSTEM_RESET2 reboot-modes for lemans based boards, for use by
the psci_reboot_mode driver.
The following modes are defined:
- bootloader: reboot into fastboot mode for fastboot flashing.
- edl: reboot into emergency download mode for image loading via
the Firehose protocol.
Support for these modes is firmware dependent.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/lemans.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/lemans.dtsi b/arch/arm64/boot/dts/qcom/lemans.dtsi
index 0b154d57ba24e69a9d900f06bbb22baa2781cc3f..cc70316d6949c8a36280b85931c4adec9cd60f62 100644
--- a/arch/arm64/boot/dts/qcom/lemans.dtsi
+++ b/arch/arm64/boot/dts/qcom/lemans.dtsi
@@ -698,6 +698,11 @@ system_pd: power-domain-system {
#power-domain-cells = <0>;
domain-idle-states = <&cluster_sleep_apss_rsc_pc>;
};
+
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
};
reserved-memory {
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v18 09/10] arm64: dts: qcom: monaco: Add psci reboot-modes
2025-12-23 17:07 [PATCH v18 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (7 preceding siblings ...)
2025-12-23 17:07 ` [PATCH v18 08/10] arm64: dts: qcom: lemans: " Shivendra Pratap
@ 2025-12-23 17:07 ` Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 10/10] arm64: dts: qcom: talos: " Shivendra Pratap
9 siblings, 0 replies; 14+ messages in thread
From: Shivendra Pratap @ 2025-12-23 17:07 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, Shivendra Pratap,
Srinivas Kandagatla
Add PSCI SYSTEM_RESET2 reboot-modes for monaco based boards, for use by
the psci_reboot_mode driver.
The following modes are defined:
- bootloader: reboot into fastboot mode for fastboot flashing.
- edl: reboot into emergency download mode for image loading via
the Firehose protocol.
Support for these modes is firmware dependent.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/monaco.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/monaco.dtsi b/arch/arm64/boot/dts/qcom/monaco.dtsi
index 816fa2af8a9a663b8ad176f93d2f18284a08c3d1..9c8087f870fc8889edffda63c62f4d5167729cbc 100644
--- a/arch/arm64/boot/dts/qcom/monaco.dtsi
+++ b/arch/arm64/boot/dts/qcom/monaco.dtsi
@@ -732,6 +732,11 @@ system_pd: power-domain-system {
#power-domain-cells = <0>;
domain-idle-states = <&system_sleep>;
};
+
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
};
reserved-memory {
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v18 10/10] arm64: dts: qcom: talos: Add psci reboot-modes
2025-12-23 17:07 [PATCH v18 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (8 preceding siblings ...)
2025-12-23 17:07 ` [PATCH v18 09/10] arm64: dts: qcom: monaco: " Shivendra Pratap
@ 2025-12-23 17:07 ` Shivendra Pratap
9 siblings, 0 replies; 14+ messages in thread
From: Shivendra Pratap @ 2025-12-23 17:07 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Sudeep Holla, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Bartosz Golaszewski
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Kathiravan Thirumoorthy, linux-pm,
linux-kernel, linux-arm-kernel, linux-arm-msm, Shivendra Pratap,
Srinivas Kandagatla, Song Xue
Add PSCI SYSTEM_RESET2 reboot-modes for talos based boards, for use by
the psci_reboot_mode driver.
The following modes are defined:
- bootloader: reboot into fastboot mode for fastboot flashing.
- edl: reboot into emergency download mode for image loading via
the Firehose protocol.
Support for these modes is firmware dependent.
Signed-off-by: Song Xue <quic_songxue@quicinc.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/talos.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/talos.dtsi b/arch/arm64/boot/dts/qcom/talos.dtsi
index 95d26e3136229f9015d49e2be22f6b28f1e842f4..11a2cfa209065776a8ae61c6e661c09bb871c400 100644
--- a/arch/arm64/boot/dts/qcom/talos.dtsi
+++ b/arch/arm64/boot/dts/qcom/talos.dtsi
@@ -613,6 +613,11 @@ cluster_pd: power-domain-cluster {
&cluster_sleep_1
&cluster_sleep_2>;
};
+
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
};
reserved-memory {
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v18 01/10] power: reset: reboot-mode: Remove devres based allocations
2025-12-23 17:07 ` [PATCH v18 01/10] power: reset: reboot-mode: Remove devres based allocations Shivendra Pratap
@ 2025-12-25 10:16 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2025-12-25 10:16 UTC (permalink / raw)
To: Shivendra Pratap, Lorenzo Pieralisi, Arnd Bergmann,
Bjorn Andersson, Sebastian Reichel, Rob Herring, Sudeep Holla,
Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan,
Bartosz Golaszewski
Cc: oe-kbuild-all, Florian Fainelli, Dmitry Baryshkov, Mukesh Ojha,
Andre Draszik, Kathiravan Thirumoorthy, linux-pm, linux-kernel,
linux-arm-kernel, linux-arm-msm, Shivendra Pratap,
Srinivas Kandagatla
Hi Shivendra,
kernel test robot noticed the following build errors:
[auto build test ERROR on cc3aa43b44bdb43dfbac0fcb51c56594a11338a8]
url: https://github.com/intel-lab-lkp/linux/commits/Shivendra-Pratap/power-reset-reboot-mode-Remove-devres-based-allocations/20251224-011508
base: cc3aa43b44bdb43dfbac0fcb51c56594a11338a8
patch link: https://lore.kernel.org/r/20251223-arm-psci-system_reset2-vendor-reboots-v18-1-32fa9e76efc3%40oss.qualcomm.com
patch subject: [PATCH v18 01/10] power: reset: reboot-mode: Remove devres based allocations
config: powerpc64-randconfig-r072-20251225 (https://download.01.org/0day-ci/archive/20251225/202512251820.e0ZKwuCc-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 4ef602d446057dabf5f61fb221669ecbeda49279)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251225/202512251820.e0ZKwuCc-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/202512251820.e0ZKwuCc-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/power/reset/reboot-mode.c:94:10: error: call to undeclared function 'kzalloc'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
94 | info = kzalloc(sizeof(*info), GFP_KERNEL);
| ^
>> drivers/power/reset/reboot-mode.c:94:8: error: incompatible integer to pointer conversion assigning to 'struct mode_info *' from 'int' [-Wint-conversion]
94 | info = kzalloc(sizeof(*info), GFP_KERNEL);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/power/reset/reboot-mode.c:120:2: error: call to undeclared function 'kfree'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
120 | kfree(info);
| ^
drivers/power/reset/reboot-mode.c:145:3: error: call to undeclared function 'kfree'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
145 | kfree(info);
| ^
4 errors generated.
vim +/kzalloc +94 drivers/power/reset/reboot-mode.c
66
67 /**
68 * reboot_mode_register - register a reboot mode driver
69 * @reboot: reboot mode driver
70 *
71 * Returns: 0 on success or a negative error code on failure.
72 */
73 int reboot_mode_register(struct reboot_mode_driver *reboot)
74 {
75 struct mode_info *info;
76 struct mode_info *next;
77 struct property *prop;
78 struct device_node *np = reboot->dev->of_node;
79 size_t len = strlen(PREFIX);
80 u32 magic;
81 int ret;
82
83 INIT_LIST_HEAD(&reboot->head);
84
85 for_each_property_of_node(np, prop) {
86 if (strncmp(prop->name, PREFIX, len))
87 continue;
88
89 if (of_property_read_u32(np, prop->name, &magic)) {
90 pr_err("reboot mode %s without magic number\n", prop->name);
91 continue;
92 }
93
> 94 info = kzalloc(sizeof(*info), GFP_KERNEL);
95 if (!info) {
96 ret = -ENOMEM;
97 goto error;
98 }
99
100 info->mode = kstrdup_const(prop->name + len, GFP_KERNEL);
101 if (!info->mode) {
102 ret = -ENOMEM;
103 goto error;
104 } else if (info->mode[0] == '\0') {
105 kfree_const(info->mode);
106 ret = -EINVAL;
107 pr_err("invalid mode name(%s): too short!\n", prop->name);
108 goto error;
109 }
110
111 list_add_tail(&info->list, &reboot->head);
112 }
113
114 reboot->reboot_notifier.notifier_call = reboot_mode_notify;
115 register_reboot_notifier(&reboot->reboot_notifier);
116
117 return 0;
118
119 error:
> 120 kfree(info);
121 list_for_each_entry_safe(info, next, &reboot->head, list) {
122 list_del(&info->list);
123 kfree_const(info->mode);
124 kfree(info);
125 }
126
127 return ret;
128 }
129 EXPORT_SYMBOL_GPL(reboot_mode_register);
130
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v18 05/10] dt-bindings: arm: Document reboot mode magic
2025-12-23 17:07 ` [PATCH v18 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
@ 2025-12-26 11:07 ` Krzysztof Kozlowski
2025-12-26 17:42 ` Shivendra Pratap
0 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-26 11:07 UTC (permalink / raw)
To: Shivendra Pratap, Lorenzo Pieralisi, Arnd Bergmann,
Bjorn Andersson, Sebastian Reichel, Rob Herring, Sudeep Holla,
Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan,
Bartosz Golaszewski
Cc: Florian Fainelli, Dmitry Baryshkov, Mukesh Ojha, Andre Draszik,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, Srinivas Kandagatla
On 23/12/2025 18:07, Shivendra Pratap wrote:
> Add bindings to describe vendor-specific reboot modes. Values here
> correspond to valid parameters to vendor-specific reset types in PSCI
> SYSTEM_RESET2 call.
>
> Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
> ---
> Documentation/devicetree/bindings/arm/psci.yaml | 42 +++++++++++++++++++++++++
> 1 file changed, 42 insertions(+)
>
Please use scripts/get_maintainers.pl to get a list of necessary people
and lists to CC. It might happen, that command when run on an older
kernel, gives you outdated entries. Therefore please be sure you base
your patches on recent Linux kernel.
Tools like b4 or scripts/get_maintainer.pl provide you proper list of
people, so fix your workflow. Tools might also fail if you work on some
ancient tree (don't, instead use mainline) or work on fork of kernel
(don't, instead use mainline). Just use b4 and everything should be
fine, although remember about `b4 prep --auto-to-cc` if you added new
patches to the patchset.
You missed at least devicetree list (maybe more), so this won't be
tested by automated tooling. Performing review on untested code might be
a waste of time.
Please kindly resend and include all necessary To/Cc entries.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v18 05/10] dt-bindings: arm: Document reboot mode magic
2025-12-26 11:07 ` Krzysztof Kozlowski
@ 2025-12-26 17:42 ` Shivendra Pratap
0 siblings, 0 replies; 14+ messages in thread
From: Shivendra Pratap @ 2025-12-26 17:42 UTC (permalink / raw)
To: Krzysztof Kozlowski, Lorenzo Pieralisi, Arnd Bergmann,
Bjorn Andersson, Sebastian Reichel, Rob Herring, Sudeep Holla,
Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan,
Bartosz Golaszewski
Cc: Florian Fainelli, Dmitry Baryshkov, Mukesh Ojha, Andre Draszik,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, Srinivas Kandagatla
On 12/26/2025 4:37 PM, Krzysztof Kozlowski wrote:
> On 23/12/2025 18:07, Shivendra Pratap wrote:
>> Add bindings to describe vendor-specific reboot modes. Values here
>> correspond to valid parameters to vendor-specific reset types in PSCI
>> SYSTEM_RESET2 call.
>>
>> Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
>> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
>> ---
>> Documentation/devicetree/bindings/arm/psci.yaml | 42 +++++++++++++++++++++++++
>> 1 file changed, 42 insertions(+)
>>
>
>
> Please use scripts/get_maintainers.pl to get a list of necessary people
> and lists to CC. It might happen, that command when run on an older
> kernel, gives you outdated entries. Therefore please be sure you base
> your patches on recent Linux kernel.
>
> Tools like b4 or scripts/get_maintainer.pl provide you proper list of
> people, so fix your workflow. Tools might also fail if you work on some
> ancient tree (don't, instead use mainline) or work on fork of kernel
> (don't, instead use mainline). Just use b4 and everything should be
> fine, although remember about `b4 prep --auto-to-cc` if you added new
> patches to the patchset.
>
> You missed at least devicetree list (maybe more), so this won't be
> tested by automated tooling. Performing review on untested code might be
> a waste of time.
>
> Please kindly resend and include all necessary To/Cc entries.
sure. thanks. Will make sure on this.
thanks,
Shivendra
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-12-26 17:43 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-23 17:07 [PATCH v18 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 01/10] power: reset: reboot-mode: Remove devres based allocations Shivendra Pratap
2025-12-25 10:16 ` kernel test robot
2025-12-23 17:07 ` [PATCH v18 02/10] power: reset: reboot-mode: Add support for 64 bit magic Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 03/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 04/10] firmware: psci: Introduce command-based reset in psci_sys_reset Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
2025-12-26 11:07 ` Krzysztof Kozlowski
2025-12-26 17:42 ` Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 07/10] arm64: dts: qcom: qcm6490: Add psci reboot-modes Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 08/10] arm64: dts: qcom: lemans: " Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 09/10] arm64: dts: qcom: monaco: " Shivendra Pratap
2025-12-23 17:07 ` [PATCH v18 10/10] arm64: dts: qcom: talos: " 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).