[PATCH v24 00/12] Implement PSCI reboot mode driver for PSCI resets
Shivendra Pratap <[email protected]> Mon, 03 Aug 2026 15:13:31 +0530
| Newsgroups | org.kernel.vger.linux-pm,dev.linux.lists.mfd,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260803-arm-psci-system_reset2-vendor-reboots-v24-0-889281373870@oss.qualcomm.com> |
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-MFD: In v19/20, psci-reboot-mode was implemented as a faux-device. Review discussion suggested this may not be the best model for firmware-backed consumers, and that representing PSCI users as regular platform devices would be better. One suggestion was to add a PSCI-MFD driver, allowing multiple consumers tied to a single PSCI node "arm,psci-1.0" be probed as MFD cells. Following this, the series adds a PSCI-MFD driver and introduces cpuidle-psci-domain and psci-reboot-mode as child cells. To meet the psci-reboot-mode requirement, the MFD core is extended to support fwnode. Reference discussions on this: https://lore.kernel.org/all/[email protected]/ --- The patch is tested on rb3Gen2, lemans-ride, lemans-evk, monaco-ride, qcs615-ride. Signed-off-by: Shivendra Pratap <[email protected]> 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/[email protected]/ - 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 <[email protected]> To: Arnd Bergmann <[email protected]> To: Bartosz Golaszewski <[email protected]> To: Bjorn Andersson <[email protected]> To: Sebastian Reichel <[email protected]> To: Rob Herring <[email protected]> To: Sudeep Holla <[email protected]> To: Souvik Chakravarty <[email protected]> To: Krzysztof Kozlowski <[email protected]> To: Andy Yan <[email protected]> To: Matthias Brugger <[email protected]> To: Mark Rutland <[email protected]> To: Conor Dooley <[email protected]> To: Konrad Dybcio <[email protected]> To: John Stultz <[email protected]> To: Moritz Fischer <[email protected]> To: Rafael J. Wysocki <[email protected]> To: Daniel Lezcano <[email protected]> To: Christian Loehle <[email protected]> To: Ulf Hansson <[email protected]> To: Lee Jones <[email protected]> To: Ulf Hansson <[email protected]> To: Pavan Kondeti <[email protected]> Cc: Florian Fainelli <[email protected]> Cc: Krzysztof Kozlowski <[email protected]> Cc: Srinivas Kandagatla <[email protected]> Cc: Dmitry Baryshkov <[email protected]> Cc: Mukesh Ojha <[email protected]> Cc: Andre Draszik <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Kathiravan Thirumoorthy <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] --- Shivendra Pratap (12): 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 mfd: psci-mfd: Add PSCI MFD driver for cpuidle-psci-domain cell dt-bindings: arm: Document reboot mode magic power: reset: Add psci-reboot-mode driver mfd: core: Add firmware-node support to MFD cells mfd: psci-mfd: Add psci-reboot-mode child cell 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 | 58 +++++++ 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 | 9 +- drivers/firmware/psci/psci.c | 112 +++++++++++- drivers/mfd/Kconfig | 12 ++ drivers/mfd/Makefile | 2 + drivers/mfd/mfd-core.c | 151 +++++++++++++--- drivers/mfd/psci-mfd.c | 68 ++++++++ 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 | 82 +++++++++ drivers/power/reset/qcom-pon.c | 7 +- drivers/power/reset/reboot-mode.c | 208 +++++++++++++++++------ drivers/power/reset/syscon-reboot-mode.c | 7 +- include/linux/mfd/core.h | 10 ++ include/linux/psci.h | 15 ++ include/linux/reboot-mode.h | 27 +++ 30 files changed, 751 insertions(+), 95 deletions(-) --- base-commit: 415606a7be939835db9b0d6b711887586646346d change-id: 20250709-arm-psci-system_reset2-vendor-reboots-46c80044afcf Best regards, -- Shivendra Pratap <[email protected]>