Fix PSCI on MSM8917 and MSM8937
Subsystems (6)
v2 cover Fix PSCI on MSM8917 and MSM8937
PSCI on Qualcomm MSM8917 and MSM8937 advertises support for OS-initiated mode through PSCI_FEATURES, but rejects every PSCI_SET_SUSPEND_MODE call with NOT_SUPPORTED. The cpuidle-psci-domain driver treats this as a fatal error, so probe fails and the CPU PM domain topology is never registered:
psci-cpuidle-domain psci: probe with driver psci-cpuidle-domain failed with error -95
This series adds a "skip-suspend-mode-switch" property to the PSCI node. When present, cpuidle-psci-domain does not call psci_set_osi_mode() and continues with the topology it has already built.
Skipping the switch is expected to be safe on these platforms since it matches the behavior of the downstream kernel, which manages the cluster power level in addition to the CPU power level, just as Linux does when OSI is supported.
Additionally, it also adds the property to the PSCI node for both platforms. For MSM8917, additional change is added to fix the system being unresponsive at idle.
---
Changes in v2:
- Small phrase change in the property description
- Added property check in psci_1_0_init()
- Link to v1: https://patch.msgid.link/[email protected]
---
Alejandro Tafalla (2):
dt-bindings: arm: psci: Add skip-suspend-mode-switch property
cpuidle: psci: Allow skipping the suspend mode switch
Reza Kurniawan (2):
arm64: dts: qcom: Skip suspend mode switch on MSM8917 and MSM8937
arm64: dts: qcom: msm8917: Use a shallower cluster state to fix unresponsive idle
Documentation/devicetree/bindings/arm/psci.yaml | 13 +++++++++++++ arch/arm64/boot/dts/qcom/msm8917.dtsi | 9 +++++---- arch/arm64/boot/dts/qcom/msm8937.dtsi | 1 + drivers/cpuidle/cpuidle-psci-domain.c | 16 ++++++++++------ drivers/firmware/psci/psci.c | 6 ++++-- 5 files changed, 33 insertions(+), 12 deletions(-)
---
base-commit: 2efb7a11f1aa4d2dc285fe2680cca22cb9f72f64
change-id: 20261013-psci-fix-8a2c0d6266fa
Best regards,
Signature · 1 line
Reza Kurniawan <[email protected]>
PATCH v2 1/4 dt-bindings: arm: psci: Add skip-suspend-mode-switch property
From: Alejandro Tafalla <[email protected]>
On some SoCs (e.g. Qualcomm MSM8917 and MSM8937), PSCI_FEATURES reports that OS-initiated mode is supported, but every PSCI_SET_SUSPEND_MODE call is rejected with NOT_SUPPORTED.
PSCI provides no call to read back the current suspend mode, so the OS cannot tell which mode the firmware is operating in or why the switch is rejected.
Add an optional flag that tells the OS not to issue PSCI_SET_SUSPEND_MODE on such firmware.
[Reza Kurniawan: split out the patch, rewrote the property description,
renamed the property]
--- Documentation/devicetree/bindings/arm/psci.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+)
Documentation/devicetree/bindings/arm/psci.yaml +13 -0
@@ -98,6 +98,19 @@ properties: [1] Kernel documentation - ARM idle states bindings Documentation/devicetree/bindings/cpu/idle-states.yaml + skip-suspend-mode-switch: + $ref: /schemas/types.yaml#/definitions/flag + description: | + Do not issue PSCI_SET_SUSPEND_MODE. + + Some firmware advertises support for OS-initiated mode but rejects + every suspend mode switch with NOT_SUPPORTED. Since PSCI cannot report + the current mode, the OS cannot verify the state the firmware is in. + + This property is an assertion that the firmware works correctly without + a mode switch. This is a workaround for non-compliant firmware, only set + it for devices that ship with firmware known to behave this way. + patternProperties: "^power-domain-": $ref: /schemas/power/power-domain.yaml#
Signature · 1 line
2.55.0
PATCH v2 2/4 cpuidle: psci: Allow skipping the suspend mode switch
In reply to Reza KurniawanFrom: Alejandro Tafalla <[email protected]>
On some SoCs (e.g. Qualcomm MSM8917 and MSM8937), PSCI reports that OSI mode is supported but rejects any PSCI_SET_SUSPEND_MODE call with NOT_SUPPORTED. psci_set_osi_mode() then fails with -EOPNOTSUPP and the probe is aborted:
psci-cpuidle-domain psci: probe with driver psci-cpuidle-domain failed with error -95
Add support for the "skip-suspend-mode-switch" property. When present, do not call psci_set_osi_mode() and continue with the topology that was already built.
[Reza Kurniawan: split out the patch, added log message for skip case, renamed
the property, added property check at PSCI initialization]
--- drivers/cpuidle/cpuidle-psci-domain.c | 16 ++++++++++------ drivers/firmware/psci/psci.c | 6 ++++-- 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/cpuidle/cpuidle-psci-domain.c +10 -6
@@ -159,13 +159,17 @@ static int psci_cpuidle_domain_probe(struct platform_device *pdev)if (ret) goto remove_pd; -/* let's try to enable OSI. */ - ret =psci_set_osi_mode (use_osi); -if (ret) - goto remove_pd; +if (of_property_read_bool (np,"skip-suspend-mode-switch" )) { +pr_info ("Initialized CPU PM domain topology, keeping firmware-set mode\n" ); + }else { + ret =psci_set_osi_mode (use_osi); +if (ret) + goto remove_pd; + +pr_info ("Initialized CPU PM domain topology using %s mode\n" , + use_osi ?"OSI" :"PC" ); + } -pr_info ("Initialized CPU PM domain topology using %s mode\n" , - use_osi ?"OSI" :"PC" );return 0 ; remove_pd:
drivers/firmware/psci/psci.c +4 -2
@@ -791,8 +791,10 @@ static int __init psci_1_0_init(const struct device_node *np)if (psci_has_osi_support ()) {pr_info ("OSI mode supported.\n" ); -/* Default to PC mode. */ -psci_set_osi_mode (false); +if (!of_property_read_bool (np,"skip-suspend-mode-switch" )) { +/* Default to PC mode. */ +psci_set_osi_mode (false); + } }return 0 ;
Signature · 1 line
2.55.0
PATCH v2 3/4 arm64: dts: qcom: Skip suspend mode switch on MSM8917 and MSM8937
In reply to Reza KurniawanThe PSCI firmware on Qualcomm MSM8917 and MSM8937 reports to support OS-initiated suspend mode but rejects call to PSCI_SET_SUSPEND_MODE with NOT_SUPPORTED. psci_set_osi_mode() then fails with -EOPNOTSUPP and probe of psci-cpuidle-domain is aborted:
psci-cpuidle-domain psci: probe with driver psci-cpuidle-domain failed with error -95
Skip the mode switch on these platforms and continue with the topology that was already built.
This is expected to be safe since it matches the downstream kernel behavior, which manages the cluster power level in addition to the CPU power level, just like Linux does when OSI is supported.
--- arch/arm64/boot/dts/qcom/msm8917.dtsi | 1 + arch/arm64/boot/dts/qcom/msm8937.dtsi | 1 + 2 files changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/msm8917.dtsi +1 -0
@@ -182,6 +182,7 @@ pmu { psci { compatible = "arm,psci-1.0"; method = "smc"; + skip-suspend-mode-switch; cluster_pd: power-domain-cluster { #power-domain-cells = <0>;
arch/arm64/boot/dts/qcom/msm8937.dtsi +1 -0
@@ -311,6 +311,7 @@ pmu { psci { compatible = "arm,psci-1.0"; method = "smc"; + skip-suspend-mode-switch; }; rpm: remoteproc {
Signature · 1 line
2.55.0
Re: [PATCH v2 3/4] arm64: dts: qcom: Skip suspend mode switch on MSM8917 and MSM8937
Quoted 11 lines · Reza Kurniawan
The PSCI firmware on Qualcomm MSM8917 and MSM8937 reports to support OS-initiated suspend mode but rejects call to
PSCI_SET_SUSPEND_MODEwithNOT_SUPPORTED.psci_set_osi_mode()then fails with-EOPNOTSUPPand probe of psci-cpuidle-domain is aborted:psci-cpuidle-domain psci: probe with driver psci-cpuidle-domain failed with error -95
Skip the mode switch on these platforms and continue with the topology that was already built.
Quoted 6 lines
This is expected to be safe since it matches the downstream kernel behavior, which manages the cluster power level in addition to the CPU power level, just like Linux does when OSI is supported.
Signed-off-by Reza Kurniawan <[email protected]>---
Konrad
PATCH v2 4/4 arm64: dts: qcom: msm8917: Use a shallower cluster state to fix unresponsive idle
In reply to Reza KurniawanMSM8917 is a single cluster SoC, so powering down the cluster means powering down the whole system. This causes two problems:
1. The system becomes unresponsive, even to common interrupts. Waking it requires an interrupt from the MPM (MSM Power Manager) or scheduling the MPM to wake the system later. Linux currently has no way of doing the latter, so the cluster may never resume operation.
2. Entering power collapse blanks the screen. When the state is entered and exited repeatedly, this shows up as visible flicker.
Even if MPM scheduling were implemented, the second problem would remain and it wouldn't fix the system being unresponsive at idle.
Replace the idle state with PSCI mode 4 (dubbed GDHS downstream), which is less aggressive and can wake up from conventional interrupt sources.
--- arch/arm64/boot/dts/qcom/msm8917.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/msm8917.dtsi +4 -4
@@ -112,10 +112,10 @@ core3 { domain-idle-states { cluster_sleep_0: cluster-sleep-0 { compatible = "domain-idle-state"; - arm,psci-suspend-param = <0x41000053>; - entry-latency-us = <700>; - exit-latency-us = <1000>; - min-residency-us = <6500>; + arm,psci-suspend-param = <0x41000043>; + entry-latency-us = <240>; + exit-latency-us = <280>; + min-residency-us = <806>; }; };
Signature · 1 line
2.55.0
Re: [PATCH v2 4/4] arm64: dts: qcom: msm8917: Use a shallower cluster state to fix unresponsive idle
Quoted 11 lines · Reza Kurniawan
MSM8917 is a single cluster SoC, so powering down the cluster means powering down the whole system. This causes two problems:
1. The system becomes unresponsive, even to common interrupts. Waking it requires an interrupt from the MPM (MSM Power Manager) or scheduling the MPM to wake the system later. Linux currently has no way of doing the latter, so the cluster may never resume operation.
2. Entering power collapse blanks the screen. When the state is entered and exited repeatedly, this shows up as visible flicker.
Quoted 8 lines
Even if MPM scheduling were implemented, the second problem would remain and it wouldn't fix the system being unresponsive at idle.
Replace the idle state with PSCI mode 4 (dubbed GDHS downstream), which is less aggressive and can wake up from conventional interrupt sources.
Signed-off-by Reza Kurniawan <[email protected]>---
For the sake of git bisect working, please order this patch before patch 3.
Or alternatively, we can get rid of this one if the MPM rework series lands first.
Konrad