Skip to contentSkip to conversation

Fix PSCI on MSM8917 and MSM8937

PATCH In review Reza Kurniawan 5 participants 15 messages Oct 22 – Nov 25

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v3 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 v3:
- Swap ordering (patch #3 <-> patch #4)
- Link to v2: https://patch.msgid.link/[email protected]

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: msm8917: Use a shallower cluster state to fix unresponsive idle
arm64: dts: qcom: Skip suspend mode switch on MSM8917 and MSM8937

 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: 9a482184d910775cf648863148944945b74e2815
change-id: 20261013-psci-fix-8a2c0d6266fa

Best regards,

Signature · 1 line
Reza Kurniawan <[email protected]>
#1 lore raw

PATCH v3 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
index 0d04389c81..2eee38d155 100644
@@ -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.56.0
#8 lore raw

PATCH v3 2/4 cpuidle: psci: Allow skipping the suspend mode switch

In reply to Reza Kurniawan

From: 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
index 5722365b94..cc9f14769b 100644
@@ -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
index e73bae6cb2..3226af6d89 100644
@@ -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.56.0
#11 lore raw

PATCH v3 3/4 arm64: dts: qcom: msm8917: Use a shallower cluster state to fix unresponsive idle

In reply to 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.

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
index a2907f8a63..06f7e7f57c 100644
@@ -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.56.0
#14 lore raw

PATCH v3 4/4 arm64: dts: qcom: Skip suspend mode switch on MSM8917 and MSM8937

In reply to Reza Kurniawan

The 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
index 06f7e7f57c..7730977e6e 100644
@@ -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
index 7de6447de4..a66a544f30 100644
@@ -311,6 +311,7 @@ pmu {
 	psci {
 		compatible = "arm,psci-1.0";
 		method = "smc";
+		skip-suspend-mode-switch;
 	};
 
 	rpm: remoteproc {
Signature · 1 line
2.56.0
Reviewed-by on v3 3/4
#12 lore raw

Re: [PATCH v3 3/4] arm64: dts: qcom: msm8917: Use a shallower cluster state to fix unresponsive idle

In reply to Reza Kurniawan
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.

---

https://lore.kernel.org/lkml/[email protected]/

and

https://lore.kernel.org/lkml/20261015-b4-shikra_lpm_addition-v2-0-ac7f1a0d5638@oss.qualcomm.com/

are in flight, you may want to integrate/test them locally!

Konrad

#13 lore raw

Re: [PATCH v3 3/4] arm64: dts: qcom: msm8917: Use a shallower cluster state to fix unresponsive idle

Quoted 23 lines · Konrad Dybcio
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.

---

Quoted 7 lines

https://lore.kernel.org/lkml/[email protected]/

and

https://lore.kernel.org/lkml/20261015-b4-shikra_lpm_addition-v2-0-ac7f1a0d5638@oss.qualcomm.com/

are in flight, you may want to integrate/test them locally!

Thanks for the tip!

Quoted 4 lines

Konrad

maintainer
#2 lore raw

Re: [PATCH v3 1/4] dt-bindings: arm: psci: Add skip-suspend-mode-switch property

In reply to Reza Kurniawan
Quoted 5 lines · Reza Kurniawan

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.

Is that call fatal? Why can't you just try the call and if it fails, avoid it. Then you don't require a DTB change to fix the issue.

Rob

#3 lore raw

Re: [PATCH v3 1/4] dt-bindings: arm: psci: Add skip-suspend-mode-switch property

Hi Rob,

The failure isn't fatal on MSM8917/MSM8937, so a runtime fallback would work there. My concern is other platforms. Today, a rejected PSCI_SET_SUSPEND_MODE makes the driver stop, which is the safe outcome when firmware misbehaves in a way we can't diagnose (PSCI has no call to read back the current mode, so we can't tell what state it's in).

A generic "try, and avoid on failure" would turn that into "continue", for every platform, including ones we haven't verified, unexpected things could happen after that. The property lets a platform that is known to be safe opt in explicitly.

Best regards,
Reza

Quoted 12 lines · Rob Herring
Quoted 5 lines · Reza Kurniawan

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.

Is that call fatal? Why can't you just try the call and if it fails, avoid it. Then you don't require a DTB change to fix the issue.

Rob

#4 lore raw

Re: [PATCH v3 1/4] dt-bindings: arm: psci: Add skip-suspend-mode-switch property

In reply to Reza Kurniawan

+ Sudeep

Quoted 7 lines · Reza Kurniawan

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.

Quoted 6 lines

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.

I think it would be nice to further clarify what's going on in the PSCI FW. If I understand correctly, the only supported mode is the PSCI OS-initiated mode, hence it's always running in this mode, right?

This is clearly a violation of the PSCI spec - and I guess updating the FW isn't possible at this late state, or is it?

Quoted 15 lines

[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 +0 -0
index 0d04389c81..2eee38d155 100644

Documentation/devicetree/bindings/arm/psci.yaml properties: · line 101

Quoted 4 lines
Documentation/devicetree/bindings/arm/psci.yaml +1 -0
@@ -98,6 +98,19 @@ properties:
       [1] Kernel documentation - ARM idle states bindings
         Documentation/devicetree/bindings/cpu/idle-states.yaml
 
+  skip-suspend-mode-switch:

Maybe a more descriptive name can be found?

osi-mode-only or broken-suspend-mode-osi-only?

Quoted 17 lines
Documentation/devicetree/bindings/arm/psci.yaml +12 -1
+    $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#
 
--
Quoted 2 lines

2.56.0

Kind regards
Uffe

#9 lore raw

Re: [PATCH v3 2/4] cpuidle: psci: Allow skipping the suspend mode switch

In reply to Reza Kurniawan
Quoted 30 lines · Reza Kurniawan

From: 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 +0 -0
index 5722365b94..cc9f14769b 100644

drivers/cpuidle/cpuidle-psci-domain.c static int psci_cpuidle_domain_probe(struct platform_device *pdev) · line 162

Quoted 8 lines
drivers/cpuidle/cpuidle-psci-domain.c +1 -4
@@ -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")) {

Rather than reading this property here and in the psci fw driver, I suggest we just do this in the fw driver.

In other words, let's make psci_set_osi_mode() to succeed when "skip-suspend-mode-switch" is set.

Quoted 34 lines
drivers/cpuidle/cpuidle-psci-domain.c +9 -2
+               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 -3
index e73bae6cb2..3226af6d89 100644
@@ -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;
 
--
Quoted 2 lines

2.56.0

Kind regards
Uffe

#5 lore raw

Re: [PATCH v3 1/4] dt-bindings: arm: psci: Add skip-suspend-mode-switch property

In reply to Ulf Hansson
Quoted 15 lines · Ulf Hansson

+ Sudeep

Quoted 6 lines · Reza Kurniawan

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.

Quoted 6 lines

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.

Quoted 8 lines

I think it would be nice to further clarify what's going on in the PSCI FW. If I understand correctly, the only supported mode is the PSCI OS-initiated mode, hence it's always running in this mode, right?

This is clearly a violation of the PSCI spec - and I guess updating the FW isn't possible at this late state, or is it?

[..]

Updating low-level FW in retail devices just doesn't happen, sadly. Can't be done by the user, IIUC not even if Qualcomm wanted to help out, because firmware is signed by the OEM and won't load w/o that signature.

And OEMs, well.. we can't even get the vendors for modern high-end laptops to pull important bug fixes from Qcom.. Thinkpad X13s still requires that stupid arm64.nopauth workaround, retail Hamoa laptops all struggle with the DC ZVA crash/reset (https://github.com/icecream95/x1e-crash) that no one from the Qcom IoT/Linux world has ever encountered because of different firmware apparently, and so on..

MSM8917/MSM8937 are found in decade old low-end mobile e-waste, only could be updated by force if someone finds a bug in firmware secure boot :)

Thanks,
~val

#10 lore raw

Re: [PATCH v3 2/4] cpuidle: psci: Allow skipping the suspend mode switch

In reply to Ulf Hansson
Quoted 44 lines · Ulf Hansson
Quoted 30 lines · Reza Kurniawan

From: 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 +0 -0
index 5722365b94..cc9f14769b 100644

drivers/cpuidle/cpuidle-psci-domain.c static int psci_cpuidle_domain_probe(struct platform_device *pdev) · line 162

Quoted 8 lines
drivers/cpuidle/cpuidle-psci-domain.c +1 -4
@@ -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")) {

Rather than reading this property here and in the psci fw driver, I suggest we just do this in the fw driver.

Quoted 2 lines

In other words, let's make psci_set_osi_mode() to succeed when "skip-suspend-mode-switch" is set.

Right, that makes a lot more sense. Thank you.

Best regards,
Reza

#6 lore raw

Re: [PATCH v3 1/4] dt-bindings: arm: psci: Add skip-suspend-mode-switch property

In reply to Ulf Hansson
Quoted 15 lines · Ulf Hansson

+ Sudeep

Quoted 11 lines · Reza Kurniawan

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.

Quoted 6 lines
Quoted 2 lines

Add an optional flag that tells the OS not to issue PSCI_SET_SUSPEND_MODE on such firmware.

I think it would be nice to further clarify what's going on in the PSCI FW. If I understand correctly, the only supported mode is the PSCI OS-initiated mode, hence it's always running in this mode, right?

That is correct.

Quoted 3 lines

This is clearly a violation of the PSCI spec - and I guess updating the FW isn't possible at this late state, or is it?

Just as Val stated, it's not possible sadly.

Quoted 19 lines
Quoted 19 lines

[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 +0 -0
index 0d04389c81..2eee38d155 100644
@@ -98,6 +98,19 @@ properties:
       [1] Kernel documentation - ARM idle states bindings
         Documentation/devicetree/bindings/cpu/idle-states.yaml
 
Quoted 5 lines

Documentation/devicetree/bindings/arm/psci.yaml properties: · line 101

Quoted 1 line
Documentation/devicetree/bindings/arm/psci.yaml +1 -0
+  skip-suspend-mode-switch:

Maybe a more descriptive name can be found?

osi-mode-only or broken-suspend-mode-osi-only?

I initially settled with a similar name before (with 'osi-only' phrasing). I ultimately went with 'skip-suspend-mode-switch' because the root cause was only due to the mode switch not functioning properly. This property doesn't do anything regarding the mode the firmware is stuck at as it's only fixing the failed call. Normally, the driver sets the PSCI to the preferred mode at driver probe (OSI if supported, PC otherwise). This property simply skips that part and assumes the FW is already in the preferred mode. It could theoretically work for firmware stuck at either OSI or PC mode, as long as the platform shows the same symptom, It is mode-agnostic essentially. That being said, I'm not completely against the 'osi-only' phrasing.

What do you think of the above rationale? I'm open to suggestions.

I admit that the word "skip" here isn't really helpful since it counts as an implementation detail. "broken" should better describe that it's a quirk.

Best regards,
Reza

#7 lore raw

Re: [PATCH v3 1/4] dt-bindings: arm: psci: Add skip-suspend-mode-switch property

Quoted 70 lines · Reza Kurniawan
Quoted 15 lines · Ulf Hansson

+ Sudeep

Quoted 11 lines · Reza Kurniawan

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.

Quoted 6 lines
Quoted 2 lines

Add an optional flag that tells the OS not to issue PSCI_SET_SUSPEND_MODE on such firmware.

I think it would be nice to further clarify what's going on in the PSCI FW. If I understand correctly, the only supported mode is the PSCI OS-initiated mode, hence it's always running in this mode, right?

That is correct.

Quoted 3 lines

This is clearly a violation of the PSCI spec - and I guess updating the FW isn't possible at this late state, or is it?

Just as Val stated, it's not possible sadly.

Quoted 19 lines
Quoted 19 lines

[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 +0 -0
index 0d04389c81..2eee38d155 100644
@@ -98,6 +98,19 @@ properties:
       [1] Kernel documentation - ARM idle states bindings
         Documentation/devicetree/bindings/cpu/idle-states.yaml
 
Quoted 5 lines

Documentation/devicetree/bindings/arm/psci.yaml properties: · line 101

Quoted 1 line
Documentation/devicetree/bindings/arm/psci.yaml +1 -0
+  skip-suspend-mode-switch:

Maybe a more descriptive name can be found?

osi-mode-only or broken-suspend-mode-osi-only?

I initially settled with a similar name before (with 'osi-only' phrasing). I ultimately went with 'skip-suspend-mode-switch' because the root cause was only due to the mode switch not functioning properly. This property doesn't do anything regarding the mode the firmware is stuck at as it's only fixing the failed call. Normally, the driver sets the PSCI to the preferred mode at driver probe (OSI if supported, PC otherwise). This property simply skips that part and assumes the FW is already in the preferred mode. It could theoretically work for firmware stuck at either OSI or PC mode, as long as the platform shows the same symptom, It is mode-agnostic essentially. That being said, I'm not completely against the 'osi-only' phrasing.

Quoted 5 lines

What do you think of the above rationale? I'm open to suggestions.

I admit that the word "skip" here isn't really helpful since it counts as an implementation detail. "broken" should better describe that it's a quirk.

I guess "broken" deserves to be part of the property somehow, to clearly indicate that the FW do not follow the spec.

People have different tastes and I have no strong opinion in the end. Anyway, I suggest you to respin this to clarify the commit message and to suggest a better name of the property. Let's see what Sudeep and the arm folkz think of this as well.

Kind regards
Uffe