* [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets
@ 2026-09-14 14:59 Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 01/10] power: reset: reboot-mode: Support up to 3 magic values per mode Shivendra Pratap
` (9 more replies)
0 siblings, 10 replies; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-14 14:59 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Matthias Brugger, Mark Rutland,
Conor Dooley, Konrad Dybcio, John Stultz, Moritz Fischer,
Rafael J. Wysocki, Daniel Lezcano, Christian Loehle, Lee Jones,
Ulf Hansson, Pavan Kondeti, Abel Vesa, Bartosz Golaszewski,
Sudeep Holla, Ulf Hansson
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, Shivendra Pratap,
Srinivas Kandagatla, Ulf Hansson, Bartosz Golaszewski, 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 will induce
command-based resets to psci driver for executing the device reset.
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. Support upto three 32 bit magic values as arguments. This enables to
support for a 32 bit reset_type and a 64 bit cookie).
2. Predefined modes: Add support for predefined reboot modes in the
framework.
With these enhancements, the patch series enables:
- Arch Warm reset and system reset cold as predefined reboot modes.
- Vendor-specific resets, configurable via the SoC-specific device tree.
Together, these changes allow userspace to trigger all above PSCI resets
from userspace.
Note on introducing psci aux devices:
Based on feedback from Bart, Lee and Ufee, PSCI child functionality now
uses aux devices instead of an MFD driver, with psci-cpuidle-domain and
psci-reboot-mode probed through a common PSCI aux device enumerator.
Reference discussions on this:
https://lore.kernel.org/all/CAPx+jO9Hi2R_UnCEhsXLwf74c3RTb+RodaJ6SOVXbQX_eHt++A@mail.gmail.com/
---
The patch is tested on rb3Gen2, lemans-ride, lemans-evk, monaco-ride,
qcs615-ride.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Changes in v25:
By Bart/Lee/Ufee:
Dropped:
- mfd: core: Add firmware-node support to MFD cells
- mfd: psci-mfd: Add PSCI MFD driver for cpuidle-psci-domain cell
- mfd: psci-mfd: Add psci-reboot-mode child cell
firmware: psci: Add support for PSCI auxiliary devices
- Added a PSCI platform driver to enumerate auxiliary devices.
- Converted psci-cpuidle-domain enumeration to the auxiliary device
model.
- Added optional psci-reboot-mode auxiliary device creation.
- Added MAINTAINERS entry and updated Kconfig help text.
power: reset: Add psci-reboot-mode driver
- Moved PSCI reboot-mode support to an auxiliary-bus based driver.
By Rob:
dt-bindings: arm: Document reboot mode magic
- Addressed format chnages.
- Fixed dtbinding check error on maxitem.
By sashiko/ Alignment:
power: reset: Add psci-reboot-mode driver
- Added a 32-bit system check for 3-cell cookies.
- Added stricter magic value count checks as per the PSCI reboot-mode
ABI.
- Added in-code documentation for predefined PSCI reset modes and
cookie layout.
- Avoid registering the DT reboot-mode node when SYSTEM_RESET2 is
unsupported.
firmware: psci: Introduce command-based resets
- Added 32-bit validation for PSCI reset command cookies.
- Updated psci_set_reset_cmd() documentation for PSCI SYSTEM_RESET2
reset_type.
- Link to v24: https://patch.msgid.link/20260803-arm-psci-system_reset2-vendor-reboots-v24-0-889281373870@oss.qualcomm.com
Changes in v24:
mfd: psci-mfd: Add psci-reboot-mode child cell
- Remove the explicit check for availability of the reboot-mode node. (by Bart)
- Fail psci-mfd probe only on fatal errors(-ENOMEM) while adding the
psci-reboot-mode cell.
mfd: core: Add firmware-node support for MFD cells
- Allow MFD child registration even when a named child cell not present,
to align with of_compatible-based registration. (by sashiko)
- Move named_fwnode logic to a separate function.
power: reset: Add psci-reboot-mode driver
- Remove dependency on OF. (by Pavan)
- Update for new changes in predefined modes.
dt-bindings: arm: Document reboot-mode magic
- Fix the example DT entry. (by Rob)
- Use unevaluatedProperties as false for the reboot-mode child schema.
firmware: psci: Introduce command-based resets
- Update in-code documentation. (by Pavan)
- Update namespace-based exports. (by Pavan)
- Use synchronized write/read (smp_store_release / smp_load_acquire)for
the reset command to support lockless atomic reads. (by sashiko)
power: reset: reboot-mode: Add support for predefined reboot modes
- Remove the predefined list in reboot-mode and add a pointer to
reboot_mode_entry. (by Pavan)
- The registering driver fills and manages reboot_mode_entry. (by Pavan)
- reboot-mode list to append reboot_mode_entry.
power: reset: reboot-mode: Support up to 3 magic values per mode
- Add separate write function pointers for single-magic writes (existing
drivers) and multi-value writes. (by Pavan/Bart)
- Update count to u32. (by Pavan)
power: reset: reboot-mode: Remove devres-based allocations
- Drop from this series, Sent as separate split-fixes patch.
- Link to v23: https://patch.msgid.link/20260714-arm-psci-system_reset2-vendor-reboots-v23-0-e7453c548c21@oss.qualcomm.com
Changes in v23:
mfd: core: Add firmware-node support to MFD cells
- Add named_fwnode-based firmware node support in MFD cells.(by Bart)
- Update the release path. (by Bart)
- Add checks for duplicate fwnodes.
- Update documentation for usage and limitations.
mfd: psci-mfd: Add psci-reboot-mode child cell
- Update for a named_fwnode-based reboot-mode child cell. (By Bart)
- Split psci-reboot-mode and psci-cpuidle-domain into separate child
cells.
power: reset: Add psci-reboot-mode driver
- Add COMPILE_TEST in Kconfig. (by Bart)
- Update to support up to three u32 arguments to accommodate a
32-bit reset_type and a 64-bit cookie. (By Sashiko, Lorenzo)
dt-bindings: arm: Document reboot mode magic
- Update to support up to three u32 arguments to accommodate a
32-bit reset_type and a 64-bit cookie.
- Dropped reviewed by from Bart and Rob due to considerable changes.
firmware: psci: Introduce command-based resets
- Update to support a 64-bit cookie. (By Sashiko, Lorenzo)
- Update the flow so unsupported reset commands and any failures during
reset command execution fall back to the
Linux reboot_mode path. (By Sashiko)
power: reset: reboot-mode: Add support for predefined reboot modes
- Handle errors and free lists in devm_reboot_mode_register(). (by Sashiko)
- Update to support up to three u32 arguments.
power: reset: reboot-mode: Support up to 3 magic values per mode
- Patch for 64 bit magic renamed.
- Update to support up to three u32 arguments to accommodate a 32-bit
reset_type and a 64-bit cookie.
- Dropped reviewed by from Bart and Sebastian due to considerable changes.
- Link to v22: https://lore.kernel.org/r/20260514-arm-psci-system_reset2-vendor-reboots-v22-0-28a5bde07483@oss.qualcomm.com
Changes in v22:
By Bart:
power: reset: reboot-mode: Add support for predefined reboot modes
- Add reboot-mode helper to add predefined modes.
- Add centralized init for reboot-mode.
- Dropping Reviewed-by from Bartosz as changes may need a review.
power: reset: Add psci-reboot-mode driver
- Use reboot-mode helpers to initialize reboot-mode driver and add
predefined modes.
mfd: core: Add firmware-node support to MFD cells
- Use callback function to get fwnode from a MFD child cell.
mfd: psci-mfd: Add psci-reboot-mode child cell
- Use callback function to return fwnode for reboot-mode.
By Pankaj:
mfd: psci-mfd: Add PSCI MFD driver for cpuidle-psci-domain cell
- Make MFD_PSCI defaults to y as ARM_PSCI_CPUIDLE_DOMAIN defaults to
y and depends on it.
- Link to v21: https://lore.kernel.org/r/20260427-arm-psci-system_reset2-vendor-reboots-v21-0-dcf937775e73@oss.qualcomm.com
Changes in v21:
By Krzysztof
power: reset: reboot-mode: Remove devres based allocations
- remove fixes tag.
By Lorenzo
firmware: psci: Introduce command-based resets
- psci_set_reset_cmd() only takes reset_type/cookie as input params.
- updated this as a encoded u64 reset_command - from Pavan Kondeti.
- Update commit text for reason for explicit panic_handling.
- Clean split of reset flow in psci_sys_reset via handle_reboot_mode and handle_cmd_reset.
- Add psci_has_system_reset2_support() helper and PSCI reset-type defines.
By Lorenzo/Bart
power: reset: Add psci-reboot-mode driver
By Bart
- Drop faux-device based probe.
- Convert driver to platform-driver model (probed via PSCI MFD).
By Lorenzo:
- Use PSCI-specific predefined reset mode naming/magic.
- Register arch-warm predefined mode only when SYSTEM_RESET2 is supported.
- psci_reboot_mode_write to directly pass reset_type and cokie.
- Add MAINTAINERS entry for drivers/power/reset/psci-reboot-mode.c.
By Bart
mfd: psci-mfd: Introduce psci mfd driver for cpuidle-psci-domain cell
- Introduce psci-mfd driver.
mfd: Add psci-reboot-mode cell via fwnode
- Register psci-reboot-mode from psci-mfd with reboot-mode child node
fwnode.
- Update reset Kconfig dependency to tie PSCI reboot-mode to MFD PSCI path.
For alignment:
- mfd: core: Add firmware-node support to MFD cells
- Add firmware-node support to MFD cells.
By Pavan
power: reset: reboot-mode: Add support for predefined reboot modes
- Move redundant logic of adding modes to list to a common function.
By Arnd
- Remove refrences for Linux reboot-modes from code and commit text.
By Konrad
- Updated all dt changes to add reboot-mode for supported board files.
- Link to v20: https://lore.kernel.org/r/20260304-arm-psci-system_reset2-vendor-reboots-v20-0-cf7d346b8372@oss.qualcomm.com
Changes in v20:
By Bart:
power: reset: Add psci-reboot-mode driver
- Check for psci compatible in init arm,psci-1.0
- Node pointer should not be assigned in device probe.
To Align on above:
- Remove probe call for faux device.
- Set node using device_set_node after faux_device_create.
- Register the reboot mode using explicit call to psci_reboot_mode_register_device.
- Updated in-code documentation.
For Alignment to use of device_property_xx:
power: reset: reboot-mode: Add support for 64 bit magic
- Use device_property_count_u32 instead of device_property_read_u32.
- Check count of properties before reading.
- u64 magic changed to u32 magic[2].
- nvmem-reboot rebased on recent changes.
- Update documentation and commit text.
power: reset: reboot-mode: Remove devres based allocations
By Dmitry/Bart:
- pr_err to pr_debug in case of invalid reboot-mode prop.
By Bart:
- Use device_property_read_u32 instead of of_property_read_u32.
- Avoid repeated code for free list. Now calling unregister from
error path of regiister_reboot_mode.
- Fix magic assignment.
- Link to v19: https://lore.kernel.org/r/20251228-arm-psci-system_reset2-vendor-reboots-v19-0-ebb956053098@oss.qualcomm.com
Changes in v19:
- Add missing To/Cc entries (include devicetree list) – Thanks to
Krzysztof for pointing this out.
- Fix compilation error in reboot-mode.c for ARCH=powerpc by explicitly
including <linux/slab.h>.
- Link to v18: https://lore.kernel.org/r/20251223-arm-psci-system_reset2-vendor-reboots-v18-0-32fa9e76efc3@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
Previous versions:
- Link to v16: https://lore.kernel.org/r/20251015-arm-psci-system_reset2-vendor-reboots-v16-0-b98aedaa23ee@oss.qualcomm.com
- Link to v15: https://lore.kernel.org/r/20250922-arm-psci-system_reset2-vendor-reboots-v15-0-7ce3a08878f1@oss.qualcomm.com
- Link to v14: https://lore.kernel.org/r/20250815-arm-psci-system_reset2-vendor-reboots-v14-0-37d29f59ac9a@oss.qualcomm.com
- Link to v13: https://lore.kernel.org/r/20250727-arm-psci-system_reset2-vendor-reboots-v13-0-6b8d23315898@oss.qualcomm.com
- Link to v12: https://lore.kernel.org/r/20250721-arm-psci-system_reset2-vendor-reboots-v12-0-87bac3ec422e@oss.qualcomm.com
- Link to v11: https://lore.kernel.org/r/20250717-arm-psci-system_reset2-vendor-reboots-v11-0-df3e2b2183c3@oss.qualcomm.com
- Link to v10: https://lore.kernel.org/all/569f154d-c714-1714-b898-83a42a38771c@oss.qualcomm.com/
- Link to v9: https://lore.kernel.org/all/20250303-arm-psci-system_reset2-vendor-reboots-v9-0-b2cf4a20feda@oss.qualcomm.com/
- Link to v8: https://lore.kernel.org/r/20241107-arm-psci-system_reset2-vendor-reboots-v8-0-e8715fa65cb5@quicinc.com
- Link to v7: https://lore.kernel.org/r/20241028-arm-psci-system_reset2-vendor-reboots-v7-0-a4c40b0ebc54@quicinc.com
- Link to v6: https://lore.kernel.org/r/20241018-arm-psci-system_reset2-vendor-reboots-v6-0-50cbe88b0a24@quicinc.com
- Link to v5: https://lore.kernel.org/r/20240617-arm-psci-system_reset2-vendor-reboots-v5-0-086950f650c8@quicinc.com
- Link to v4: https://lore.kernel.org/r/20240611-arm-psci-system_reset2-vendor-reboots-v4-0-98f55aa74ae8@quicinc.com
- Link to v3: https://lore.kernel.org/r/20240515-arm-psci-system_reset2-vendor-reboots-v3-0-16dd4f9c0ab4@quicinc.com
- Link to v2: https://lore.kernel.org/r/20240414-arm-psci-system_reset2-vendor-reboots-v2-0-da9a055a648f@quicinc.com
- Link to v1: https://lore.kernel.org/r/20231117-arm-psci-system_reset2-vendor-reboots-v1-0-03c4612153e2@quicinc.com
- Link to RFC: https://lore.kernel.org/r/20231030-arm-psci-system_reset2-vendor-reboots-v1-0-dcdd63352ad1@quicinc.com
To: Lorenzo Pieralisi <lpieralisi@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
To: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
To: Bjorn Andersson <andersson@kernel.org>
To: Sebastian Reichel <sre@kernel.org>
To: Rob Herring <robh@kernel.org>
To: Sudeep Holla <sudeep.holla@arm.com>
To: Souvik Chakravarty <Souvik.Chakravarty@arm.com>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Andy Yan <andy.yan@rock-chips.com>
To: Matthias Brugger <matthias.bgg@gmail.com>
To: Mark Rutland <mark.rutland@arm.com>
To: Conor Dooley <conor+dt@kernel.org>
To: Konrad Dybcio <konradybcio@kernel.org>
To: John Stultz <john.stultz@linaro.org>
To: Moritz Fischer <moritz.fischer@ettus.com>
To: Rafael J. Wysocki <rafael@kernel.org>
To: Daniel Lezcano <daniel.lezcano@kernel.org>
To: Christian Loehle <christian.loehle@arm.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
To: Lee Jones <lee@kernel.org>
To: Ulf Hansson <ulfh@kernel.org>
To: Pavan Kondeti <pavan.kondeti@oss.qualcomm.com>
To: Abel Vesa <abelvesa@kernel.org>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Cc: Andre Draszik <andre.draszik@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: mfd@lists.linux.dev
---
Shivendra Pratap (10):
power: reset: reboot-mode: Support up to 3 magic values per mode
power: reset: reboot-mode: Add support for predefined reboot modes
firmware: psci: Introduce command-based resets
firmware: psci: Add support for PSCI auxiliary devices
dt-bindings: arm: Document reboot mode magic
power: reset: Add psci-reboot-mode driver
arm64: dts: qcom: Add psci reboot-modes for kodiak boards
arm64: dts: qcom: Add psci reboot-modes for lemans boards
arm64: dts: qcom: Add psci reboot-modes for monaco boards
arm64: dts: qcom: Add psci reboot-modes for talos boards
Documentation/devicetree/bindings/arm/psci.yaml | 60 +++++++
MAINTAINERS | 2 +
arch/arm64/boot/dts/qcom/kodiak.dtsi | 2 +-
arch/arm64/boot/dts/qcom/lemans-evk.dts | 7 +
arch/arm64/boot/dts/qcom/lemans-ride-common.dtsi | 7 +
arch/arm64/boot/dts/qcom/lemans.dtsi | 2 +-
arch/arm64/boot/dts/qcom/monaco-evk.dts | 7 +
arch/arm64/boot/dts/qcom/monaco.dtsi | 2 +-
arch/arm64/boot/dts/qcom/qcm6490-idp.dts | 7 +
arch/arm64/boot/dts/qcom/qcs615-ride.dts | 7 +
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 7 +
arch/arm64/boot/dts/qcom/qcs8300-ride.dts | 7 +
arch/arm64/boot/dts/qcom/talos.dtsi | 2 +-
drivers/cpuidle/Kconfig.arm | 1 +
drivers/cpuidle/cpuidle-psci-domain.c | 31 ++--
drivers/firmware/psci/Kconfig | 14 ++
drivers/firmware/psci/Makefile | 1 +
drivers/firmware/psci/psci-devices.c | 108 ++++++++++++
drivers/firmware/psci/psci.c | 117 ++++++++++++-
drivers/power/reset/Kconfig | 10 ++
drivers/power/reset/Makefile | 1 +
drivers/power/reset/nvmem-reboot-mode.c | 7 +-
drivers/power/reset/psci-reboot-mode.c | 104 ++++++++++++
drivers/power/reset/qcom-pon.c | 7 +-
drivers/power/reset/reboot-mode.c | 208 +++++++++++++++++------
drivers/power/reset/syscon-reboot-mode.c | 7 +-
include/linux/psci.h | 15 ++
include/linux/reboot-mode.h | 27 +++
28 files changed, 696 insertions(+), 81 deletions(-)
---
base-commit: 68142f986ff04b2b70b31db00f719bf690f64a9a
change-id: 20250709-arm-psci-system_reset2-vendor-reboots-46c80044afcf
Best regards,
--
Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH v25 01/10] power: reset: reboot-mode: Support up to 3 magic values per mode
2026-09-14 14:59 [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
@ 2026-09-14 14:59 ` Shivendra Pratap
2026-09-14 15:09 ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 02/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
` (8 subsequent siblings)
9 siblings, 1 reply; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-14 14:59 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Matthias Brugger, Mark Rutland,
Conor Dooley, Konrad Dybcio, John Stultz, Moritz Fischer,
Rafael J. Wysocki, Daniel Lezcano, Christian Loehle, Lee Jones,
Ulf Hansson, Pavan Kondeti, Abel Vesa, Bartosz Golaszewski,
Sudeep Holla, Ulf Hansson
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, Shivendra Pratap,
Srinivas Kandagatla
ARM PSCI vendor-specific resets, require a 32-bit reset_type and a 64-bit
cookie as arguments. This cannot be implemented via the reboot-mode
framework, which supports a single 32-bit argument as magic value.
Extend the reboot-mode framework to support up to three 32-bit arguments
as magic, per reboot-mode.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/reboot-mode.c | 46 +++++++++++++++++++++++++++------------
include/linux/reboot-mode.h | 3 +++
2 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
index 3611bed341e1..328fa37598df 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -20,7 +20,8 @@
struct mode_info {
const char *mode;
- u32 magic;
+ u32 magic[3];
+ u32 count;
struct list_head list;
};
@@ -72,8 +73,7 @@ static const struct class reboot_mode_class = {
.dev_groups = reboot_mode_groups,
};
-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;
@@ -84,11 +84,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_, ',', '-');
@@ -96,21 +96,25 @@ 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 && info->count) {
+ if (reboot->write_array)
+ reboot->write_array(reboot, info->magic, info->count);
+ else if (reboot->write && info->magic[0])
+ reboot->write(reboot, info->magic[0]);
+ }
return NOTIFY_DONE;
}
@@ -173,16 +177,22 @@ 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[3];
+ int count;
int ret;
INIT_LIST_HEAD(&reboot->head);
for_each_property_of_node(np, prop) {
+ memset(magic, 0, sizeof(magic));
+
if (strncmp(prop->name, PREFIX, len))
continue;
- if (device_property_read_u32(reboot->dev, prop->name, &magic)) {
+ count = device_property_count_u32(reboot->dev, prop->name);
+
+ if (count <= 0 || count > ARRAY_SIZE(magic) ||
+ device_property_read_u32_array(reboot->dev, prop->name, magic, count)) {
dev_dbg(reboot->dev, "reboot mode %s without magic number\n",
prop->name);
continue;
@@ -194,7 +204,15 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
goto error;
}
- info->magic = magic;
+ if (!memchr_inv(magic, 0, count * sizeof(u32))) {
+ dev_dbg(reboot->dev, "reboot mode %s with zero magic values\n",
+ prop->name);
+ info->count = 0;
+ } else {
+ memcpy(info->magic, magic, count * sizeof(u32));
+ info->count = count;
+ }
+
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 4a2abb38d1d6..29ae39935d69 100644
--- a/include/linux/reboot-mode.h
+++ b/include/linux/reboot-mode.h
@@ -2,10 +2,13 @@
#ifndef __REBOOT_MODE_H__
#define __REBOOT_MODE_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_array)(struct reboot_mode_driver *reboot, const u32 *magic, int count);
struct notifier_block reboot_notifier;
};
--
2.34.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v25 02/10] power: reset: reboot-mode: Add support for predefined reboot modes
2026-09-14 14:59 [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 01/10] power: reset: reboot-mode: Support up to 3 magic values per mode Shivendra Pratap
@ 2026-09-14 14:59 ` Shivendra Pratap
2026-09-14 15:12 ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 03/10] firmware: psci: Introduce command-based resets Shivendra Pratap
` (7 subsequent siblings)
9 siblings, 1 reply; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-14 14:59 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Matthias Brugger, Mark Rutland,
Conor Dooley, Konrad Dybcio, John Stultz, Moritz Fischer,
Rafael J. Wysocki, Daniel Lezcano, Christian Loehle, Lee Jones,
Ulf Hansson, Pavan Kondeti, Abel Vesa, Bartosz Golaszewski,
Sudeep Holla, Ulf Hansson
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, 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.
Extend the reboot-mode framework to support driver-defined predefined
reboot modes. Add a centralized initcall to initialize driver state
along with predefined modes.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/power/reset/nvmem-reboot-mode.c | 7 +-
drivers/power/reset/qcom-pon.c | 7 +-
drivers/power/reset/reboot-mode.c | 192 ++++++++++++++++++++++---------
drivers/power/reset/syscon-reboot-mode.c | 7 +-
include/linux/reboot-mode.h | 26 ++++-
5 files changed, 175 insertions(+), 64 deletions(-)
diff --git a/drivers/power/reset/nvmem-reboot-mode.c b/drivers/power/reset/nvmem-reboot-mode.c
index d260715fccf6..700732ed0f5b 100644
--- a/drivers/power/reset/nvmem-reboot-mode.c
+++ b/drivers/power/reset/nvmem-reboot-mode.c
@@ -51,8 +51,11 @@ static int nvmem_reboot_mode_probe(struct platform_device *pdev)
if (!nvmem_rbm)
return -ENOMEM;
- nvmem_rbm->reboot.dev = &pdev->dev;
- nvmem_rbm->reboot.write = nvmem_reboot_mode_write;
+ ret = reboot_mode_driver_init(&nvmem_rbm->reboot, &pdev->dev,
+ nvmem_reboot_mode_write, NULL,
+ NULL, 0);
+ if (ret)
+ return ret;
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 7e108982a582..f63996994a25 100644
--- a/drivers/power/reset/qcom-pon.c
+++ b/drivers/power/reset/qcom-pon.c
@@ -70,9 +70,12 @@ static int qcom_pon_probe(struct platform_device *pdev)
reason_shift = (long)of_device_get_match_data(&pdev->dev);
if (reason_shift != NO_REASON_SHIFT) {
- pon->reboot_mode.dev = &pdev->dev;
+ error = reboot_mode_driver_init(&pon->reboot_mode, &pdev->dev,
+ qcom_pon_reboot_mode_write, NULL,
+ NULL, 0);
+ if (error)
+ return error;
pon->reason_shift = reason_shift;
- pon->reboot_mode.write = qcom_pon_reboot_mode_write;
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 328fa37598df..fd61de226383 100644
--- a/drivers/power/reset/reboot-mode.c
+++ b/drivers/power/reset/reboot-mode.c
@@ -30,12 +30,12 @@ struct reboot_mode_sysfs_data {
struct list_head head;
};
-static inline void reboot_mode_release_list(struct reboot_mode_sysfs_data *priv)
+static void reboot_mode_release_list(struct list_head *head)
{
struct mode_info *info;
struct mode_info *next;
- list_for_each_entry_safe(info, next, &priv->head, list) {
+ list_for_each_entry_safe(info, next, head, list) {
list_del(&info->list);
kfree_const(info->mode);
kfree(info);
@@ -119,6 +119,80 @@ static int reboot_mode_notify(struct notifier_block *this,
return NOTIFY_DONE;
}
+/**
+ * reboot_mode_driver_init - Initialize reboot-mode state
+ * @reboot: reboot mode driver object to initialize
+ * @dev: backing device
+ * @write: write callback to program a single magic value
+ * @write_array: write callback to program multiple magic values
+ * @predefined_modes: optional predefined reboot-mode table
+ * @predefined_mode_count: number of entries in @predefined_modes
+ *
+ * Exactly one write callback must be provided by the driver.
+ *
+ * This function must be called with a valid @dev before calling
+ * reboot_mode_register().
+ *
+ * Returns: 0 on success or -EINVAL if callback/predefined mode configuration
+ * is invalid.
+ */
+int reboot_mode_driver_init(struct reboot_mode_driver *reboot,
+ struct device *dev,
+ int (*write)(struct reboot_mode_driver *reboot, unsigned int magic),
+ int (*write_array)(struct reboot_mode_driver *reboot,
+ const u32 *magic, u32 count),
+ const struct reboot_mode_entry *predefined_modes,
+ size_t predefined_mode_count)
+{
+ if (!reboot || !dev)
+ return -EINVAL;
+
+ if (!write == !write_array)
+ return -EINVAL;
+
+ memset(reboot, 0, sizeof(*reboot));
+ reboot->dev = dev;
+ reboot->write = write;
+ reboot->write_array = write_array;
+ reboot->predefined_modes = predefined_modes;
+ reboot->predefined_mode_count = predefined_mode_count;
+ INIT_LIST_HEAD(&reboot->head);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(reboot_mode_driver_init);
+
+static struct mode_info *reboot_mode_create_info(struct device *dev, const char *mode,
+ const u32 *magic, int count)
+{
+ struct mode_info *info;
+
+ if (!mode || mode[0] == '\0') {
+ dev_err(dev, "invalid mode name\n");
+ return ERR_PTR(-EINVAL);
+ }
+
+ info = kzalloc_obj(*info, GFP_KERNEL);
+ if (!info)
+ return ERR_PTR(-ENOMEM);
+
+ info->mode = kstrdup_const(mode, GFP_KERNEL);
+ if (!info->mode) {
+ kfree(info);
+ return ERR_PTR(-ENOMEM);
+ }
+
+ if (!memchr_inv(magic, 0, count * sizeof(u32))) {
+ dev_dbg(dev, "reboot mode %s with zero magic values\n", mode);
+ info->count = 0;
+ } else {
+ memcpy(info->magic, magic, count * sizeof(u32));
+ info->count = count;
+ }
+
+ return info;
+}
+
static int reboot_mode_create_device(struct reboot_mode_driver *reboot)
{
struct reboot_mode_sysfs_data *priv;
@@ -160,11 +234,38 @@ static int reboot_mode_create_device(struct reboot_mode_driver *reboot)
return 0;
error:
- reboot_mode_release_list(priv);
+ reboot_mode_release_list(&priv->head);
kfree(priv);
return ret;
}
+static int reboot_mode_add_predefined_modes(struct reboot_mode_driver *reboot)
+{
+ const struct reboot_mode_entry *modes = reboot->predefined_modes;
+ struct mode_info *info;
+ size_t i;
+
+ if (!modes)
+ return 0;
+
+ for (i = 0; i < reboot->predefined_mode_count; i++) {
+ if (modes[i].name && strpbrk(modes[i].name, "\n ,/"))
+ return -EINVAL;
+
+ if (!modes[i].count || modes[i].count > ARRAY_SIZE(modes[i].magic))
+ return -EINVAL;
+
+ info = reboot_mode_create_info(reboot->dev, modes[i].name,
+ modes[i].magic, modes[i].count);
+ if (IS_ERR(info))
+ return PTR_ERR(info);
+
+ list_add_tail(&info->list, &reboot->head);
+ }
+
+ return 0;
+}
+
/**
* reboot_mode_register - register a reboot mode driver
* @reboot: reboot mode driver
@@ -173,7 +274,7 @@ static int reboot_mode_create_device(struct reboot_mode_driver *reboot)
*/
int reboot_mode_register(struct reboot_mode_driver *reboot)
{
- struct mode_info *info = NULL;
+ struct mode_info *info;
struct property *prop;
struct device_node *np = reboot->dev->of_node;
size_t len = strlen(PREFIX);
@@ -183,52 +284,36 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
INIT_LIST_HEAD(&reboot->head);
- for_each_property_of_node(np, prop) {
- memset(magic, 0, sizeof(magic));
-
- if (strncmp(prop->name, PREFIX, len))
- continue;
-
- count = device_property_count_u32(reboot->dev, prop->name);
-
- if (count <= 0 || count > ARRAY_SIZE(magic) ||
- device_property_read_u32_array(reboot->dev, prop->name, magic, count)) {
- dev_dbg(reboot->dev, "reboot mode %s without magic number\n",
- prop->name);
- continue;
- }
-
- info = kzalloc_obj(*info);
- if (!info) {
- ret = -ENOMEM;
- goto error;
- }
-
- if (!memchr_inv(magic, 0, count * sizeof(u32))) {
- dev_dbg(reboot->dev, "reboot mode %s with zero magic values\n",
- prop->name);
- info->count = 0;
- } else {
- memcpy(info->magic, magic, count * sizeof(u32));
- info->count = count;
- }
-
- info->mode = kstrdup_const(prop->name + len, GFP_KERNEL);
- if (!info->mode) {
- ret = -ENOMEM;
- goto error;
- } 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);
- goto error;
+ if (np) {
+ for_each_property_of_node(np, prop) {
+ memset(magic, 0, sizeof(magic));
+ if (strncmp(prop->name, PREFIX, len))
+ continue;
+
+ count = device_property_count_u32(reboot->dev, prop->name);
+
+ if (count <= 0 || count > ARRAY_SIZE(magic) ||
+ device_property_read_u32_array(reboot->dev, prop->name, magic, count)) {
+ dev_dbg(reboot->dev, "reboot mode %s without magic number\n",
+ prop->name);
+ continue;
+ }
+
+ info = reboot_mode_create_info(reboot->dev, prop->name + len,
+ magic, count);
+ if (IS_ERR(info)) {
+ ret = PTR_ERR(info);
+ goto error;
+ }
+
+ list_add_tail(&info->list, &reboot->head);
}
-
- list_add_tail(&info->list, &reboot->head);
- info = NULL;
}
+ ret = reboot_mode_add_predefined_modes(reboot);
+ if (ret)
+ goto error;
+
reboot->reboot_notifier.notifier_call = reboot_mode_notify;
register_reboot_notifier(&reboot->reboot_notifier);
@@ -239,7 +324,6 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
return 0;
error:
- kfree(info);
reboot_mode_unregister(reboot);
return ret;
}
@@ -272,7 +356,7 @@ static inline void reboot_mode_unregister_device(struct reboot_mode_driver *rebo
if (!priv)
return;
- reboot_mode_release_list(priv);
+ reboot_mode_release_list(&priv->head);
kfree(priv);
}
@@ -282,17 +366,11 @@ static inline void reboot_mode_unregister_device(struct reboot_mode_driver *rebo
*/
int reboot_mode_unregister(struct reboot_mode_driver *reboot)
{
- struct mode_info *info;
- struct mode_info *next;
-
unregister_reboot_notifier(&reboot->reboot_notifier);
+ reboot->reboot_notifier.notifier_call = NULL;
reboot_mode_unregister_device(reboot);
- list_for_each_entry_safe(info, next, &reboot->head, list) {
- list_del(&info->list);
- kfree_const(info->mode);
- kfree(info);
- }
+ reboot_mode_release_list(&reboot->head);
return 0;
}
diff --git a/drivers/power/reset/syscon-reboot-mode.c b/drivers/power/reset/syscon-reboot-mode.c
index e0772c9f70f7..7d3a95e8dfd7 100644
--- a/drivers/power/reset/syscon-reboot-mode.c
+++ b/drivers/power/reset/syscon-reboot-mode.c
@@ -45,8 +45,11 @@ static int syscon_reboot_mode_probe(struct platform_device *pdev)
if (!syscon_rbm)
return -ENOMEM;
- syscon_rbm->reboot.dev = &pdev->dev;
- syscon_rbm->reboot.write = syscon_reboot_mode_write;
+ ret = reboot_mode_driver_init(&syscon_rbm->reboot, &pdev->dev,
+ syscon_reboot_mode_write, NULL,
+ NULL, 0);
+ if (ret)
+ return ret;
syscon_rbm->mask = 0xffffffff;
syscon_rbm->map = syscon_node_to_regmap(pdev->dev.parent->of_node);
diff --git a/include/linux/reboot-mode.h b/include/linux/reboot-mode.h
index 29ae39935d69..560d8b4d67ac 100644
--- a/include/linux/reboot-mode.h
+++ b/include/linux/reboot-mode.h
@@ -4,14 +4,38 @@
#include <linux/types.h>
+struct reboot_mode_entry {
+ const char *name;
+ u32 magic[3];
+ u32 count;
+};
+
struct reboot_mode_driver {
struct device *dev;
struct list_head head;
+ /*
+ * Optional predefined reboot-mode table.
+ *
+ * Must be initialized before reboot_mode_register() and remain valid
+ * until reboot_mode_unregister().
+ *
+ * If a predefined mode name duplicates a DT-defined mode name,
+ * the DT-defined mode takes precedence.
+ */
+ const struct reboot_mode_entry *predefined_modes;
+ size_t predefined_mode_count;
+ int (*write_array)(struct reboot_mode_driver *reboot, const u32 *magic, u32 count);
int (*write)(struct reboot_mode_driver *reboot, unsigned int magic);
- int (*write_array)(struct reboot_mode_driver *reboot, const u32 *magic, int count);
struct notifier_block reboot_notifier;
};
+int reboot_mode_driver_init(struct reboot_mode_driver *reboot,
+ struct device *dev,
+ int (*write)(struct reboot_mode_driver *reboot, unsigned int magic),
+ int (*write_array)(struct reboot_mode_driver *reboot,
+ const u32 *magic, u32 count),
+ const struct reboot_mode_entry *predefined_modes,
+ size_t predefined_mode_count);
int reboot_mode_register(struct reboot_mode_driver *reboot);
int reboot_mode_unregister(struct reboot_mode_driver *reboot);
int devm_reboot_mode_register(struct device *dev,
--
2.34.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v25 03/10] firmware: psci: Introduce command-based resets
2026-09-14 14:59 [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 01/10] power: reset: reboot-mode: Support up to 3 magic values per mode Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 02/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
@ 2026-09-14 14:59 ` Shivendra Pratap
2026-09-14 15:14 ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 04/10] firmware: psci: Add support for PSCI auxiliary devices Shivendra Pratap
` (6 subsequent siblings)
9 siblings, 1 reply; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-14 14:59 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Matthias Brugger, Mark Rutland,
Conor Dooley, Konrad Dybcio, John Stultz, Moritz Fischer,
Rafael J. Wysocki, Daniel Lezcano, Christian Loehle, Lee Jones,
Ulf Hansson, Pavan Kondeti, Abel Vesa, Bartosz Golaszewski,
Sudeep Holla, Ulf Hansson
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, Shivendra Pratap,
Srinivas Kandagatla
PSCI currently supports only two resets - SYSTEM_RESET and SYSTEM_RESET2
ARCH WARM reset. The reset patch is selected 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 reboot-mode drivers to set
the PSCI reset command by passing a reset_type and a cookie.
Add support for the following reset commands:
- SYSTEM_RESET2 vendor-specific resets.
- SYSTEM_RESET2 ARCH WARM reset and SYSTEM_RESET (reset_type = 0 and
cookie one of psci_standard_resets).
Unsupported commands fall back to the regular PSCI reset path.
Default to the existing reboot_mode-based reset flow unless a reset
command is configured. If a kernel panic() or a emergency_restart()
occurs after a reset command is set but before the final PSCI reset is
issued, ignore the reset command and follow the normal reboot_mode-based
reset path.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
drivers/firmware/psci/psci.c | 117 ++++++++++++++++++++++++++++++++++++++++++-
include/linux/psci.h | 15 ++++++
2 files changed, 130 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index e73bae6cb23a..d489ba5d147c 100644
--- a/drivers/firmware/psci/psci.c
+++ b/drivers/firmware/psci/psci.c
@@ -11,17 +11,22 @@
#include <linux/cpuidle.h>
#include <linux/debugfs.h>
#include <linux/errno.h>
+#include <linux/kconfig.h>
#include <linux/linkage.h>
+#include <linux/mutex.h>
#include <linux/of.h>
+#include <linux/panic.h>
#include <linux/pm.h>
#include <linux/printk.h>
#include <linux/psci.h>
#include <linux/reboot.h>
#include <linux/slab.h>
#include <linux/suspend.h>
+#include <linux/wordpart.h>
#include <uapi/linux/psci.h>
+#include <asm/barrier.h>
#include <asm/cpuidle.h>
#include <asm/cputype.h>
#include <asm/hypervisor.h>
@@ -51,6 +56,15 @@ static int resident_cpu = -1;
struct psci_operations psci_ops;
static enum arm_smccc_conduit psci_conduit = SMCCC_CONDUIT_NONE;
+struct psci_system_reset_cmd {
+ u32 reset_type;
+ u64 cookie;
+};
+
+static struct psci_system_reset_cmd reset_cmd_data;
+static struct psci_system_reset_cmd *reset_cmd;
+static DEFINE_MUTEX(reset_cmd_mutex);
+
bool psci_tos_resident_on(int cpu)
{
return cpu == resident_cpu;
@@ -80,6 +94,64 @@ static u32 psci_cpu_suspend_feature;
static bool psci_system_reset2_supported;
static bool psci_system_off2_hibernate_supported;
+static u32 psci_get_sys_reset_fn(const struct psci_system_reset_cmd *cmd)
+{
+ switch (cmd->cookie) {
+ case PSCI_SYSTEM_RESET2_ARCH_WARM_RESET:
+ if (psci_system_reset2_supported)
+ return PSCI_FN_NATIVE(1_1, SYSTEM_RESET2);
+ return 0;
+ case PSCI_SYSTEM_RESET_COLD_RESET:
+ return PSCI_0_2_FN_SYSTEM_RESET;
+ default:
+ return 0;
+ }
+}
+
+/**
+ * psci_set_reset_cmd() - Configure the PSCI reset command
+ * @reset_type: PSCI SYSTEM_RESET2 reset_type, or 0 for a standard reset selector
+ * @cookie: Vendor-defined SYSTEM_RESET2 cookie, or a value from
+ * enum psci_standard_resets when @reset_type is 0
+ *
+ * For vendor-specific SYSTEM_RESET2 resets, @reset_type and @cookie
+ * must contain platform-defined values.
+ *
+ * For standard resets, @reset_type must be 0 and @cookie must be a
+ * value from enum psci_standard_resets.
+ *
+ * The reset command may be configured only once per boot cycle.
+ */
+int psci_set_reset_cmd(u32 reset_type, u64 cookie)
+{
+ if (!reset_type && !cookie)
+ return -EINVAL;
+
+ if (!IS_ENABLED(CONFIG_64BIT) && upper_32_bits(cookie))
+ return -EINVAL;
+
+ scoped_guard(mutex, &reset_cmd_mutex) {
+ if (reset_cmd)
+ return -EBUSY;
+
+ reset_cmd_data.reset_type = reset_type;
+ reset_cmd_data.cookie = cookie;
+ /*
+ * Publish the command only after both fields are fully initialized.
+ * Readers run from the atomic restart notifier path and must not block.
+ */
+ smp_store_release(&reset_cmd, &reset_cmd_data);
+ }
+
+ return 0;
+}
+
+bool psci_has_system_reset2_support(void)
+{
+ return psci_system_reset2_supported;
+}
+EXPORT_SYMBOL_NS_GPL(psci_has_system_reset2_support, "PSCI");
+
static inline bool psci_has_ext_power_state(void)
{
return psci_cpu_suspend_feature &
@@ -306,8 +378,25 @@ static int get_set_conduit_method(const struct device_node *np)
return 0;
}
-static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
- void *data)
+static void psci_handle_reset_cmd(const struct psci_system_reset_cmd *cmd)
+{
+ u32 psci_sys_reset_fn;
+
+ /* PSCI_1_1_RESET_TYPE_VENDOR_START identifies vendor reset types. */
+ if ((cmd->reset_type & PSCI_1_1_RESET_TYPE_VENDOR_START) &&
+ psci_system_reset2_supported) {
+ /* PSCI SYSTEM_RESET2 Vendor-specific reset */
+ invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2),
+ cmd->reset_type, cmd->cookie, 0);
+ } else {
+ /* Retrieve the psci reset function from reset_cmd */
+ psci_sys_reset_fn = psci_get_sys_reset_fn(cmd);
+ if (!cmd->reset_type && psci_sys_reset_fn)
+ invoke_psci_fn(psci_sys_reset_fn, 0, 0, 0);
+ }
+}
+
+static void psci_handle_reboot_mode(void)
{
if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) &&
psci_system_reset2_supported) {
@@ -320,6 +409,30 @@ static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
} else {
invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
}
+}
+
+static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
+ void *data)
+{
+ const struct psci_system_reset_cmd *cmd;
+
+ /* The function psci_handle_reboot_mode follows reboot_mode based
+ * reset flow and psci_handle_reset_cmd uses reset_cmd based reset flow.
+ *
+ * The reset_cmd is configured at the reboot_notifier phase.
+ * If panic() or emergency_restart() occurs between the reboot_notifier
+ * and this final reset, skip command-based reset and let reboot_mode drive
+ * the reset flow.
+ *
+ * The function psci_handle_reset_cmd invokes non-returning PSCI SYSTEM_RESET
+ * calls to reset the device. If it returns, either the reset failed, or the
+ * command was unsupported. Fallback to reboot_mode based reset flow.
+ */
+ cmd = smp_load_acquire(&reset_cmd);
+ if (data && cmd && !panic_in_progress())
+ psci_handle_reset_cmd(cmd);
+
+ psci_handle_reboot_mode();
return NOTIFY_DONE;
}
diff --git a/include/linux/psci.h b/include/linux/psci.h
index 4ca0060a3fc4..e81b1cdeca51 100644
--- a/include/linux/psci.h
+++ b/include/linux/psci.h
@@ -8,6 +8,7 @@
#define __LINUX_PSCI_H
#include <linux/arm-smccc.h>
+#include <linux/errno.h>
#include <linux/init.h>
#include <linux/types.h>
@@ -21,6 +22,16 @@ bool psci_power_state_is_valid(u32 state);
int psci_set_osi_mode(bool enable);
bool psci_has_osi_support(void);
+/**
+ * enum psci_standard_resets - Standard reset selectors for PSCI reset
+ * @PSCI_SYSTEM_RESET_COLD_RESET: Standard SYSTEM_RESET command.
+ * @PSCI_SYSTEM_RESET2_ARCH_WARM_RESET: SYSTEM_RESET2 architectural warm reset.
+ */
+enum psci_standard_resets {
+ PSCI_SYSTEM_RESET_COLD_RESET = 1,
+ PSCI_SYSTEM_RESET2_ARCH_WARM_RESET,
+};
+
struct psci_operations {
u32 (*get_version)(void);
int (*cpu_suspend)(u32 state, unsigned long entry_point);
@@ -45,8 +56,12 @@ 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);
+int psci_set_reset_cmd(u32 reset_type, u64 cookie);
+bool psci_has_system_reset2_support(void);
#else
static inline int psci_dt_init(void) { return 0; }
+static inline int psci_set_reset_cmd(u32 reset_type, u64 cookie) { return -EOPNOTSUPP; }
+static inline bool psci_has_system_reset2_support(void) { return false; }
#endif
#if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)
--
2.34.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v25 04/10] firmware: psci: Add support for PSCI auxiliary devices
2026-09-14 14:59 [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (2 preceding siblings ...)
2026-09-14 14:59 ` [PATCH v25 03/10] firmware: psci: Introduce command-based resets Shivendra Pratap
@ 2026-09-14 14:59 ` Shivendra Pratap
2026-09-14 15:21 ` sashiko-bot
2026-09-16 9:29 ` Bartosz Golaszewski
2026-09-14 14:59 ` [PATCH v25 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
` (5 subsequent siblings)
9 siblings, 2 replies; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-14 14:59 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Matthias Brugger, Mark Rutland,
Conor Dooley, Konrad Dybcio, John Stultz, Moritz Fischer,
Rafael J. Wysocki, Daniel Lezcano, Christian Loehle, Lee Jones,
Ulf Hansson, Pavan Kondeti, Abel Vesa, Bartosz Golaszewski,
Sudeep Holla, Ulf Hansson
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, Shivendra Pratap,
Srinivas Kandagatla, Ulf Hansson, Bartosz Golaszewski
PSCI has multiple kernel consumers, such as cpuidle-psci-domain.
Currently, both the PSCI core driver and cpuidle-psci-domain bind
directly to the same PSCI node "arm,psci-1.0". Additional consumers, if
introduced, would also need to bind in the same way, leading to multiple
drivers attached to a single device node.
Introduce a PSCI auxiliary-device provider that binds to "arm,psci-1.0"
and registers PSCI child devices on the auxiliary bus. As the first
user, register cpuidle-psci-domain as an auxiliary device.
Update cpuidle-psci-domain to probe as an auxiliary driver and use
the PSCI device node for power-domain traversal.
Suggested-by: Ulf Hansson <ulf.hansson@oss.qualcomm.com>
Suggested-by: Lee Jones <lee@kernel.org>
Suggested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
MAINTAINERS | 1 +
drivers/cpuidle/Kconfig.arm | 1 +
drivers/cpuidle/cpuidle-psci-domain.c | 31 +++++++++++++++-----------
drivers/firmware/psci/Kconfig | 14 ++++++++++++
drivers/firmware/psci/Makefile | 1 +
drivers/firmware/psci/psci-devices.c | 41 +++++++++++++++++++++++++++++++++++
6 files changed, 76 insertions(+), 13 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 207a6e2db70c..9c0334ee2ed2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21932,6 +21932,7 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
S: Maintained
F: Documentation/devicetree/bindings/arm/psci.yaml
F: drivers/firmware/psci/
+F: drivers/firmware/psci/psci-devices.c
F: include/linux/psci.h
F: include/uapi/linux/psci.h
diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm
index b88b01aa5829..f22e18b05053 100644
--- a/drivers/cpuidle/Kconfig.arm
+++ b/drivers/cpuidle/Kconfig.arm
@@ -36,6 +36,7 @@ config ARM_PSCI_CPUIDLE_DOMAIN
bool "PSCI CPU idle Domain"
depends on ARM_PSCI_CPUIDLE
depends on PM_GENERIC_DOMAINS_OF
+ depends on ARM_PSCI_DEVICES
select DT_IDLE_GENPD
default y
help
diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
index b9e4ad7d43a3..0ce6a83f6588 100644
--- a/drivers/cpuidle/cpuidle-psci-domain.c
+++ b/drivers/cpuidle/cpuidle-psci-domain.c
@@ -9,10 +9,11 @@
#define pr_fmt(fmt) "CPUidle PSCI: " fmt
+#include <linux/auxiliary_bus.h>
#include <linux/cpu.h>
#include <linux/device.h>
#include <linux/kernel.h>
-#include <linux/platform_device.h>
+#include <linux/module.h>
#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
#include <linux/psci.h>
@@ -122,14 +123,10 @@ static void psci_pd_remove(void)
}
}
-static const struct of_device_id psci_of_match[] = {
- { .compatible = "arm,psci-1.0" },
- {}
-};
-
-static int psci_cpuidle_domain_probe(struct platform_device *pdev)
+static int psci_cpuidle_domain_probe(struct auxiliary_device *auxdev,
+ const struct auxiliary_device_id *id)
{
- struct device_node *np = pdev->dev.of_node;
+ struct device_node *np = auxdev->dev.of_node;
bool use_osi = psci_has_osi_support();
int ret = 0, pd_count = 0;
@@ -177,16 +174,24 @@ static int psci_cpuidle_domain_probe(struct platform_device *pdev)
return ret;
}
-static struct platform_driver psci_cpuidle_domain_driver = {
- .probe = psci_cpuidle_domain_probe,
+static const struct auxiliary_device_id psci_cpuidle_domain_id_table[] = {
+ { .name = "arm-psci.psci-cpuidle-domain" },
+ { }
+};
+MODULE_DEVICE_TABLE(auxiliary, psci_cpuidle_domain_id_table);
+
+static struct auxiliary_driver psci_cpuidle_domain_driver = {
+ .probe = psci_cpuidle_domain_probe,
.driver = {
- .name = "psci-cpuidle-domain",
- .of_match_table = psci_of_match,
+ .suppress_bind_attrs = true,
},
+ .id_table = psci_cpuidle_domain_id_table,
};
static int __init psci_idle_init_domains(void)
{
- return platform_driver_register(&psci_cpuidle_domain_driver);
+ return __auxiliary_driver_register(&psci_cpuidle_domain_driver,
+ THIS_MODULE,
+ "psci-cpuidle-domain");
}
core_initcall(psci_idle_init_domains);
diff --git a/drivers/firmware/psci/Kconfig b/drivers/firmware/psci/Kconfig
index 97944168b5e6..68e381f1a618 100644
--- a/drivers/firmware/psci/Kconfig
+++ b/drivers/firmware/psci/Kconfig
@@ -2,6 +2,20 @@
config ARM_PSCI_FW
bool
+config ARM_PSCI_DEVICES
+ bool "PSCI auxiliary device support"
+ depends on ARM_PSCI_FW
+ depends on OF
+ select AUXILIARY_BUS
+ default y
+ help
+ Say Y here to enable auxiliary device support for PSCI.
+
+ This creates auxiliary devices for PSCI functionality implemented
+ outside the core PSCI firmware driver. These devices allow PSCI
+ child drivers to bind through the auxiliary bus while sharing the
+ PSCI firmware device as their parent.
+
config ARM_PSCI_CHECKER
bool "ARM PSCI checker"
depends on ARM_PSCI_FW && HOTPLUG_CPU && CPU_IDLE && !TORTURE_TEST
diff --git a/drivers/firmware/psci/Makefile b/drivers/firmware/psci/Makefile
index 1956b882470f..8e75a0ed6f74 100644
--- a/drivers/firmware/psci/Makefile
+++ b/drivers/firmware/psci/Makefile
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
#
obj-$(CONFIG_ARM_PSCI_FW) += psci.o
+obj-$(CONFIG_ARM_PSCI_DEVICES) += psci-devices.o
obj-$(CONFIG_ARM_PSCI_CHECKER) += psci_checker.o
diff --git a/drivers/firmware/psci/psci-devices.c b/drivers/firmware/psci/psci-devices.c
new file mode 100644
index 000000000000..f1eca61e3269
--- /dev/null
+++ b/drivers/firmware/psci/psci-devices.c
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include <linux/auxiliary_bus.h>
+#include <linux/init.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+static int arm_psci_probe(struct platform_device *pdev)
+{
+ struct auxiliary_device *auxdev;
+
+ auxdev = __devm_auxiliary_device_create(&pdev->dev, "arm-psci",
+ "psci-cpuidle-domain", NULL, 0);
+ if (!auxdev)
+ return -ENOMEM;
+
+ return 0;
+}
+
+static const struct of_device_id arm_psci_of_match[] = {
+ { .compatible = "arm,psci-1.0" },
+ { }
+};
+
+static struct platform_driver arm_psci_driver = {
+ .probe = arm_psci_probe,
+ .driver = {
+ .name = "arm-psci",
+ .of_match_table = arm_psci_of_match,
+ .suppress_bind_attrs = true,
+ },
+};
+
+static int __init arm_psci_init(void)
+{
+ return platform_driver_register(&arm_psci_driver);
+}
+core_initcall(arm_psci_init);
--
2.34.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v25 05/10] dt-bindings: arm: Document reboot mode magic
2026-09-14 14:59 [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (3 preceding siblings ...)
2026-09-14 14:59 ` [PATCH v25 04/10] firmware: psci: Add support for PSCI auxiliary devices Shivendra Pratap
@ 2026-09-14 14:59 ` Shivendra Pratap
2026-09-14 15:19 ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
` (4 subsequent siblings)
9 siblings, 1 reply; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-14 14:59 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Matthias Brugger, Mark Rutland,
Conor Dooley, Konrad Dybcio, John Stultz, Moritz Fischer,
Rafael J. Wysocki, Daniel Lezcano, Christian Loehle, Lee Jones,
Ulf Hansson, Pavan Kondeti, Abel Vesa, Bartosz Golaszewski,
Sudeep Holla, Ulf Hansson
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, 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.
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
Documentation/devicetree/bindings/arm/psci.yaml | 60 +++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/Documentation/devicetree/bindings/arm/psci.yaml b/Documentation/devicetree/bindings/arm/psci.yaml
index 0d04389c81fa..8b6a28b81ed7 100644
--- a/Documentation/devicetree/bindings/arm/psci.yaml
+++ b/Documentation/devicetree/bindings/arm/psci.yaml
@@ -98,6 +98,43 @@ 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-.*$":
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ minItems: 2
+ items:
+ - description: arg1 (vendor-specific SYSTEM_RESET2 reset_type)
+ $ref: /schemas/types.yaml#/definitions/uint32
+ minimum: 0x80000000
+ - description:
+ arg2 (cookie_lo in 2-cell form, cookie_hi in 3-cell form)
+ $ref: /schemas/types.yaml#/definitions/uint32
+ - description: arg3 (cookie_lo in 3-cell form)
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description: |
+ Describes a PSCI SYSTEM_RESET2 vendor-specific reset type. The string
+ after "mode-" maps a reboot mode to a vendor-specific reset.
+
+ A vendor-specific reset takes two arguments, a 32-bit reset_type and a
+ 64-bit cookie. The arguments are encoded as up to three 32-bit cells.
+ Each mode property is encoded as mode-xxx = <arg1 arg2[, arg3]>,
+ where:
+
+ - arg1 is reset_type and must be >= 0x80000000.
+ - In 2-cell form, arg2 is lower 32 bits of cookie.
+ - In 3-cell form, arg2 is high 32 bits of cookie
+ and arg3 is low 32 bits of cookie.
+
+ All values should be provided as per the PSCI SYSTEM_RESET2
+ specification.
+
patternProperties:
"^power-domain-":
$ref: /schemas/power/power-domain.yaml#
@@ -137,6 +174,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 +306,18 @@ 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 0x00000001>;
+ mode-bootloader = <0x80010001 0x00000002>;
+ mode-vendor = <0x80000000 0x00000001 0x00000002>;
+ };
+ };
...
--
2.34.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v25 06/10] power: reset: Add psci-reboot-mode driver
2026-09-14 14:59 [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (4 preceding siblings ...)
2026-09-14 14:59 ` [PATCH v25 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
@ 2026-09-14 14:59 ` Shivendra Pratap
2026-09-14 15:21 ` sashiko-bot
2026-09-16 9:23 ` Bartosz Golaszewski
2026-09-14 14:59 ` [PATCH v25 07/10] arm64: dts: qcom: Add psci reboot-modes for kodiak boards Shivendra Pratap
` (3 subsequent siblings)
9 siblings, 2 replies; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-14 14:59 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Matthias Brugger, Mark Rutland,
Conor Dooley, Konrad Dybcio, John Stultz, Moritz Fischer,
Rafael J. Wysocki, Daniel Lezcano, Christian Loehle, Lee Jones,
Ulf Hansson, Pavan Kondeti, Abel Vesa, Bartosz Golaszewski,
Sudeep Holla, Ulf Hansson
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, Shivendra Pratap,
Srinivas Kandagatla, Ulf Hansson, Bartosz Golaszewski
PSCI supports different types of resets like SYSTEM_RESET, SYSTEM_RESET2
ARCH WARM reset and SYSTEM_RESET2 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 psci-reboot-mode as an auxiliary device created by the psci-devices
driver. Define two types of PSCI resets, predefined-resets and
vendor-specific resets. Predefined-resets are defined by psci driver
and vendor-specific resets are defined by SoC vendors, under the
psci:reboot-mode node of SoC device tree.
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.
Suggested-by: Ulf Hansson <ulf.hansson@oss.qualcomm.com>
Suggested-by: Lee Jones <lee@kernel.org>
Suggested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
MAINTAINERS | 1 +
drivers/firmware/psci/psci-devices.c | 71 +++++++++++++++++++++-
drivers/power/reset/Kconfig | 10 ++++
drivers/power/reset/Makefile | 1 +
drivers/power/reset/psci-reboot-mode.c | 104 +++++++++++++++++++++++++++++++++
5 files changed, 185 insertions(+), 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9c0334ee2ed2..1c0f111ba197 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21933,6 +21933,7 @@ S: Maintained
F: Documentation/devicetree/bindings/arm/psci.yaml
F: drivers/firmware/psci/
F: drivers/firmware/psci/psci-devices.c
+F: drivers/power/reset/psci-reboot-mode.c
F: include/linux/psci.h
F: include/uapi/linux/psci.h
diff --git a/drivers/firmware/psci/psci-devices.c b/drivers/firmware/psci/psci-devices.c
index f1eca61e3269..43e6743202f9 100644
--- a/drivers/firmware/psci/psci-devices.c
+++ b/drivers/firmware/psci/psci-devices.c
@@ -4,19 +4,86 @@
*/
#include <linux/auxiliary_bus.h>
+#include <linux/device.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/psci.h>
+#include <linux/slab.h>
+
+static void arm_psci_auxiliary_device_release(struct device *dev)
+{
+ struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
+
+ of_node_put(dev->of_node);
+ kfree(auxdev);
+}
+
+static struct auxiliary_device *
+arm_psci_auxiliary_device_create(struct device *dev, const char *devname,
+ struct device_node *np)
+{
+ struct auxiliary_device *auxdev;
+ int ret;
+
+ auxdev = kzalloc_obj(*auxdev);
+ if (!auxdev)
+ return NULL;
+
+ auxdev->id = 0;
+ auxdev->name = devname;
+ auxdev->dev.parent = dev;
+ auxdev->dev.release = arm_psci_auxiliary_device_release;
+
+ if (np)
+ device_set_node(&auxdev->dev, of_fwnode_handle(of_node_get(np)));
+
+ ret = auxiliary_device_init(auxdev);
+ if (ret) {
+ of_node_put(auxdev->dev.of_node);
+ kfree(auxdev);
+ return NULL;
+ }
+
+ ret = __auxiliary_device_add(auxdev, "arm-psci");
+ if (ret) {
+ auxiliary_device_uninit(auxdev);
+ return NULL;
+ }
+
+ ret = devm_add_action_or_reset(dev, auxiliary_device_destroy, auxdev);
+ if (ret)
+ return NULL;
+
+ return auxdev;
+}
static int arm_psci_probe(struct platform_device *pdev)
{
struct auxiliary_device *auxdev;
+#ifdef CONFIG_PSCI_REBOOT_MODE
+ struct device_node *reboot_mode_np = NULL;
+#endif
- auxdev = __devm_auxiliary_device_create(&pdev->dev, "arm-psci",
- "psci-cpuidle-domain", NULL, 0);
+ auxdev = arm_psci_auxiliary_device_create(&pdev->dev,
+ "psci-cpuidle-domain",
+ pdev->dev.of_node);
if (!auxdev)
return -ENOMEM;
+#ifdef CONFIG_PSCI_REBOOT_MODE
+ if (psci_has_system_reset2_support())
+ reboot_mode_np = of_get_child_by_name(pdev->dev.of_node,
+ "reboot-mode");
+
+ auxdev = arm_psci_auxiliary_device_create(&pdev->dev,
+ "psci-reboot-mode",
+ reboot_mode_np);
+ of_node_put(reboot_mode_np);
+ if (!auxdev)
+ dev_warn(&pdev->dev, "failed to create PSCI reboot mode device\n");
+#endif
+
return 0;
}
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index bce996bbef28..5c349f41e097 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -360,6 +360,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 ARM_PSCI_DEVICES
+ select REBOOT_MODE
+ help
+ Say y here to enable the PSCI reboot mode driver. The driver
+ registers with the reboot-mode framework to configure PSCI
+ reset commands, which are executed by the PSCI driver during
+ psci_sys_reset().
+
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 e31cab4ba78e..45d8aaaffaa1 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -41,5 +41,6 @@ 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
obj-$(CONFIG_POWER_RESET_QEMU_VIRT_CTRL) += qemu-virt-ctrl.o
diff --git a/drivers/power/reset/psci-reboot-mode.c b/drivers/power/reset/psci-reboot-mode.c
new file mode 100644
index 000000000000..bf2dd6626feb
--- /dev/null
+++ b/drivers/power/reset/psci-reboot-mode.c
@@ -0,0 +1,104 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include <linux/array_size.h>
+#include <linux/auxiliary_bus.h>
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/kconfig.h>
+#include <linux/module.h>
+#include <linux/psci.h>
+#include <linux/reboot-mode.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+
+/*
+ * Predefined modes use two arguments. arg1/magic[0] is always zero and
+ * arg2/magic[1] is one of the values defined by enum psci_standard_resets.
+ */
+static const struct reboot_mode_entry psci_resets[] = {
+ {
+ .name = "psci-system-reset",
+ .magic = { 0, PSCI_SYSTEM_RESET_COLD_RESET },
+ .count = 2,
+ },
+ {
+ .name = "psci-system-reset2-arch-warm-reset",
+ .magic = { 0, PSCI_SYSTEM_RESET2_ARCH_WARM_RESET },
+ .count = 2,
+ },
+};
+
+static u64 psci_reboot_mode_get_cookie(const u32 *magic, int count)
+{
+ u64 cookie = 0;
+ int i;
+
+ /*
+ * For a 3-cell magic, arg2 is the high 32 bits and arg3 is the low 32 bits.
+ * For a 2-cell magic, arg2 is the low 32 bits.
+ */
+ for (i = 1; i < count; i++)
+ cookie = (cookie << 32) | magic[i];
+
+ return cookie;
+}
+
+static int psci_reboot_mode_write(struct reboot_mode_driver *reboot,
+ const u32 *magic, u32 count)
+{
+ if (count < 2 || count > 3)
+ return -EINVAL;
+
+ /* Unexpected value at magic[1]/arg2 on a 32-bit system. */
+ if (!IS_ENABLED(CONFIG_64BIT) && count == 3 && magic[1])
+ return -EINVAL;
+
+ return psci_set_reset_cmd(magic[0],
+ psci_reboot_mode_get_cookie(magic, count));
+}
+
+static int psci_reboot_mode_probe(struct auxiliary_device *auxdev,
+ const struct auxiliary_device_id *id)
+{
+ struct reboot_mode_driver *reboot;
+ struct device *dev = &auxdev->dev;
+ size_t count;
+ int ret;
+
+ reboot = devm_kzalloc(dev, sizeof(*reboot), GFP_KERNEL);
+ if (!reboot)
+ return -ENOMEM;
+
+ /* Skip PSCI SYSTEM_RESET2 modes if unsupported. */
+ count = psci_has_system_reset2_support() ? ARRAY_SIZE(psci_resets) : 1;
+
+ ret = reboot_mode_driver_init(reboot, dev, NULL,
+ psci_reboot_mode_write, psci_resets,
+ count);
+ if (ret)
+ return ret;
+
+ return devm_reboot_mode_register(dev, reboot);
+}
+
+static const struct auxiliary_device_id psci_reboot_mode_id_table[] = {
+ { .name = "arm-psci.psci-reboot-mode" },
+ { }
+};
+MODULE_DEVICE_TABLE(auxiliary, psci_reboot_mode_id_table);
+
+static struct auxiliary_driver psci_reboot_mode_driver = {
+ .probe = psci_reboot_mode_probe,
+ .id_table = psci_reboot_mode_id_table,
+};
+
+static int __init psci_reboot_mode_init(void)
+{
+ return __auxiliary_driver_register(&psci_reboot_mode_driver, THIS_MODULE,
+ "psci-reboot-mode");
+}
+subsys_initcall(psci_reboot_mode_init);
--
2.34.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v25 07/10] arm64: dts: qcom: Add psci reboot-modes for kodiak boards
2026-09-14 14:59 [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (5 preceding siblings ...)
2026-09-14 14:59 ` [PATCH v25 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
@ 2026-09-14 14:59 ` Shivendra Pratap
2026-09-14 15:24 ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 08/10] arm64: dts: qcom: Add psci reboot-modes for lemans boards Shivendra Pratap
` (2 subsequent siblings)
9 siblings, 1 reply; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-14 14:59 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Matthias Brugger, Mark Rutland,
Conor Dooley, Konrad Dybcio, John Stultz, Moritz Fischer,
Rafael J. Wysocki, Daniel Lezcano, Christian Loehle, Lee Jones,
Ulf Hansson, Pavan Kondeti, Abel Vesa, Bartosz Golaszewski,
Sudeep Holla, Ulf Hansson
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, Shivendra Pratap,
Srinivas Kandagatla, Bartosz Golaszewski
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 kodiak based boards.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
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 347815e5983e..307fc45af37a 100644
--- a/arch/arm64/boot/dts/qcom/kodiak.dtsi
+++ b/arch/arm64/boot/dts/qcom/kodiak.dtsi
@@ -867,7 +867,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 58cce89a0c1c..c9c1b0c48550 100644
--- a/arch/arm64/boot/dts/qcom/qcm6490-idp.dts
+++ b/arch/arm64/boot/dts/qcom/qcm6490-idp.dts
@@ -786,6 +786,13 @@ &qup_uart7_tx {
bias-disable;
};
+&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 3bb5fca8e2b1..a107abee10c3 100644
--- a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
+++ b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
@@ -1097,6 +1097,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] 26+ messages in thread
* [PATCH v25 08/10] arm64: dts: qcom: Add psci reboot-modes for lemans boards
2026-09-14 14:59 [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (6 preceding siblings ...)
2026-09-14 14:59 ` [PATCH v25 07/10] arm64: dts: qcom: Add psci reboot-modes for kodiak boards Shivendra Pratap
@ 2026-09-14 14:59 ` Shivendra Pratap
2026-09-14 15:28 ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 09/10] arm64: dts: qcom: Add psci reboot-modes for monaco boards Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 10/10] arm64: dts: qcom: Add psci reboot-modes for talos boards Shivendra Pratap
9 siblings, 1 reply; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-14 14:59 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Matthias Brugger, Mark Rutland,
Conor Dooley, Konrad Dybcio, John Stultz, Moritz Fischer,
Rafael J. Wysocki, Daniel Lezcano, Christian Loehle, Lee Jones,
Ulf Hansson, Pavan Kondeti, Abel Vesa, Bartosz Golaszewski,
Sudeep Holla, Ulf Hansson
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, Shivendra Pratap,
Srinivas Kandagatla, Bartosz Golaszewski
Add PSCI SYSTEM_RESET2 reboot-modes for lemans-evk and
lemans-ride-common(sa8775p-ride, sa8775p-ride-r3, qcs9100-ride,
qcs9100-ride-r3) 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.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/lemans-evk.dts | 7 +++++++
arch/arm64/boot/dts/qcom/lemans-ride-common.dtsi | 7 +++++++
arch/arm64/boot/dts/qcom/lemans.dtsi | 2 +-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/lemans-evk.dts b/arch/arm64/boot/dts/qcom/lemans-evk.dts
index a45485b54a5b..87d01acc7b5a 100644
--- a/arch/arm64/boot/dts/qcom/lemans-evk.dts
+++ b/arch/arm64/boot/dts/qcom/lemans-evk.dts
@@ -911,6 +911,13 @@ usb2_id: usb2-id-state {
};
};
+&psci {
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
+};
+
&qup_i2c19_default {
drive-strength = <2>;
bias-pull-up;
diff --git a/arch/arm64/boot/dts/qcom/lemans-ride-common.dtsi b/arch/arm64/boot/dts/qcom/lemans-ride-common.dtsi
index 144f117ba511..0adf9f02c8cf 100644
--- a/arch/arm64/boot/dts/qcom/lemans-ride-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/lemans-ride-common.dtsi
@@ -800,6 +800,13 @@ &pmm8654au_3_gpios {
"GNSS_BOOT_MODE";
};
+&psci {
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
+};
+
&qupv3_id_1 {
status = "okay";
};
diff --git a/arch/arm64/boot/dts/qcom/lemans.dtsi b/arch/arm64/boot/dts/qcom/lemans.dtsi
index 695eae1b7256..f0633b81a04d 100644
--- a/arch/arm64/boot/dts/qcom/lemans.dtsi
+++ b/arch/arm64/boot/dts/qcom/lemans.dtsi
@@ -550,7 +550,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] 26+ messages in thread
* [PATCH v25 09/10] arm64: dts: qcom: Add psci reboot-modes for monaco boards
2026-09-14 14:59 [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (7 preceding siblings ...)
2026-09-14 14:59 ` [PATCH v25 08/10] arm64: dts: qcom: Add psci reboot-modes for lemans boards Shivendra Pratap
@ 2026-09-14 14:59 ` Shivendra Pratap
2026-09-14 15:25 ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 10/10] arm64: dts: qcom: Add psci reboot-modes for talos boards Shivendra Pratap
9 siblings, 1 reply; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-14 14:59 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Matthias Brugger, Mark Rutland,
Conor Dooley, Konrad Dybcio, John Stultz, Moritz Fischer,
Rafael J. Wysocki, Daniel Lezcano, Christian Loehle, Lee Jones,
Ulf Hansson, Pavan Kondeti, Abel Vesa, Bartosz Golaszewski,
Sudeep Holla, Ulf Hansson
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, Shivendra Pratap,
Srinivas Kandagatla, Bartosz Golaszewski
Add PSCI SYSTEM_RESET2 reboot-modes for monaco-evk and
qcs8300-ride 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.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/monaco-evk.dts | 7 +++++++
arch/arm64/boot/dts/qcom/monaco.dtsi | 2 +-
arch/arm64/boot/dts/qcom/qcs8300-ride.dts | 7 +++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/monaco-evk.dts b/arch/arm64/boot/dts/qcom/monaco-evk.dts
index 9d17ef7d2caf..df668dbf2bc6 100644
--- a/arch/arm64/boot/dts/qcom/monaco-evk.dts
+++ b/arch/arm64/boot/dts/qcom/monaco-evk.dts
@@ -661,6 +661,13 @@ usb2_id: usb2-id-state {
};
};
+&psci {
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
+};
+
&qup_i2c0_data_clk {
drive-strength = <2>;
bias-pull-up;
diff --git a/arch/arm64/boot/dts/qcom/monaco.dtsi b/arch/arm64/boot/dts/qcom/monaco.dtsi
index 395d32d36844..9f1ab59dee2d 100644
--- a/arch/arm64/boot/dts/qcom/monaco.dtsi
+++ b/arch/arm64/boot/dts/qcom/monaco.dtsi
@@ -654,7 +654,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/qcs8300-ride.dts b/arch/arm64/boot/dts/qcom/qcs8300-ride.dts
index 1ff39530ea3d..aa95584b000d 100644
--- a/arch/arm64/boot/dts/qcom/qcs8300-ride.dts
+++ b/arch/arm64/boot/dts/qcom/qcs8300-ride.dts
@@ -678,6 +678,13 @@ &mdss_dsi0_out {
remote-endpoint = <&dsi2dp_bridge_in>;
};
+&psci {
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
+};
+
&qupv3_id_0 {
status = "okay";
};
--
2.34.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v25 10/10] arm64: dts: qcom: Add psci reboot-modes for talos boards
2026-09-14 14:59 [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
` (8 preceding siblings ...)
2026-09-14 14:59 ` [PATCH v25 09/10] arm64: dts: qcom: Add psci reboot-modes for monaco boards Shivendra Pratap
@ 2026-09-14 14:59 ` Shivendra Pratap
2026-09-14 15:27 ` sashiko-bot
9 siblings, 1 reply; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-14 14:59 UTC (permalink / raw)
To: Lorenzo Pieralisi, Arnd Bergmann, Bjorn Andersson,
Sebastian Reichel, Rob Herring, Souvik Chakravarty,
Krzysztof Kozlowski, Andy Yan, Matthias Brugger, Mark Rutland,
Conor Dooley, Konrad Dybcio, John Stultz, Moritz Fischer,
Rafael J. Wysocki, Daniel Lezcano, Christian Loehle, Lee Jones,
Ulf Hansson, Pavan Kondeti, Abel Vesa, Bartosz Golaszewski,
Sudeep Holla, Ulf Hansson
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, Shivendra Pratap,
Srinivas Kandagatla, Bartosz Golaszewski, Song Xue
Add PSCI SYSTEM_RESET2 reboot-modes for qcs615-ride, 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.
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Song Xue <quic_songxue@quicinc.com>
Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/qcs615-ride.dts | 7 +++++++
arch/arm64/boot/dts/qcom/talos.dtsi | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/qcs615-ride.dts b/arch/arm64/boot/dts/qcom/qcs615-ride.dts
index 047b4efb04b9..48d3519f50ff 100644
--- a/arch/arm64/boot/dts/qcom/qcs615-ride.dts
+++ b/arch/arm64/boot/dts/qcom/qcs615-ride.dts
@@ -498,6 +498,13 @@ &pon_resin {
status = "okay";
};
+&psci {
+ reboot-mode {
+ mode-bootloader = <0x80010001 0x2>;
+ mode-edl = <0x80000000 0x1>;
+ };
+};
+
&qspi {
status = "okay";
diff --git a/arch/arm64/boot/dts/qcom/talos.dtsi b/arch/arm64/boot/dts/qcom/talos.dtsi
index 531cf41b94dc..a2197dec430a 100644
--- a/arch/arm64/boot/dts/qcom/talos.dtsi
+++ b/arch/arm64/boot/dts/qcom/talos.dtsi
@@ -581,7 +581,7 @@ pmu-a76 {
interrupts = <GIC_PPI 5 IRQ_TYPE_LEVEL_HIGH &ppi_cluster1>;
};
- psci {
+ psci: psci {
compatible = "arm,psci-1.0";
method = "smc";
--
2.34.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [PATCH v25 01/10] power: reset: reboot-mode: Support up to 3 magic values per mode
2026-09-14 14:59 ` [PATCH v25 01/10] power: reset: reboot-mode: Support up to 3 magic values per mode Shivendra Pratap
@ 2026-09-14 15:09 ` sashiko-bot
0 siblings, 0 replies; 26+ messages in thread
From: sashiko-bot @ 2026-09-14 15:09 UTC (permalink / raw)
To: Shivendra Pratap; +Cc: conor+dt, devicetree, lee, robh, mfd
> ARM PSCI vendor-specific resets, require a 32-bit reset_type and a 64-bit
> cookie as arguments. This cannot be implemented via the reboot-mode
> framework, which supports a single 32-bit argument as magic value.
>
> Extend the reboot-mode framework to support up to three 32-bit arguments
> as magic, per reboot-mode.
>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-arm-psci-system_reset2-vendor-reboots-v25-0-4aaf5c09b5c2@oss.qualcomm.com?part=1
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 02/10] power: reset: reboot-mode: Add support for predefined reboot modes
2026-09-14 14:59 ` [PATCH v25 02/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
@ 2026-09-14 15:12 ` sashiko-bot
2026-09-15 13:54 ` Shivendra Pratap
0 siblings, 1 reply; 26+ messages in thread
From: sashiko-bot @ 2026-09-14 15:12 UTC (permalink / raw)
To: Shivendra Pratap; +Cc: conor+dt, lee, devicetree, robh, mfd
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Predefined modes overlapping with DT-defined modes cause duplicate entries in the sysfs `reboot_modes` attribute.
--
commit 394fababa44a1d093815c91cc11774a6de1c1f6b
Author: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
power: reset: reboot-mode: Add support for predefined reboot modes
Extend the reboot-mode framework to support driver-defined predefined reboot
modes. Add a centralized initcall to initialize driver state along with
predefined modes.
> diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
> index 328fa37598df3..fd61de2263836 100644
> --- a/drivers/power/reset/reboot-mode.c
> +++ b/drivers/power/reset/reboot-mode.c
[ ... ]
> @@ -160,11 +234,38 @@ static int reboot_mode_create_device(struct reboot_mode_driver *reboot)
> return 0;
>
> error:
> - reboot_mode_release_list(priv);
> + reboot_mode_release_list(&priv->head);
> kfree(priv);
> return ret;
> }
>
> +static int reboot_mode_add_predefined_modes(struct reboot_mode_driver *reboot)
> +{
> + const struct reboot_mode_entry *modes = reboot->predefined_modes;
> + struct mode_info *info;
> + size_t i;
> +
> + if (!modes)
> + return 0;
> +
> + for (i = 0; i < reboot->predefined_mode_count; i++) {
> + if (modes[i].name && strpbrk(modes[i].name, "\n ,/"))
> + return -EINVAL;
> +
> + if (!modes[i].count || modes[i].count > ARRAY_SIZE(modes[i].magic))
> + return -EINVAL;
> +
> + info = reboot_mode_create_info(reboot->dev, modes[i].name,
> + modes[i].magic, modes[i].count);
> + if (IS_ERR(info))
> + return PTR_ERR(info);
> +
> + list_add_tail(&info->list, &reboot->head);
[Severity: Medium]
Will this lead to duplicate string entries in the sysfs reboot_modes
attribute?
If a reboot mode provided by the Device Tree has the same name as one of the
driver's predefined modes, reboot_mode_register() parses the DT property and
adds it to the reboot->head list first.
Immediately after, reboot_mode_add_predefined_modes() blindly appends the
predefined mode to the same list here without checking if an entry with that
name already exists.
The duplicate entries are unconditionally propagated to the sysfs structure in
reboot_mode_create_device(). This will cause reboot_modes_show() to print
all modes sequentially, resulting in duplicate strings in sysfs when userspace
reads the /sys/class/reboot-mode/.../reboot_modes file.
> + }
> +
> + return 0;
> +}
> +
> /**
> * reboot_mode_register - register a reboot mode driver
> * @reboot: reboot mode driver
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-arm-psci-system_reset2-vendor-reboots-v25-0-4aaf5c09b5c2@oss.qualcomm.com?part=2
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 03/10] firmware: psci: Introduce command-based resets
2026-09-14 14:59 ` [PATCH v25 03/10] firmware: psci: Introduce command-based resets Shivendra Pratap
@ 2026-09-14 15:14 ` sashiko-bot
2026-09-15 14:02 ` Shivendra Pratap
0 siblings, 1 reply; 26+ messages in thread
From: sashiko-bot @ 2026-09-14 15:14 UTC (permalink / raw)
To: Shivendra Pratap; +Cc: conor+dt, devicetree, lee, robh, mfd
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The restart handler `psci_sys_reset()` unintentionally skips configured reset commands for standard reboots due to checking if `data` is non-NULL.
--
commit 15791809d0deec27e24e64483b3317dacb5842a5
Author: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
firmware: psci: Introduce command-based resets
This commit introduces a command-based reset mechanism allowing reboot-mode
drivers to specify custom PSCI reset commands like vendor-specific
SYSTEM_RESET2. It defaults to the existing reboot_mode flow unless a valid
reset command is configured.
> diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
> index e73bae6cb23a3..d489ba5d147ce 100644
> --- a/drivers/firmware/psci/psci.c
> +++ b/drivers/firmware/psci/psci.c
[ ... ]
> @@ -320,6 +409,30 @@ static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
[ ... ]
> +static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
> + void *data)
> +{
> + const struct psci_system_reset_cmd *cmd;
> +
> + /* The function psci_handle_reboot_mode follows reboot_mode based
> + * reset flow and psci_handle_reset_cmd uses reset_cmd based reset flow.
> + *
> + * The reset_cmd is configured at the reboot_notifier phase.
> + * If panic() or emergency_restart() occurs between the reboot_notifier
> + * and this final reset, skip command-based reset and let reboot_mode drive
> + * the reset flow.
> + *
> + * The function psci_handle_reset_cmd invokes non-returning PSCI SYSTEM_RESET
> + * calls to reset the device. If it returns, either the reset failed, or the
> + * command was unsupported. Fallback to reboot_mode based reset flow.
> + */
> + cmd = smp_load_acquire(&reset_cmd);
> + if (data && cmd && !panic_in_progress())
> + psci_handle_reset_cmd(cmd);
[Severity: High]
Will this check unintentionally skip custom reset commands during a standard
reboot?
When a standard userspace reboot is triggered via the reboot syscall with
LINUX_REBOOT_CMD_RESTART, the reboot sequence ultimately calls
kernel_restart(NULL).
This propagates down to the atomic restart notifier chain in
do_kernel_restart(NULL), which passes a NULL command pointer to the notifier
handlers.
In psci_sys_reset(), the data parameter receives this NULL pointer. Because
of the check for a non-NULL data variable, the condition evaluates to false,
causing the handler to skip psci_handle_reset_cmd(). It then incorrectly
falls back to psci_handle_reboot_mode(), even if a valid command was
successfully configured by a reboot-mode driver.
Is the data check acting contrary to the commit message's goal of ignoring
reset commands during panic and emergency_restart?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-arm-psci-system_reset2-vendor-reboots-v25-0-4aaf5c09b5c2@oss.qualcomm.com?part=3
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 05/10] dt-bindings: arm: Document reboot mode magic
2026-09-14 14:59 ` [PATCH v25 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
@ 2026-09-14 15:19 ` sashiko-bot
0 siblings, 0 replies; 26+ messages in thread
From: sashiko-bot @ 2026-09-14 15:19 UTC (permalink / raw)
To: Shivendra Pratap; +Cc: devicetree, lee, robh, conor+dt, mfd
> Add bindings to describe vendor-specific reboot modes. Values here
> correspond to valid parameters to vendor-specific reset types in PSCI
> SYSTEM_RESET2 call.
>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-arm-psci-system_reset2-vendor-reboots-v25-0-4aaf5c09b5c2@oss.qualcomm.com?part=5
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 06/10] power: reset: Add psci-reboot-mode driver
2026-09-14 14:59 ` [PATCH v25 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
@ 2026-09-14 15:21 ` sashiko-bot
2026-09-16 9:23 ` Bartosz Golaszewski
1 sibling, 0 replies; 26+ messages in thread
From: sashiko-bot @ 2026-09-14 15:21 UTC (permalink / raw)
To: Shivendra Pratap; +Cc: robh, devicetree, conor+dt, mfd, lee
> PSCI supports different types of resets like SYSTEM_RESET, SYSTEM_RESET2
> ARCH WARM reset and SYSTEM_RESET2 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 psci-reboot-mode as an auxiliary device created by the psci-devices
> driver. Define two types of PSCI resets, predefined-resets and
> vendor-specific resets. Predefined-resets are defined by psci driver
> and vendor-specific resets are defined by SoC vendors, under the
> psci:reboot-mode node of SoC device tree.
>
> 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.
>
> Suggested-by: Ulf Hansson <ulf.hansson@oss.qualcomm.com>
> Suggested-by: Lee Jones <lee@kernel.org>
> Suggested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-arm-psci-system_reset2-vendor-reboots-v25-0-4aaf5c09b5c2@oss.qualcomm.com?part=6
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 04/10] firmware: psci: Add support for PSCI auxiliary devices
2026-09-14 14:59 ` [PATCH v25 04/10] firmware: psci: Add support for PSCI auxiliary devices Shivendra Pratap
@ 2026-09-14 15:21 ` sashiko-bot
2026-09-16 9:29 ` Bartosz Golaszewski
1 sibling, 0 replies; 26+ messages in thread
From: sashiko-bot @ 2026-09-14 15:21 UTC (permalink / raw)
To: Shivendra Pratap; +Cc: robh, conor+dt, devicetree, mfd, lee
> PSCI has multiple kernel consumers, such as cpuidle-psci-domain.
> Currently, both the PSCI core driver and cpuidle-psci-domain bind
> directly to the same PSCI node "arm,psci-1.0". Additional consumers, if
> introduced, would also need to bind in the same way, leading to multiple
> drivers attached to a single device node.
>
> Introduce a PSCI auxiliary-device provider that binds to "arm,psci-1.0"
> and registers PSCI child devices on the auxiliary bus. As the first
> user, register cpuidle-psci-domain as an auxiliary device.
>
> Update cpuidle-psci-domain to probe as an auxiliary driver and use
> the PSCI device node for power-domain traversal.
>
> Suggested-by: Ulf Hansson <ulf.hansson@oss.qualcomm.com>
> Suggested-by: Lee Jones <lee@kernel.org>
> Suggested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-arm-psci-system_reset2-vendor-reboots-v25-0-4aaf5c09b5c2@oss.qualcomm.com?part=4
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 07/10] arm64: dts: qcom: Add psci reboot-modes for kodiak boards
2026-09-14 14:59 ` [PATCH v25 07/10] arm64: dts: qcom: Add psci reboot-modes for kodiak boards Shivendra Pratap
@ 2026-09-14 15:24 ` sashiko-bot
0 siblings, 0 replies; 26+ messages in thread
From: sashiko-bot @ 2026-09-14 15:24 UTC (permalink / raw)
To: Shivendra Pratap; +Cc: conor+dt, devicetree, robh, mfd, lee
> 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 kodiak based boards.
>
> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-arm-psci-system_reset2-vendor-reboots-v25-0-4aaf5c09b5c2@oss.qualcomm.com?part=7
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 09/10] arm64: dts: qcom: Add psci reboot-modes for monaco boards
2026-09-14 14:59 ` [PATCH v25 09/10] arm64: dts: qcom: Add psci reboot-modes for monaco boards Shivendra Pratap
@ 2026-09-14 15:25 ` sashiko-bot
0 siblings, 0 replies; 26+ messages in thread
From: sashiko-bot @ 2026-09-14 15:25 UTC (permalink / raw)
To: Shivendra Pratap; +Cc: lee, devicetree, robh, conor+dt, mfd
> Add PSCI SYSTEM_RESET2 reboot-modes for monaco-evk and
> qcs8300-ride 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.
>
> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-arm-psci-system_reset2-vendor-reboots-v25-0-4aaf5c09b5c2@oss.qualcomm.com?part=9
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 10/10] arm64: dts: qcom: Add psci reboot-modes for talos boards
2026-09-14 14:59 ` [PATCH v25 10/10] arm64: dts: qcom: Add psci reboot-modes for talos boards Shivendra Pratap
@ 2026-09-14 15:27 ` sashiko-bot
0 siblings, 0 replies; 26+ messages in thread
From: sashiko-bot @ 2026-09-14 15:27 UTC (permalink / raw)
To: Shivendra Pratap; +Cc: conor+dt, devicetree, robh, mfd, lee
> Add PSCI SYSTEM_RESET2 reboot-modes for qcs615-ride, 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.
>
> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> Signed-off-by: Song Xue <quic_songxue@quicinc.com>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-arm-psci-system_reset2-vendor-reboots-v25-0-4aaf5c09b5c2@oss.qualcomm.com?part=10
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 08/10] arm64: dts: qcom: Add psci reboot-modes for lemans boards
2026-09-14 14:59 ` [PATCH v25 08/10] arm64: dts: qcom: Add psci reboot-modes for lemans boards Shivendra Pratap
@ 2026-09-14 15:28 ` sashiko-bot
0 siblings, 0 replies; 26+ messages in thread
From: sashiko-bot @ 2026-09-14 15:28 UTC (permalink / raw)
To: Shivendra Pratap; +Cc: robh, mfd, lee, conor+dt, devicetree
> Add PSCI SYSTEM_RESET2 reboot-modes for lemans-evk and
> lemans-ride-common(sa8775p-ride, sa8775p-ride-r3, qcs9100-ride,
> qcs9100-ride-r3) 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.
>
> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260914-arm-psci-system_reset2-vendor-reboots-v25-0-4aaf5c09b5c2@oss.qualcomm.com?part=8
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 02/10] power: reset: reboot-mode: Add support for predefined reboot modes
2026-09-14 15:12 ` sashiko-bot
@ 2026-09-15 13:54 ` Shivendra Pratap
0 siblings, 0 replies; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-15 13:54 UTC (permalink / raw)
To: sashiko-reviews, Sebastian Reichel; +Cc: conor+dt, lee, devicetree, robh, mfd
On 9/14/2026 8:42 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Predefined modes overlapping with DT-defined modes cause duplicate entries in the sysfs `reboot_modes` attribute.
> --
>
> commit 394fababa44a1d093815c91cc11774a6de1c1f6b
> Author: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
>
> power: reset: reboot-mode: Add support for predefined reboot modes
>
> Extend the reboot-mode framework to support driver-defined predefined reboot
> modes. Add a centralized initcall to initialize driver state along with
> predefined modes.
>
>> diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
>> index 328fa37598df3..fd61de2263836 100644
>> --- a/drivers/power/reset/reboot-mode.c
>> +++ b/drivers/power/reset/reboot-mode.c
>
> [ ... ]
>
>> @@ -160,11 +234,38 @@ static int reboot_mode_create_device(struct reboot_mode_driver *reboot)
>> return 0;
>>
>> error:
>> - reboot_mode_release_list(priv);
>> + reboot_mode_release_list(&priv->head);
>> kfree(priv);
>> return ret;
>> }
>>
>> +static int reboot_mode_add_predefined_modes(struct reboot_mode_driver *reboot)
>> +{
>> + const struct reboot_mode_entry *modes = reboot->predefined_modes;
>> + struct mode_info *info;
>> + size_t i;
>> +
>> + if (!modes)
>> + return 0;
>> +
>> + for (i = 0; i < reboot->predefined_mode_count; i++) {
>> + if (modes[i].name && strpbrk(modes[i].name, "\n ,/"))
>> + return -EINVAL;
>> +
>> + if (!modes[i].count || modes[i].count > ARRAY_SIZE(modes[i].magic))
>> + return -EINVAL;
>> +
>> + info = reboot_mode_create_info(reboot->dev, modes[i].name,
>> + modes[i].magic, modes[i].count);
>> + if (IS_ERR(info))
>> + return PTR_ERR(info);
>> +
>> + list_add_tail(&info->list, &reboot->head);
>
> [Severity: Medium]
> Will this lead to duplicate string entries in the sysfs reboot_modes
> attribute?
>
> If a reboot mode provided by the Device Tree has the same name as one of the
> driver's predefined modes, reboot_mode_register() parses the DT property and
> adds it to the reboot->head list first.
>
> Immediately after, reboot_mode_add_predefined_modes() blindly appends the
> predefined mode to the same list here without checking if an entry with that
> name already exists.
>
> The duplicate entries are unconditionally propagated to the sysfs structure in
> reboot_mode_create_device(). This will cause reboot_modes_show() to print
> all modes sequentially, resulting in duplicate strings in sysfs when userspace
> reads the /sys/class/reboot-mode/.../reboot_modes file.
The reboot-mode header adds a note that DT-defined mode will take
precedence, if a duplicate mode-name is present in both "DT list" and
the "pre-defined list".
We can add a duplicate check here, but would like the view of other
reviewers on this.
thanks,
Shivendra
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 03/10] firmware: psci: Introduce command-based resets
2026-09-14 15:14 ` sashiko-bot
@ 2026-09-15 14:02 ` Shivendra Pratap
2026-09-15 14:05 ` Shivendra Pratap
0 siblings, 1 reply; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-15 14:02 UTC (permalink / raw)
To: sashiko-reviews; +Cc: conor+dt, devicetree, lee, robh, mfd
On 9/14/2026 8:44 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] The restart handler `psci_sys_reset()` unintentionally skips configured reset commands for standard reboots due to checking if `data` is non-NULL.
> --
>
> commit 15791809d0deec27e24e64483b3317dacb5842a5
> Author: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
>
> firmware: psci: Introduce command-based resets
>
> This commit introduces a command-based reset mechanism allowing reboot-mode
> drivers to specify custom PSCI reset commands like vendor-specific
> SYSTEM_RESET2. It defaults to the existing reboot_mode flow unless a valid
> reset command is configured.
>
>> diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
>> index e73bae6cb23a3..d489ba5d147ce 100644
>> --- a/drivers/firmware/psci/psci.c
>> +++ b/drivers/firmware/psci/psci.c
>
> [ ... ]
>
>> @@ -320,6 +409,30 @@ static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
>
> [ ... ]
>
>> +static int psci_sys_reset(struct notifier_block *nb, unsigned long action,
>> + void *data)
>> +{
>> + const struct psci_system_reset_cmd *cmd;
>> +
>> + /* The function psci_handle_reboot_mode follows reboot_mode based
>> + * reset flow and psci_handle_reset_cmd uses reset_cmd based reset flow.
>> + *
>> + * The reset_cmd is configured at the reboot_notifier phase.
>> + * If panic() or emergency_restart() occurs between the reboot_notifier
>> + * and this final reset, skip command-based reset and let reboot_mode drive
>> + * the reset flow.
>> + *
>> + * The function psci_handle_reset_cmd invokes non-returning PSCI SYSTEM_RESET
>> + * calls to reset the device. If it returns, either the reset failed, or the
>> + * command was unsupported. Fallback to reboot_mode based reset flow.
>> + */
>> + cmd = smp_load_acquire(&reset_cmd);
>> + if (data && cmd && !panic_in_progress())
>> + psci_handle_reset_cmd(cmd);
>
> [Severity: High]
> Will this check unintentionally skip custom reset commands during a standard
> reboot?
By design - Normal reboot with NULL command should go through regular
reboot flow of psci_sys_reset.
>
> When a standard userspace reboot is triggered via the reboot syscall with
> LINUX_REBOOT_CMD_RESTART, the reboot sequence ultimately calls
> kernel_restart(NULL).
>
> This propagates down to the atomic restart notifier chain in
> do_kernel_restart(NULL), which passes a NULL command pointer to the notifier
> handlers.
>
> In psci_sys_reset(), the data parameter receives this NULL pointer. Because
> of the check for a non-NULL data variable, the condition evaluates to false,
> causing the handler to skip psci_handle_reset_cmd().
Yes, do_kernel_restart(NULL) should take regular reboot flow and ignore
any pre-set commands.
> It then incorrectly
> falls back to psci_handle_reboot_mode(), even if a valid command was
> successfully configured by a reboot-mode driver.
>
> Is the data check acting contrary to the commit message's goal of ignoring
> reset commands during panic and emergency_restart?
>
If the commit message is not clear, i can add a line to it, stating the
same.
thanks,
Shivendra
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 03/10] firmware: psci: Introduce command-based resets
2026-09-15 14:02 ` Shivendra Pratap
@ 2026-09-15 14:05 ` Shivendra Pratap
0 siblings, 0 replies; 26+ messages in thread
From: Shivendra Pratap @ 2026-09-15 14:05 UTC (permalink / raw)
To: sashiko-reviews, Lorenzo Pieralisi, Arnd Bergmann
Cc: conor+dt, devicetree, lee, robh, mfd
On 9/15/2026 7:32 PM, Shivendra Pratap wrote:
>
>
> On 9/14/2026 8:44 PM, sashiko-bot@kernel.org wrote:
>> Thank you for your contribution! Sashiko AI review found 1 potential
>> issue(s) to consider:
>> - [High] The restart handler `psci_sys_reset()` unintentionally skips
>> configured reset commands for standard reboots due to checking if
>> `data` is non-NULL.
>> --
>>
>> commit 15791809d0deec27e24e64483b3317dacb5842a5
>> Author: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
>>
>> firmware: psci: Introduce command-based resets
>>
>> This commit introduces a command-based reset mechanism allowing
>> reboot-mode
>> drivers to specify custom PSCI reset commands like vendor-specific
>> SYSTEM_RESET2. It defaults to the existing reboot_mode flow unless a
>> valid
>> reset command is configured.
>>
>>> diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
>>> index e73bae6cb23a3..d489ba5d147ce 100644
>>> --- a/drivers/firmware/psci/psci.c
>>> +++ b/drivers/firmware/psci/psci.c
>>
>> [ ... ]
>>
>>> @@ -320,6 +409,30 @@ static int psci_sys_reset(struct notifier_block
>>> *nb, unsigned long action,
>>
>> [ ... ]
>>
>>> +static int psci_sys_reset(struct notifier_block *nb, unsigned long
>>> action,
>>> + void *data)
>>> +{
>>> + const struct psci_system_reset_cmd *cmd;
>>> +
>>> + /* The function psci_handle_reboot_mode follows reboot_mode based
>>> + * reset flow and psci_handle_reset_cmd uses reset_cmd based
>>> reset flow.
>>> + *
>>> + * The reset_cmd is configured at the reboot_notifier phase.
>>> + * If panic() or emergency_restart() occurs between the
>>> reboot_notifier
>>> + * and this final reset, skip command-based reset and let
>>> reboot_mode drive
>>> + * the reset flow.
>>> + *
>>> + * The function psci_handle_reset_cmd invokes non-returning PSCI
>>> SYSTEM_RESET
>>> + * calls to reset the device. If it returns, either the reset
>>> failed, or the
>>> + * command was unsupported. Fallback to reboot_mode based reset
>>> flow.
>>> + */
>>> + cmd = smp_load_acquire(&reset_cmd);
>>> + if (data && cmd && !panic_in_progress())
>>> + psci_handle_reset_cmd(cmd);
>>
>> [Severity: High]
>> Will this check unintentionally skip custom reset commands during a
>> standard
>> reboot?
>
> By design - Normal reboot with NULL command should go through regular
> reboot flow of psci_sys_reset.
>
>>
>> When a standard userspace reboot is triggered via the reboot syscall with
>> LINUX_REBOOT_CMD_RESTART, the reboot sequence ultimately calls
>> kernel_restart(NULL).
>>
>> This propagates down to the atomic restart notifier chain in
>> do_kernel_restart(NULL), which passes a NULL command pointer to the
>> notifier
>> handlers.
>>
>> In psci_sys_reset(), the data parameter receives this NULL pointer.
>> Because
>> of the check for a non-NULL data variable, the condition evaluates to
>> false,
>> causing the handler to skip psci_handle_reset_cmd().
>
> Yes, do_kernel_restart(NULL) should take regular reboot flow and ignore
> any pre-set commands.
>
>> It then incorrectly
>> falls back to psci_handle_reboot_mode(), even if a valid command was
>> successfully configured by a reboot-mode driver.
>>
>> Is the data check acting contrary to the commit message's goal of
>> ignoring
>> reset commands during panic and emergency_restart?
>>
>
> If the commit message is not clear, i can add a line to it, stating the
> same.
>
> thanks,
> Shivendra
Adding Lorenzo and Arnd for views on this review.
thanks,
Shivendra
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 06/10] power: reset: Add psci-reboot-mode driver
2026-09-14 14:59 ` [PATCH v25 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
2026-09-14 15:21 ` sashiko-bot
@ 2026-09-16 9:23 ` Bartosz Golaszewski
1 sibling, 0 replies; 26+ messages in thread
From: Bartosz Golaszewski @ 2026-09-16 9:23 UTC (permalink / raw)
To: Shivendra Pratap
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, Srinivas Kandagatla, Ulf Hansson,
Bartosz Golaszewski, Lorenzo Pieralisi, Arnd Bergmann,
Bjorn Andersson, Sebastian Reichel, Rob Herring,
Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan,
Matthias Brugger, Mark Rutland, Conor Dooley, Konrad Dybcio,
John Stultz, Moritz Fischer, Rafael J. Wysocki, Daniel Lezcano,
Christian Loehle, Lee Jones, Ulf Hansson, Pavan Kondeti,
Abel Vesa, Bartosz Golaszewski, Sudeep Holla
On Mon, 14 Sep 2026 16:59:10 +0200, Shivendra Pratap
<shivendra.pratap@oss.qualcomm.com> said:
> PSCI supports different types of resets like SYSTEM_RESET, SYSTEM_RESET2
> ARCH WARM reset and SYSTEM_RESET2 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 psci-reboot-mode as an auxiliary device created by the psci-devices
> driver. Define two types of PSCI resets, predefined-resets and
> vendor-specific resets. Predefined-resets are defined by psci driver
> and vendor-specific resets are defined by SoC vendors, under the
> psci:reboot-mode node of SoC device tree.
>
> 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.
>
> Suggested-by: Ulf Hansson <ulf.hansson@oss.qualcomm.com>
> Suggested-by: Lee Jones <lee@kernel.org>
> Suggested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
> ---
> MAINTAINERS | 1 +
> drivers/firmware/psci/psci-devices.c | 71 +++++++++++++++++++++-
> drivers/power/reset/Kconfig | 10 ++++
> drivers/power/reset/Makefile | 1 +
> drivers/power/reset/psci-reboot-mode.c | 104 +++++++++++++++++++++++++++++++++
> 5 files changed, 185 insertions(+), 2 deletions(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9c0334ee2ed2..1c0f111ba197 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -21933,6 +21933,7 @@ S: Maintained
> F: Documentation/devicetree/bindings/arm/psci.yaml
> F: drivers/firmware/psci/
> F: drivers/firmware/psci/psci-devices.c
> +F: drivers/power/reset/psci-reboot-mode.c
> F: include/linux/psci.h
> F: include/uapi/linux/psci.h
>
> diff --git a/drivers/firmware/psci/psci-devices.c b/drivers/firmware/psci/psci-devices.c
> index f1eca61e3269..43e6743202f9 100644
> --- a/drivers/firmware/psci/psci-devices.c
> +++ b/drivers/firmware/psci/psci-devices.c
> @@ -4,19 +4,86 @@
> */
>
> #include <linux/auxiliary_bus.h>
> +#include <linux/device.h>
> #include <linux/init.h>
> #include <linux/of.h>
> #include <linux/platform_device.h>
> +#include <linux/psci.h>
> +#include <linux/slab.h>
> +
> +static void arm_psci_auxiliary_device_release(struct device *dev)
> +{
> + struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
> +
> + of_node_put(dev->of_node);
> + kfree(auxdev);
> +}
> +
> +static struct auxiliary_device *
> +arm_psci_auxiliary_device_create(struct device *dev, const char *devname,
> + struct device_node *np)
> +{
> + struct auxiliary_device *auxdev;
> + int ret;
> +
> + auxdev = kzalloc_obj(*auxdev);
> + if (!auxdev)
> + return NULL;
> +
> + auxdev->id = 0;
> + auxdev->name = devname;
> + auxdev->dev.parent = dev;
> + auxdev->dev.release = arm_psci_auxiliary_device_release;
> +
> + if (np)
> + device_set_node(&auxdev->dev, of_fwnode_handle(of_node_get(np)));
> +
> + ret = auxiliary_device_init(auxdev);
> + if (ret) {
> + of_node_put(auxdev->dev.of_node);
> + kfree(auxdev);
> + return NULL;
> + }
> +
> + ret = __auxiliary_device_add(auxdev, "arm-psci");
> + if (ret) {
> + auxiliary_device_uninit(auxdev);
> + return NULL;
> + }
> +
> + ret = devm_add_action_or_reset(dev, auxiliary_device_destroy, auxdev);
> + if (ret)
> + return NULL;
> +
> + return auxdev;
> +}
>
> static int arm_psci_probe(struct platform_device *pdev)
> {
> struct auxiliary_device *auxdev;
> +#ifdef CONFIG_PSCI_REBOOT_MODE
> + struct device_node *reboot_mode_np = NULL;
> +#endif
>
> - auxdev = __devm_auxiliary_device_create(&pdev->dev, "arm-psci",
> - "psci-cpuidle-domain", NULL, 0);
> + auxdev = arm_psci_auxiliary_device_create(&pdev->dev,
> + "psci-cpuidle-domain",
> + pdev->dev.of_node);
> if (!auxdev)
> return -ENOMEM;
>
> +#ifdef CONFIG_PSCI_REBOOT_MODE
> + if (psci_has_system_reset2_support())
> + reboot_mode_np = of_get_child_by_name(pdev->dev.of_node,
> + "reboot-mode");
> +
> + auxdev = arm_psci_auxiliary_device_create(&pdev->dev,
> + "psci-reboot-mode",
> + reboot_mode_np);
> + of_node_put(reboot_mode_np);
> + if (!auxdev)
> + dev_warn(&pdev->dev, "failed to create PSCI reboot mode device\n");
> +#endif
> +
> return 0;
> }
>
> diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
> index bce996bbef28..5c349f41e097 100644
> --- a/drivers/power/reset/Kconfig
> +++ b/drivers/power/reset/Kconfig
> @@ -360,6 +360,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 ARM_PSCI_DEVICES
> + select REBOOT_MODE
Needs: select AUXILIARY_BUS
> + help
> + Say y here to enable the PSCI reboot mode driver. The driver
> + registers with the reboot-mode framework to configure PSCI
> + reset commands, which are executed by the PSCI driver during
> + psci_sys_reset().
> +
> 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 e31cab4ba78e..45d8aaaffaa1 100644
> --- a/drivers/power/reset/Makefile
> +++ b/drivers/power/reset/Makefile
> @@ -41,5 +41,6 @@ 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
> obj-$(CONFIG_POWER_RESET_QEMU_VIRT_CTRL) += qemu-virt-ctrl.o
> diff --git a/drivers/power/reset/psci-reboot-mode.c b/drivers/power/reset/psci-reboot-mode.c
> new file mode 100644
> index 000000000000..bf2dd6626feb
> --- /dev/null
> +++ b/drivers/power/reset/psci-reboot-mode.c
> @@ -0,0 +1,104 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> + */
> +
> +#include <linux/array_size.h>
> +#include <linux/auxiliary_bus.h>
> +#include <linux/device.h>
[
> +#include <linux/errno.h>
> +#include <linux/init.h>
> +#include <linux/kconfig.h>
]
Why are you including these?
Bart
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v25 04/10] firmware: psci: Add support for PSCI auxiliary devices
2026-09-14 14:59 ` [PATCH v25 04/10] firmware: psci: Add support for PSCI auxiliary devices Shivendra Pratap
2026-09-14 15:21 ` sashiko-bot
@ 2026-09-16 9:29 ` Bartosz Golaszewski
1 sibling, 0 replies; 26+ messages in thread
From: Bartosz Golaszewski @ 2026-09-16 9:29 UTC (permalink / raw)
To: Shivendra Pratap
Cc: Florian Fainelli, Krzysztof Kozlowski, Dmitry Baryshkov,
Mukesh Ojha, Andre Draszik, Greg Kroah-Hartman,
Kathiravan Thirumoorthy, linux-pm, linux-kernel, linux-arm-kernel,
linux-arm-msm, devicetree, mfd, Srinivas Kandagatla, Ulf Hansson,
Bartosz Golaszewski, Lorenzo Pieralisi, Arnd Bergmann,
Bjorn Andersson, Sebastian Reichel, Rob Herring,
Souvik Chakravarty, Krzysztof Kozlowski, Andy Yan,
Matthias Brugger, Mark Rutland, Conor Dooley, Konrad Dybcio,
John Stultz, Moritz Fischer, Rafael J. Wysocki, Daniel Lezcano,
Christian Loehle, Lee Jones, Ulf Hansson, Pavan Kondeti,
Abel Vesa, Bartosz Golaszewski, Sudeep Holla
On Mon, 14 Sep 2026 16:59:08 +0200, Shivendra Pratap
<shivendra.pratap@oss.qualcomm.com> said:
> PSCI has multiple kernel consumers, such as cpuidle-psci-domain.
> Currently, both the PSCI core driver and cpuidle-psci-domain bind
> directly to the same PSCI node "arm,psci-1.0". Additional consumers, if
> introduced, would also need to bind in the same way, leading to multiple
> drivers attached to a single device node.
>
> Introduce a PSCI auxiliary-device provider that binds to "arm,psci-1.0"
> and registers PSCI child devices on the auxiliary bus. As the first
> user, register cpuidle-psci-domain as an auxiliary device.
>
> Update cpuidle-psci-domain to probe as an auxiliary driver and use
> the PSCI device node for power-domain traversal.
>
> Suggested-by: Ulf Hansson <ulf.hansson@oss.qualcomm.com>
> Suggested-by: Lee Jones <lee@kernel.org>
> Suggested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> Signed-off-by: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
> ---
> MAINTAINERS | 1 +
> drivers/cpuidle/Kconfig.arm | 1 +
> drivers/cpuidle/cpuidle-psci-domain.c | 31 +++++++++++++++-----------
> drivers/firmware/psci/Kconfig | 14 ++++++++++++
> drivers/firmware/psci/Makefile | 1 +
> drivers/firmware/psci/psci-devices.c | 41 +++++++++++++++++++++++++++++++++++
> 6 files changed, 76 insertions(+), 13 deletions(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 207a6e2db70c..9c0334ee2ed2 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -21932,6 +21932,7 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
> S: Maintained
> F: Documentation/devicetree/bindings/arm/psci.yaml
> F: drivers/firmware/psci/
> +F: drivers/firmware/psci/psci-devices.c
> F: include/linux/psci.h
> F: include/uapi/linux/psci.h
>
> diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm
> index b88b01aa5829..f22e18b05053 100644
> --- a/drivers/cpuidle/Kconfig.arm
> +++ b/drivers/cpuidle/Kconfig.arm
> @@ -36,6 +36,7 @@ config ARM_PSCI_CPUIDLE_DOMAIN
> bool "PSCI CPU idle Domain"
> depends on ARM_PSCI_CPUIDLE
> depends on PM_GENERIC_DOMAINS_OF
> + depends on ARM_PSCI_DEVICES
> select DT_IDLE_GENPD
> default y
> help
> diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
> index b9e4ad7d43a3..0ce6a83f6588 100644
> --- a/drivers/cpuidle/cpuidle-psci-domain.c
> +++ b/drivers/cpuidle/cpuidle-psci-domain.c
> @@ -9,10 +9,11 @@
>
> #define pr_fmt(fmt) "CPUidle PSCI: " fmt
>
> +#include <linux/auxiliary_bus.h>
> #include <linux/cpu.h>
> #include <linux/device.h>
> #include <linux/kernel.h>
> -#include <linux/platform_device.h>
> +#include <linux/module.h>
> #include <linux/pm_domain.h>
> #include <linux/pm_runtime.h>
> #include <linux/psci.h>
> @@ -122,14 +123,10 @@ static void psci_pd_remove(void)
> }
> }
>
> -static const struct of_device_id psci_of_match[] = {
> - { .compatible = "arm,psci-1.0" },
> - {}
> -};
> -
> -static int psci_cpuidle_domain_probe(struct platform_device *pdev)
> +static int psci_cpuidle_domain_probe(struct auxiliary_device *auxdev,
> + const struct auxiliary_device_id *id)
> {
> - struct device_node *np = pdev->dev.of_node;
> + struct device_node *np = auxdev->dev.of_node;
> bool use_osi = psci_has_osi_support();
> int ret = 0, pd_count = 0;
>
> @@ -177,16 +174,24 @@ static int psci_cpuidle_domain_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static struct platform_driver psci_cpuidle_domain_driver = {
> - .probe = psci_cpuidle_domain_probe,
> +static const struct auxiliary_device_id psci_cpuidle_domain_id_table[] = {
> + { .name = "arm-psci.psci-cpuidle-domain" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(auxiliary, psci_cpuidle_domain_id_table);
> +
> +static struct auxiliary_driver psci_cpuidle_domain_driver = {
> + .probe = psci_cpuidle_domain_probe,
> .driver = {
> - .name = "psci-cpuidle-domain",
> - .of_match_table = psci_of_match,
> + .suppress_bind_attrs = true,
> },
> + .id_table = psci_cpuidle_domain_id_table,
> };
>
> static int __init psci_idle_init_domains(void)
> {
> - return platform_driver_register(&psci_cpuidle_domain_driver);
> + return __auxiliary_driver_register(&psci_cpuidle_domain_driver,
> + THIS_MODULE,
> + "psci-cpuidle-domain");
> }
> core_initcall(psci_idle_init_domains);
> diff --git a/drivers/firmware/psci/Kconfig b/drivers/firmware/psci/Kconfig
> index 97944168b5e6..68e381f1a618 100644
> --- a/drivers/firmware/psci/Kconfig
> +++ b/drivers/firmware/psci/Kconfig
> @@ -2,6 +2,20 @@
> config ARM_PSCI_FW
> bool
>
> +config ARM_PSCI_DEVICES
> + bool "PSCI auxiliary device support"
> + depends on ARM_PSCI_FW
> + depends on OF
> + select AUXILIARY_BUS
> + default y
> + help
> + Say Y here to enable auxiliary device support for PSCI.
> +
> + This creates auxiliary devices for PSCI functionality implemented
> + outside the core PSCI firmware driver. These devices allow PSCI
> + child drivers to bind through the auxiliary bus while sharing the
> + PSCI firmware device as their parent.
> +
> config ARM_PSCI_CHECKER
> bool "ARM PSCI checker"
> depends on ARM_PSCI_FW && HOTPLUG_CPU && CPU_IDLE && !TORTURE_TEST
> diff --git a/drivers/firmware/psci/Makefile b/drivers/firmware/psci/Makefile
> index 1956b882470f..8e75a0ed6f74 100644
> --- a/drivers/firmware/psci/Makefile
> +++ b/drivers/firmware/psci/Makefile
> @@ -1,4 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> #
> obj-$(CONFIG_ARM_PSCI_FW) += psci.o
> +obj-$(CONFIG_ARM_PSCI_DEVICES) += psci-devices.o
> obj-$(CONFIG_ARM_PSCI_CHECKER) += psci_checker.o
> diff --git a/drivers/firmware/psci/psci-devices.c b/drivers/firmware/psci/psci-devices.c
> new file mode 100644
> index 000000000000..f1eca61e3269
> --- /dev/null
> +++ b/drivers/firmware/psci/psci-devices.c
> @@ -0,0 +1,41 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> + */
> +
> +#include <linux/auxiliary_bus.h>
> +#include <linux/init.h>
I think you need module.h not init.h.
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +
> +static int arm_psci_probe(struct platform_device *pdev)
> +{
> + struct auxiliary_device *auxdev;
> +
> + auxdev = __devm_auxiliary_device_create(&pdev->dev, "arm-psci",
> + "psci-cpuidle-domain", NULL, 0);
> + if (!auxdev)
> + return -ENOMEM;
> +
> + return 0;
> +}
I would prefer you to move the code between the patches a bit. This patch
should already be introducing the full, future-proof infrastructure for
registering multiple auxiliary devices, so maybe add a static table with device
info? Then in patch 10/10 you'd just extend it for reboot modes.
I'd also not add any ifdef guards here and lesses the build-time dependencies.
You can register the device alright, it just won't get probed if the reboot-mode
support is not there.
Bart
> +
> +static const struct of_device_id arm_psci_of_match[] = {
> + { .compatible = "arm,psci-1.0" },
> + { }
> +};
> +
> +static struct platform_driver arm_psci_driver = {
> + .probe = arm_psci_probe,
> + .driver = {
> + .name = "arm-psci",
> + .of_match_table = arm_psci_of_match,
> + .suppress_bind_attrs = true,
> + },
> +};
> +
> +static int __init arm_psci_init(void)
> +{
> + return platform_driver_register(&arm_psci_driver);
> +}
> +core_initcall(arm_psci_init);
>
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2026-09-16 9:29 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 14:59 [PATCH v25 00/10] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 01/10] power: reset: reboot-mode: Support up to 3 magic values per mode Shivendra Pratap
2026-09-14 15:09 ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 02/10] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
2026-09-14 15:12 ` sashiko-bot
2026-09-15 13:54 ` Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 03/10] firmware: psci: Introduce command-based resets Shivendra Pratap
2026-09-14 15:14 ` sashiko-bot
2026-09-15 14:02 ` Shivendra Pratap
2026-09-15 14:05 ` Shivendra Pratap
2026-09-14 14:59 ` [PATCH v25 04/10] firmware: psci: Add support for PSCI auxiliary devices Shivendra Pratap
2026-09-14 15:21 ` sashiko-bot
2026-09-16 9:29 ` Bartosz Golaszewski
2026-09-14 14:59 ` [PATCH v25 05/10] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
2026-09-14 15:19 ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 06/10] power: reset: Add psci-reboot-mode driver Shivendra Pratap
2026-09-14 15:21 ` sashiko-bot
2026-09-16 9:23 ` Bartosz Golaszewski
2026-09-14 14:59 ` [PATCH v25 07/10] arm64: dts: qcom: Add psci reboot-modes for kodiak boards Shivendra Pratap
2026-09-14 15:24 ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 08/10] arm64: dts: qcom: Add psci reboot-modes for lemans boards Shivendra Pratap
2026-09-14 15:28 ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 09/10] arm64: dts: qcom: Add psci reboot-modes for monaco boards Shivendra Pratap
2026-09-14 15:25 ` sashiko-bot
2026-09-14 14:59 ` [PATCH v25 10/10] arm64: dts: qcom: Add psci reboot-modes for talos boards Shivendra Pratap
2026-09-14 15:27 ` sashiko-bot
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).