* [PATCH v2 0/3] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2 @ 2020-02-24 20:57 Elliot Berman 2020-02-24 20:57 ` [PATCH v2 1/3] dt: psci: Add arm,psci-sys-reset2-type property Elliot Berman ` (2 more replies) 0 siblings, 3 replies; 12+ messages in thread From: Elliot Berman @ 2020-02-24 20:57 UTC (permalink / raw) To: Mark Rutland, Lorenzo Pieralisi, Sudeep Holla Cc: Elliot Berman, Bjorn Andersson, Trilok Soni, Prasad Sodagudi, David Collins, linux-arm-kernel, linux-arm-msm, linux-kernel This patch adds support for vendor-specific SYSTEM_RESET2 to support Qualcomm target use cases of rebooting into a RAM dump download mode. This patch series applies on top of [1]. [1]: https://lore.kernel.org/patchwork/cover/1185759/ Changes since v1: - Address Sudeep's comments Changes since RFC v2: - None, tested on SM8250 MTP Elliot Berman (3): dt: psci: Add arm,psci-sys-reset2-type property firmware: psci: Add support for dt-supplied SYSTEM_RESET2 type arm64: dts: qcom: sm8250: Add vendor-specific PSCI system reset2 type Documentation/devicetree/bindings/arm/psci.yaml | 5 +++++ arch/arm64/boot/dts/qcom/sm8250.dtsi | 1 + drivers/firmware/psci/psci.c | 22 ++++++++++++++++++---- include/uapi/linux/psci.h | 2 ++ 4 files changed, 26 insertions(+), 4 deletions(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/3] dt: psci: Add arm,psci-sys-reset2-type property 2020-02-24 20:57 [PATCH v2 0/3] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2 Elliot Berman @ 2020-02-24 20:57 ` Elliot Berman 2020-02-25 10:55 ` Sudeep Holla 2020-02-26 12:09 ` Mark Rutland 2020-02-24 20:57 ` [PATCH v2 2/3] firmware: psci: Add support for dt-supplied SYSTEM_RESET2 type Elliot Berman 2020-02-24 20:57 ` [PATCH v2 3/3] arm64: dts: qcom: sm8250: Add vendor-specific PSCI system reset2 type Elliot Berman 2 siblings, 2 replies; 12+ messages in thread From: Elliot Berman @ 2020-02-24 20:57 UTC (permalink / raw) To: Mark Rutland, Lorenzo Pieralisi, Sudeep Holla Cc: Elliot Berman, Bjorn Andersson, Trilok Soni, Prasad Sodagudi, David Collins, linux-arm-kernel, linux-arm-msm, linux-kernel Some implementors of PSCI may relax the requirements of the PSCI architectural warm reset. In order to comply with PSCI specification, a different reset_type value must be used. The alternate PSCI SYSTEM_RESET2 may be used in all warm/soft reboot scenarios, replacing the architectural warm reset. Signed-off-by: Elliot Berman <eberman@codeaurora.org> --- Documentation/devicetree/bindings/arm/psci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/psci.yaml b/Documentation/devicetree/bindings/arm/psci.yaml index 8ef8542..469256a2 100644 --- a/Documentation/devicetree/bindings/arm/psci.yaml +++ b/Documentation/devicetree/bindings/arm/psci.yaml @@ -102,6 +102,11 @@ properties: [1] Kernel documentation - ARM idle states bindings Documentation/devicetree/bindings/arm/idle-states.txt + arm,psci-sys-reset2-param: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + reset_param value to use during a warm or soft reboot. + "#power-domain-cells": description: The number of cells in a PM domain specifier as per binding in [3]. -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/3] dt: psci: Add arm,psci-sys-reset2-type property 2020-02-24 20:57 ` [PATCH v2 1/3] dt: psci: Add arm,psci-sys-reset2-type property Elliot Berman @ 2020-02-25 10:55 ` Sudeep Holla 2020-02-26 12:09 ` Mark Rutland 1 sibling, 0 replies; 12+ messages in thread From: Sudeep Holla @ 2020-02-25 10:55 UTC (permalink / raw) To: Elliot Berman Cc: Mark Rutland, Lorenzo Pieralisi, Bjorn Andersson, Trilok Soni, Prasad Sodagudi, David Collins, Sudeep Holla, linux-arm-kernel, linux-arm-msm, linux-kernel On Mon, Feb 24, 2020 at 12:57:36PM -0800, Elliot Berman wrote: > Some implementors of PSCI may relax the requirements of the PSCI > architectural warm reset. In order to comply with PSCI specification, a > different reset_type value must be used. The alternate PSCI > SYSTEM_RESET2 may be used in all warm/soft reboot scenarios, replacing > the architectural warm reset. > You forgot to update $subject accordingly. No need to respin for that now, unless you get any other comments. Other than the $subject fix, Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> -- Regards, Sudeep ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/3] dt: psci: Add arm,psci-sys-reset2-type property 2020-02-24 20:57 ` [PATCH v2 1/3] dt: psci: Add arm,psci-sys-reset2-type property Elliot Berman 2020-02-25 10:55 ` Sudeep Holla @ 2020-02-26 12:09 ` Mark Rutland 2020-02-27 0:44 ` Elliot Berman 1 sibling, 1 reply; 12+ messages in thread From: Mark Rutland @ 2020-02-26 12:09 UTC (permalink / raw) To: Elliot Berman Cc: Lorenzo Pieralisi, Sudeep Holla, Bjorn Andersson, Trilok Soni, Prasad Sodagudi, David Collins, linux-arm-kernel, linux-arm-msm, linux-kernel On Mon, Feb 24, 2020 at 12:57:36PM -0800, Elliot Berman wrote: > Some implementors of PSCI may relax the requirements of the PSCI > architectural warm reset. In order to comply with PSCI specification, a > different reset_type value must be used. This reads as-if you're saying the firmware isn't spec compliant, and this is a workaround in order to get the expected behaviour. Can you please elaborate on what you mean by "relax the requirements" here? What's your firmware doing or not doing that you want to avoid? > The alternate PSCI SYSTEM_RESET2 may be used in all warm/soft reboot > scenarios, replacing the architectural warm reset. I assume you mean SYSTEM_REET2's SYSTEM_WARM_RESET reset? Please call that out explicitly by name -- it makes this easier to look up, and if/when more architectural resets are added the commit message won't become ambiguous. > > Signed-off-by: Elliot Berman <eberman@codeaurora.org> > --- > Documentation/devicetree/bindings/arm/psci.yaml | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/Documentation/devicetree/bindings/arm/psci.yaml b/Documentation/devicetree/bindings/arm/psci.yaml > index 8ef8542..469256a2 100644 > --- a/Documentation/devicetree/bindings/arm/psci.yaml > +++ b/Documentation/devicetree/bindings/arm/psci.yaml > @@ -102,6 +102,11 @@ properties: > [1] Kernel documentation - ARM idle states bindings > Documentation/devicetree/bindings/arm/idle-states.txt > > + arm,psci-sys-reset2-param: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: | > + reset_param value to use during a warm or soft reboot. A "soft" reboot isn't a PSCI concept, so I'm worried this is just hooking up magic values for Linux internals. I'd like to better understand what you're trying to achieve here. Thanks, Mark. > + > "#power-domain-cells": > description: > The number of cells in a PM domain specifier as per binding in [3]. > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/3] dt: psci: Add arm,psci-sys-reset2-type property 2020-02-26 12:09 ` Mark Rutland @ 2020-02-27 0:44 ` Elliot Berman 0 siblings, 0 replies; 12+ messages in thread From: Elliot Berman @ 2020-02-27 0:44 UTC (permalink / raw) To: Mark Rutland Cc: Lorenzo Pieralisi, Sudeep Holla, Bjorn Andersson, Trilok Soni, Prasad Sodagudi, David Collins, linux-arm-kernel, linux-arm-msm, linux-kernel On 2/26/2020 4:09 AM, Mark Rutland wrote: > On Mon, Feb 24, 2020 at 12:57:36PM -0800, Elliot Berman wrote: >> Some implementors of PSCI may relax the requirements of the PSCI >> architectural warm reset. In order to comply with PSCI specification, a >> different reset_type value must be used. > > This reads as-if you're saying the firmware isn't spec compliant, and > this is a workaround in order to get the expected behaviour. > > Can you please elaborate on what you mean by "relax the requirements" > here? What's your firmware doing or not doing that you want to avoid? > >> The alternate PSCI SYSTEM_RESET2 may be used in all warm/soft reboot >> scenarios, replacing the architectural warm reset. > > I assume you mean SYSTEM_REET2's SYSTEM_WARM_RESET reset? Please call > that out explicitly by name -- it makes this easier to look up, and > if/when more architectural resets are added the commit message won't > become ambiguous. I can reword to: Some implementors of PSCI may wish to generally use a different reset type than SYSTEM_WARM_RESET. For instance, Qualcomm SoCs support an alternate reset_type which may be used in more warm reboot scenarios than SYSTEM_WARM_RESET permits (e.g. to reboot into recovery mode). > >> >> Signed-off-by: Elliot Berman <eberman@codeaurora.org> >> --- >> Documentation/devicetree/bindings/arm/psci.yaml | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/arm/psci.yaml b/Documentation/devicetree/bindings/arm/psci.yaml >> index 8ef8542..469256a2 100644 >> --- a/Documentation/devicetree/bindings/arm/psci.yaml >> +++ b/Documentation/devicetree/bindings/arm/psci.yaml >> @@ -102,6 +102,11 @@ properties: >> [1] Kernel documentation - ARM idle states bindings >> Documentation/devicetree/bindings/arm/idle-states.txt >> >> + arm,psci-sys-reset2-param: >> + $ref: /schemas/types.yaml#/definitions/uint32 >> + description: | >> + reset_param value to use during a warm or soft reboot. > > A "soft" reboot isn't a PSCI concept, so I'm worried this is just > hooking up magic values for Linux internals.> > I'd like to better understand what you're trying to achieve here. In Qualcomm use cases, we do not always want to preserve memory to caller's (i.e. Linux) exception level. For instance, crash recovery mode runs in higher exception level and would not continue booting into Linux except through a hard reset. Also, this early firmware doesn't have the ability to understand device tree or ACPI tables to know what memory to preserve. Per discussion with Sudeep and Charles, this use case violates PSCI specification for SYSTEM_WARM_RESET reset type, but would be appropriate for a vendor-specific reset type. Thus, Qualcomm firmware supports a vendor-specific reset type which does not have the requirement to preserve memory to caller's EL or to describe what memory is to be preserved in DT or ACPI. If this vendor-specific reset type is used, then firmware checks various registers (e.g. download mode [1]) to alter the restart flow (e.g. to enter recovery mode). If no alternate flow is requested, then firmware would boot back into Linux, preserving memory. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/firmware/qcom_scm.c?h=v5.6-rc3#n1120 Thanks, Elliot -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 2/3] firmware: psci: Add support for dt-supplied SYSTEM_RESET2 type 2020-02-24 20:57 [PATCH v2 0/3] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2 Elliot Berman 2020-02-24 20:57 ` [PATCH v2 1/3] dt: psci: Add arm,psci-sys-reset2-type property Elliot Berman @ 2020-02-24 20:57 ` Elliot Berman 2020-02-25 11:03 ` Sudeep Holla 2020-02-26 12:10 ` Mark Rutland 2020-02-24 20:57 ` [PATCH v2 3/3] arm64: dts: qcom: sm8250: Add vendor-specific PSCI system reset2 type Elliot Berman 2 siblings, 2 replies; 12+ messages in thread From: Elliot Berman @ 2020-02-24 20:57 UTC (permalink / raw) To: Mark Rutland, Lorenzo Pieralisi, Sudeep Holla Cc: Elliot Berman, Bjorn Andersson, Trilok Soni, Prasad Sodagudi, David Collins, linux-arm-kernel, linux-arm-msm, linux-kernel Some implementors of PSCI may relax the requirements of the PSCI architectural warm reset. In order to comply with PSCI specification, a different reset_type value must be used. The alternate PSCI SYSTEM_RESET2 may be used in all warm/soft reboot scenarios, replacing the architectural warm reset. Signed-off-by: Elliot Berman <eberman@codeaurora.org> --- drivers/firmware/psci/psci.c | 22 ++++++++++++++++++---- include/uapi/linux/psci.h | 2 ++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 2937d44..8f4609c 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -90,6 +90,8 @@ static u32 psci_function_id[PSCI_FN_MAX]; static u32 psci_cpu_suspend_feature; static bool psci_system_reset2_supported; +static u32 psci_sys_reset2_reset_param = + PSCI_1_1_SYSTEM_RESET2_SYSTEM_WARM_RESET; static inline bool psci_has_ext_power_state(void) { @@ -272,11 +274,10 @@ static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd) if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) && psci_system_reset2_supported) { /* - * reset_type[31] = 0 (architectural) - * reset_type[30:0] = 0 (SYSTEM_WARM_RESET) * cookie = 0 (ignored by the implementation) */ - invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0); + invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), + psci_sys_reset2_reset_param, 0, 0); } else { invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); } @@ -493,6 +494,7 @@ typedef int (*psci_initcall_t)(const struct device_node *); static int __init psci_0_2_init(struct device_node *np) { int err; + u32 param; err = get_set_conduit_method(np); if (err) @@ -505,7 +507,19 @@ static int __init psci_0_2_init(struct device_node *np) * can be carried out according to the specific version reported * by firmware */ - return psci_probe(); + err = psci_probe(); + if (err) + return err; + + if (psci_system_reset2_supported && + !of_property_read_u32(np, "arm,psci-sys-reset2-param", ¶m)) { + if ((s32)param > 0) + pr_warn("%08x is an invalid architectural reset type.\n", + param); + psci_sys_reset2_reset_param = param; + } + + return 0; } /* diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h index 2fcad1d..d786ec8 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -55,6 +55,8 @@ #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) #define PSCI_1_1_FN64_SYSTEM_RESET2 PSCI_0_2_FN64(18) +#define PSCI_1_1_SYSTEM_RESET2_SYSTEM_WARM_RESET 0 + /* PSCI v0.2 power state encoding for CPU_SUSPEND function */ #define PSCI_0_2_POWER_STATE_ID_MASK 0xffff #define PSCI_0_2_POWER_STATE_ID_SHIFT 0 -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] firmware: psci: Add support for dt-supplied SYSTEM_RESET2 type 2020-02-24 20:57 ` [PATCH v2 2/3] firmware: psci: Add support for dt-supplied SYSTEM_RESET2 type Elliot Berman @ 2020-02-25 11:03 ` Sudeep Holla 2020-02-26 1:37 ` Elliot Berman 2020-02-26 12:10 ` Mark Rutland 1 sibling, 1 reply; 12+ messages in thread From: Sudeep Holla @ 2020-02-25 11:03 UTC (permalink / raw) To: Elliot Berman Cc: Mark Rutland, Lorenzo Pieralisi, Bjorn Andersson, Trilok Soni, Prasad Sodagudi, David Collins, Sudeep Holla, linux-arm-kernel, linux-arm-msm, linux-kernel On Mon, Feb 24, 2020 at 12:57:37PM -0800, Elliot Berman wrote: > Some implementors of PSCI may relax the requirements of the PSCI > architectural warm reset. In order to comply with PSCI specification, a > different reset_type value must be used. The alternate PSCI > SYSTEM_RESET2 may be used in all warm/soft reboot scenarios, replacing > the architectural warm reset. > > Signed-off-by: Elliot Berman <eberman@codeaurora.org> > --- > drivers/firmware/psci/psci.c | 22 ++++++++++++++++++---- > include/uapi/linux/psci.h | 2 ++ > 2 files changed, 20 insertions(+), 4 deletions(-) > > diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c > index 2937d44..8f4609c 100644 > --- a/drivers/firmware/psci/psci.c > +++ b/drivers/firmware/psci/psci.c > @@ -90,6 +90,8 @@ static u32 psci_function_id[PSCI_FN_MAX]; > > static u32 psci_cpu_suspend_feature; > static bool psci_system_reset2_supported; > +static u32 psci_sys_reset2_reset_param = > + PSCI_1_1_SYSTEM_RESET2_SYSTEM_WARM_RESET; > > static inline bool psci_has_ext_power_state(void) > { > @@ -272,11 +274,10 @@ static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd) > if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) && > psci_system_reset2_supported) { > /* > - * reset_type[31] = 0 (architectural) > - * reset_type[30:0] = 0 (SYSTEM_WARM_RESET) Sorry for missing this earlier, you can move this comment above if others agree to not drop that info. I am fine with removing it too. E > * cookie = 0 (ignored by the implementation) > */ > - invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0); > + invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), > + psci_sys_reset2_reset_param, 0, 0); > } else { > invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); > } > @@ -493,6 +494,7 @@ typedef int (*psci_initcall_t)(const struct device_node *); > static int __init psci_0_2_init(struct device_node *np) > { > int err; > + u32 param; > > err = get_set_conduit_method(np); > if (err) > @@ -505,7 +507,19 @@ static int __init psci_0_2_init(struct device_node *np) > * can be carried out according to the specific version reported > * by firmware > */ > - return psci_probe(); > + err = psci_probe(); > + if (err) > + return err; > + > + if (psci_system_reset2_supported && > + !of_property_read_u32(np, "arm,psci-sys-reset2-param", ¶m)) { > + if ((s32)param > 0) What is the point on signed comparison here ? You are assuming all vendor reset also as architecture by doing so which is wrong. > + pr_warn("%08x is an invalid architectural reset type.\n", > + param); I thought the point was to have vendor reset here. Based on the 3/3 you see to have vendor reset bit set, you ignore that by doing signed comparison which is wrong and even the message is wrong. Specification defines only one architectural reset(WARM RESET) and all others need to be vendor specific. -- Regards, Sudeep ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] firmware: psci: Add support for dt-supplied SYSTEM_RESET2 type 2020-02-25 11:03 ` Sudeep Holla @ 2020-02-26 1:37 ` Elliot Berman 2020-02-26 11:59 ` Sudeep Holla 0 siblings, 1 reply; 12+ messages in thread From: Elliot Berman @ 2020-02-26 1:37 UTC (permalink / raw) To: Sudeep Holla Cc: Mark Rutland, Lorenzo Pieralisi, Bjorn Andersson, Trilok Soni, Prasad Sodagudi, David Collins, linux-arm-kernel, linux-arm-msm, linux-kernel On 2/25/2020 3:03 AM, Sudeep Holla wrote: > On Mon, Feb 24, 2020 at 12:57:37PM -0800, Elliot Berman wrote: >> @@ -493,6 +494,7 @@ typedef int (*psci_initcall_t)(const struct device_node *); >> static int __init psci_0_2_init(struct device_node *np) >> { >> int err; >> + u32 param; >> >> err = get_set_conduit_method(np); >> if (err) >> @@ -505,7 +507,19 @@ static int __init psci_0_2_init(struct device_node *np) >> * can be carried out according to the specific version reported >> * by firmware >> */ >> - return psci_probe(); >> + err = psci_probe(); >> + if (err) >> + return err; >> + >> + if (psci_system_reset2_supported && >> + !of_property_read_u32(np, "arm,psci-sys-reset2-param", ¶m)) { >> + if ((s32)param > 0) > > What is the point on signed comparison here ? You are assuming all vendor > reset also as architecture by doing so which is wrong. > >> + pr_warn("%08x is an invalid architectural reset type.\n", >> + param); > > I thought the point was to have vendor reset here. Based on the 3/3 you > see to have vendor reset bit set, you ignore that by doing signed comparison > which is wrong and even the message is wrong. Specification defines only > one architectural reset(WARM RESET) and all others need to be vendor specific. > > -- > Regards, > Sudeep > I might've gone crazy, but all vendor-specific reset types would be negative when cast as s32. Thus the check returns true only for an invalid architectural reset type. I can switch to checking bits instead of using cast in v3 to avoid the confusion. Alternatively, I could rename the DT property to "arm,psci-sys-reset2-vendor-param" and then always set the 31st bit so that it is impossible to provide an invalid architectural reset type in DT. Let me know what is preferred. -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] firmware: psci: Add support for dt-supplied SYSTEM_RESET2 type 2020-02-26 1:37 ` Elliot Berman @ 2020-02-26 11:59 ` Sudeep Holla 2020-02-26 12:02 ` Sudeep Holla 0 siblings, 1 reply; 12+ messages in thread From: Sudeep Holla @ 2020-02-26 11:59 UTC (permalink / raw) To: Elliot Berman Cc: Mark Rutland, Lorenzo Pieralisi, Bjorn Andersson, Trilok Soni, Prasad Sodagudi, David Collins, linux-arm-kernel, linux-arm-msm, linux-kernel, Sudeep Holla On Tue, Feb 25, 2020 at 05:37:53PM -0800, Elliot Berman wrote: [...] > Alternatively, I could rename the DT property to > "arm,psci-sys-reset2-vendor-param" Yes much better. > and then always set the 31st bit so that it is impossible to provide an > invalid architectural reset type in DT. > Indeed this is what I was expecting and hence raised issue here. So that one can't make use of architectural ID space just by adding param in DT. -- Regards, Sudeep ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] firmware: psci: Add support for dt-supplied SYSTEM_RESET2 type 2020-02-26 11:59 ` Sudeep Holla @ 2020-02-26 12:02 ` Sudeep Holla 0 siblings, 0 replies; 12+ messages in thread From: Sudeep Holla @ 2020-02-26 12:02 UTC (permalink / raw) To: Elliot Berman Cc: Mark Rutland, Lorenzo Pieralisi, Bjorn Andersson, Trilok Soni, Prasad Sodagudi, David Collins, linux-arm-kernel, linux-arm-msm, linux-kernel, Sudeep Holla On Wed, Feb 26, 2020 at 11:59:12AM +0000, Sudeep Holla wrote: > On Tue, Feb 25, 2020 at 05:37:53PM -0800, Elliot Berman wrote: > > [...] > > > Alternatively, I could rename the DT property to > > "arm,psci-sys-reset2-vendor-param" > > Yes much better. > Just seconds after sending this I got a doubt as how is this being solved with ACPI. How is vendor specific reset achieved on ACPI system especially with other OSes ? -- Regards, Sudeep ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/3] firmware: psci: Add support for dt-supplied SYSTEM_RESET2 type 2020-02-24 20:57 ` [PATCH v2 2/3] firmware: psci: Add support for dt-supplied SYSTEM_RESET2 type Elliot Berman 2020-02-25 11:03 ` Sudeep Holla @ 2020-02-26 12:10 ` Mark Rutland 1 sibling, 0 replies; 12+ messages in thread From: Mark Rutland @ 2020-02-26 12:10 UTC (permalink / raw) To: Elliot Berman Cc: Lorenzo Pieralisi, Sudeep Holla, Bjorn Andersson, Trilok Soni, Prasad Sodagudi, David Collins, linux-arm-kernel, linux-arm-msm, linux-kernel On Mon, Feb 24, 2020 at 12:57:37PM -0800, Elliot Berman wrote: > Some implementors of PSCI may relax the requirements of the PSCI > architectural warm reset. In order to comply with PSCI specification, a > different reset_type value must be used. The alternate PSCI > SYSTEM_RESET2 may be used in all warm/soft reboot scenarios, replacing > the architectural warm reset. As with the binding patch, this sounds like a workaround for a firmware bug. Can you please elaborate on what exactly your firmware does in this case? Thanks, Mark. > > Signed-off-by: Elliot Berman <eberman@codeaurora.org> > --- > drivers/firmware/psci/psci.c | 22 ++++++++++++++++++---- > include/uapi/linux/psci.h | 2 ++ > 2 files changed, 20 insertions(+), 4 deletions(-) > > diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c > index 2937d44..8f4609c 100644 > --- a/drivers/firmware/psci/psci.c > +++ b/drivers/firmware/psci/psci.c > @@ -90,6 +90,8 @@ static u32 psci_function_id[PSCI_FN_MAX]; > > static u32 psci_cpu_suspend_feature; > static bool psci_system_reset2_supported; > +static u32 psci_sys_reset2_reset_param = > + PSCI_1_1_SYSTEM_RESET2_SYSTEM_WARM_RESET; > > static inline bool psci_has_ext_power_state(void) > { > @@ -272,11 +274,10 @@ static void psci_sys_reset(enum reboot_mode reboot_mode, const char *cmd) > if ((reboot_mode == REBOOT_WARM || reboot_mode == REBOOT_SOFT) && > psci_system_reset2_supported) { > /* > - * reset_type[31] = 0 (architectural) > - * reset_type[30:0] = 0 (SYSTEM_WARM_RESET) > * cookie = 0 (ignored by the implementation) > */ > - invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0); > + invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), > + psci_sys_reset2_reset_param, 0, 0); > } else { > invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); > } > @@ -493,6 +494,7 @@ typedef int (*psci_initcall_t)(const struct device_node *); > static int __init psci_0_2_init(struct device_node *np) > { > int err; > + u32 param; > > err = get_set_conduit_method(np); > if (err) > @@ -505,7 +507,19 @@ static int __init psci_0_2_init(struct device_node *np) > * can be carried out according to the specific version reported > * by firmware > */ > - return psci_probe(); > + err = psci_probe(); > + if (err) > + return err; > + > + if (psci_system_reset2_supported && > + !of_property_read_u32(np, "arm,psci-sys-reset2-param", ¶m)) { > + if ((s32)param > 0) > + pr_warn("%08x is an invalid architectural reset type.\n", > + param); > + psci_sys_reset2_reset_param = param; > + } > + > + return 0; > } > > /* > diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h > index 2fcad1d..d786ec8 100644 > --- a/include/uapi/linux/psci.h > +++ b/include/uapi/linux/psci.h > @@ -55,6 +55,8 @@ > #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) > #define PSCI_1_1_FN64_SYSTEM_RESET2 PSCI_0_2_FN64(18) > > +#define PSCI_1_1_SYSTEM_RESET2_SYSTEM_WARM_RESET 0 > + > /* PSCI v0.2 power state encoding for CPU_SUSPEND function */ > #define PSCI_0_2_POWER_STATE_ID_MASK 0xffff > #define PSCI_0_2_POWER_STATE_ID_SHIFT 0 > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 3/3] arm64: dts: qcom: sm8250: Add vendor-specific PSCI system reset2 type 2020-02-24 20:57 [PATCH v2 0/3] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2 Elliot Berman 2020-02-24 20:57 ` [PATCH v2 1/3] dt: psci: Add arm,psci-sys-reset2-type property Elliot Berman 2020-02-24 20:57 ` [PATCH v2 2/3] firmware: psci: Add support for dt-supplied SYSTEM_RESET2 type Elliot Berman @ 2020-02-24 20:57 ` Elliot Berman 2 siblings, 0 replies; 12+ messages in thread From: Elliot Berman @ 2020-02-24 20:57 UTC (permalink / raw) To: Mark Rutland, Lorenzo Pieralisi, Sudeep Holla Cc: Elliot Berman, Bjorn Andersson, Trilok Soni, Prasad Sodagudi, David Collins, linux-arm-kernel, linux-arm-msm, linux-kernel Qualcomm Technologies, Inc. SoCs do not guarantee that an architectural warm reset boots back into Linux kernel. For instance, if download mode or reboot reason cookies are set, the SoC would do a warm reset into an alternate exception level (e.g. a mode to collect RAM dumps) or application at EL1 (e.g. fastboot mode). Thus, Qualcomm Technologies, Inc. SoCs support a vendor-specific warm reset type that can be used in all instances of warm/soft reboots. Signed-off-by: Elliot Berman <eberman@codeaurora.org> --- arch/arm64/boot/dts/qcom/sm8250.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi index f63df12..ca49d22 100644 --- a/arch/arm64/boot/dts/qcom/sm8250.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi @@ -162,6 +162,7 @@ psci { compatible = "arm,psci-1.0"; method = "smc"; + arm,psci-sys-reset2-param = <0x80000000>; }; reserved_memory: reserved-memory { -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-02-27 0:44 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-02-24 20:57 [PATCH v2 0/3] ARM PSCI: Add support for vendor-specific SYSTEM_RESET2 Elliot Berman 2020-02-24 20:57 ` [PATCH v2 1/3] dt: psci: Add arm,psci-sys-reset2-type property Elliot Berman 2020-02-25 10:55 ` Sudeep Holla 2020-02-26 12:09 ` Mark Rutland 2020-02-27 0:44 ` Elliot Berman 2020-02-24 20:57 ` [PATCH v2 2/3] firmware: psci: Add support for dt-supplied SYSTEM_RESET2 type Elliot Berman 2020-02-25 11:03 ` Sudeep Holla 2020-02-26 1:37 ` Elliot Berman 2020-02-26 11:59 ` Sudeep Holla 2020-02-26 12:02 ` Sudeep Holla 2020-02-26 12:10 ` Mark Rutland 2020-02-24 20:57 ` [PATCH v2 3/3] arm64: dts: qcom: sm8250: Add vendor-specific PSCI system reset2 type Elliot Berman
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).