ARM PSCI: Add support for vendor-specific SYSTEM_RESET2
This patch adds support for vendor-specific SYSTEM_RESET2 to support Qualcomm target use cases of rebooting into a RAM dump download mode. I'm working on the client driver to use the proposed psci_system_reset2() function but wanted to get this RFC going for PSCI driver changes.
Elliot Berman (1):
drivers: firmware: psci: Add function to support SYSTEM_RESET2
drivers/firmware/psci/psci.c | 16 +++++++++++++++- include/linux/psci.h | 3 +++ include/uapi/linux/psci.h | 8 ++++++++ 3 files changed, 26 insertions(+), 1 deletion(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
RFC 1/1 drivers: firmware: psci: Add function to support SYSTEM_RESET2
Make SYSTEM_RESET2 command part of its own function which client drivers may also invoke to support vendor-specific reset types.
--- drivers/firmware/psci/psci.c | 16 +++++++++++++++- include/linux/psci.h | 3 +++ include/uapi/linux/psci.h | 8 ++++++++ 3 files changed, 26 insertions(+), 1 deletion(-)
drivers/firmware/psci/psci.c +15 -1
@@ -220,6 +220,15 @@ static unsigned long psci_migrate_info_up_cpu(void) 0, 0, 0); } +int psci_system_reset2 (const u32 reset_type,const unsigned long cookie) +{ +if (!psci_system_reset2_supported) +return -EOPNOTSUPP ; + return invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), reset_type, + cookie,0 ); +} +EXPORT_SYMBOL_GPL (psci_system_reset2); +static void set_conduit (enum arm_smccc_conduit conduit) {switch (conduit) {
@@ -267,7 +276,12 @@ static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd)* reset_type[30:0] = 0 (SYSTEM_WARM_RESET) * cookie = 0 (ignored by the implementation) */ - invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0); +psci_system_reset2 ( +PSCI_1_1_SYSTEM_RESET2_SYSTEM_WARM_RESET | + (PSCI_1_1_SYSTEM_RESET2_TYPE_ARCHITECTURE << +PSCI_1_1_SYSTEM_RESET2_SHIFT ), +0 + ); }else {invoke_psci_fn (PSCI_0_2_FN_SYSTEM_RESET ,0 ,0 ,0 ); }
include/linux/psci.h +3 -0
@@ -41,8 +41,11 @@ extern struct psci_operations psci_ops;#if defined(CONFIG_ARM_PSCI_FW )int __init psci_dt_init (void ); +int psci_system_reset2 (const u32 reset_type,const unsigned long cookie);#else static inline int psci_dt_init (void ) {return 0 ; } +static inline int psci_system_reset2 (const u32 reset_type, +const unsigned long cookie) {return -ENODEV ; }#endif #if defined(CONFIG_ARM_PSCI_FW ) && defined(CONFIG_ACPI )
include/uapi/linux/psci.h +8 -0
@@ -72,6 +72,14 @@#define PSCI_1_0_EXT_POWER_STATE_TYPE_MASK \ (0x1 << PSCI_1_0_EXT_POWER_STATE_TYPE_SHIFT) +/* PSCI SYSTEM_RESET2 reset_type argument */ +#define PSCI_1_1_SYSTEM_RESET2_SYSTEM_WARM_RESET 0x0 +#define PSCI_1_1_SYSTEM_RESET2_TYPE_VENDOR 1 +#define PSCI_1_1_SYSTEM_RESET2_TYPE_ARCHITECTURE 0 +#define PSCI_1_1_SYSTEM_RESET2_TYPE_SHIFT 30 +#define PSCI_1_1_SYSTEM_RESET2_TYPE_MASK \ + (0x1 << PSCI_1_1_SYSTEM_RESET2_TYPE_SHIFT) +/* PSCI v0.2 affinity level state returned by AFFINITY_INFO */ #define PSCI_0_2_AFFINITY_LEVEL_ON 0#define PSCI_0_2_AFFINITY_LEVEL_OFF 1
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 5 lines · Elliot Berman
This patch adds support for vendor-specific
SYSTEM_RESET2to support Qualcomm target use cases of rebooting into a RAM dump download mode. I'm working on the client driver to use the proposedpsci_system_reset2()function but wanted to get this RFC going for PSCI driver changes.
Please post along with the client driver to understand the context better. It saves time trying to understand when reviewing and also avoid asking lots of questions which the client driver might answer :)
--
Regards,
Sudeep