Skip to contentSkip to conversation

qcom: Add cpuidle to some platforms

PATCH Superseded Amit Kucheria 6 participants 36 messages May 10, 2019 – May 21, 2019

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover qcom: Add cpuidle to some platforms

Fix up a few entry-method="psci" issues and then add cpuidle low power states for msm8996, msm8998, qcs404, sdm845. All these have been tested to only make sure that the C-states are entered from Linux point-of-view.

We will continue to add more states and make power measurements to tweak some of these numbers, but getting these merged will allow other people to use these platforms to work on cpuidle, eas and related topics.

Amit Kucheria (6):
arm64: dts: Fix various entry-method properties to reflect
documentation
Documentation: arm: Link idle-states binding to code
arm64: dts: qcom: msm8916: Add entry-method property for the
idle-states node
arm64: dts: qcom: msm8916: Use more generic idle state names
arm64: dts: qcom: msm8996: Add PSCI cpuidle low power states
arm64: dts: qcom: msm8998: Add PSCI cpuidle low power states

Niklas Cassel (1):
arm64: dts: qcom: qcs404: Add PSCI cpuidle low power states

Raju P.L.S.S.S.N (1):
arm64: dts: qcom: sdm845: Add PSCI cpuidle low power states

 .../devicetree/bindings/arm/idle-states.txt   |  7 +++
 .../arm64/boot/dts/freescale/fsl-ls1028a.dtsi |  2 +-
 arch/arm64/boot/dts/qcom/msm8916.dtsi         | 13 ++--
 arch/arm64/boot/dts/qcom/msm8996.dtsi         | 28 +++++++++
 arch/arm64/boot/dts/qcom/msm8998.dtsi         | 32 ++++++++++
 arch/arm64/boot/dts/qcom/qcs404.dtsi          | 18 ++++++
 arch/arm64/boot/dts/qcom/sdm845.dtsi          | 62 +++++++++++++++++++
 7 files changed, 156 insertions(+), 6 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/8 arm64: dts: Fix various entry-method properties to reflect documentation

The idle-states binding documentation[1] mentions that the 'entry-method' property is required on 64-bit platforms and must be set to "psci".

We fixed up all uses of the entry-method property in
commit e9880240e4f4 ("arm64: dts: Fix various entry-method properties to reflect documentation"). But a new one has appeared. Fix it up.

---
 arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +1 -1
index 2896bbcfa3bb..42e7822a0227 100644
@@ -51,7 +51,7 @@
 		 * PSCI node is not added default, U-boot will add missing
 		 * parts if it determines to use PSCI.
 		 */
-		entry-method = "arm,psci";
+		entry-method = "psci";
 
 		CPU_PH20: cpu-ph20 {
 			compatible = "arm,idle-state";
Signature · 1 line
2.17.1
#6 lore raw

PATCH 2/8 Documentation: arm: Link idle-states binding to code

In reply to Amit Kucheria

The enable-method needs to be psci for the psci_cpuidle_ops to be correctly registered.

Add a note to the binding documentation on where to find the declaration of the enable-method since it is a macro and escapes any attempts to grep for it.

---
 Documentation/devicetree/bindings/arm/idle-states.txt | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/arm/idle-states.txt +7 -0
index 45730ba60af5..3a42335a6f3d 100644
@@ -239,6 +239,10 @@ processor idle states, defined as device tree nodes, are listed.
 			# On ARM v8 64-bit this property is required and must
 			  be:
 			   - "psci"
+			     (This assumes that the enable-method is "psci"
+			     in the cpu node[6] that then uses the
+			     CPUIDLE_METHOD_OF_DECLARE macro to setup the
+			     psci_cpuidle_ops callbacks)
 			# On ARM 32-bit systems this property is optional
 
 The nodes describing the idle states (state) can only be defined within the
@@ -697,3 +701,6 @@ cpus {
 
 [5] Devicetree Specification
     https://www.devicetree.org/specifications/
+
+[6] ARM Linux Kernel documentation - Booting AArch64 Linux
+    Documentation/arm64/booting.txt
Signature · 1 line
2.17.1
#8 lore raw

PATCH 3/8 arm64: dts: qcom: msm8916: Add entry-method property for the idle-states node

In reply to Amit Kucheria

The idle-states binding documentation[1] mentions that the 'entry-method' property is required on 64-bit platforms and must be set to "psci".

---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/msm8916.dtsi +2 -0
index 0803ca8c02da..ded1052e5693 100644
@@ -158,6 +158,8 @@
 		};
 
 		idle-states {
+			entry-method="psci";
+
 			CPU_SPC: spc {
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x40000002>;
Signature · 1 line
2.17.1
#11 lore raw

PATCH 4/8 arm64: dts: qcom: msm8916: Use more generic idle state names

In reply to Amit Kucheria

Instead of using Qualcomm-specific terminology, use generic node names for the idle states that are easier to understand. Move the description into the "idle-state-name" property.

---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +6 -5
index ded1052e5693..400b609bb3fd 100644
@@ -110,7 +110,7 @@
 			reg = <0x0>;
 			next-level-cache = <&L2_0>;
 			enable-method = "psci";
-			cpu-idle-states = <&CPU_SPC>;
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			clocks = <&apcs>;
 			operating-points-v2 = <&cpu_opp_table>;
 			#cooling-cells = <2>;
@@ -122,7 +122,7 @@
 			reg = <0x1>;
 			next-level-cache = <&L2_0>;
 			enable-method = "psci";
-			cpu-idle-states = <&CPU_SPC>;
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			clocks = <&apcs>;
 			operating-points-v2 = <&cpu_opp_table>;
 			#cooling-cells = <2>;
@@ -134,7 +134,7 @@
 			reg = <0x2>;
 			next-level-cache = <&L2_0>;
 			enable-method = "psci";
-			cpu-idle-states = <&CPU_SPC>;
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			clocks = <&apcs>;
 			operating-points-v2 = <&cpu_opp_table>;
 			#cooling-cells = <2>;
@@ -146,7 +146,7 @@
 			reg = <0x3>;
 			next-level-cache = <&L2_0>;
 			enable-method = "psci";
-			cpu-idle-states = <&CPU_SPC>;
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			clocks = <&apcs>;
 			operating-points-v2 = <&cpu_opp_table>;
 			#cooling-cells = <2>;
@@ -160,8 +160,9 @@
 		idle-states {
 			entry-method="psci";
 
-			CPU_SPC: spc {
+			CPU_SLEEP_0: cpu-sleep-0 {
 				compatible = "arm,idle-state";
+				idle-state-name = "standalone-power-collapse";
 				arm,psci-suspend-param = <0x40000002>;
 				entry-latency-us = <130>;
 				exit-latency-us = <150>;
Signature · 1 line
2.17.1
#18 lore raw

PATCH 5/8 arm64: dts: qcom: qcs404: Add PSCI cpuidle low power states

In reply to Amit Kucheria

From: Niklas Cassel <[email protected]>

Add device bindings for cpuidle states for cpu devices.

[amit: rename the idle-states to more generic names and fixups]

---
 arch/arm64/boot/dts/qcom/qcs404.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/qcom/qcs404.dtsi +18 -0
index e8fd26633d57..369c59c35bc7 100644
@@ -30,6 +30,7 @@
 			compatible = "arm,cortex-a53";
 			reg = <0x100>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -38,6 +39,7 @@
 			compatible = "arm,cortex-a53";
 			reg = <0x101>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -46,6 +48,7 @@
 			compatible = "arm,cortex-a53";
 			reg = <0x102>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -54,6 +57,7 @@
 			compatible = "arm,cortex-a53";
 			reg = <0x103>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -61,6 +65,20 @@
 			compatible = "cache";
 			cache-level = <2>;
 		};
+
+		idle-states {
+			entry-method="psci";
+
+			CPU_SLEEP_0: cpu-sleep-0 {
+				compatible = "arm,idle-state";
+				idle-state-name = "standalone-power-collapse";
+				arm,psci-suspend-param = <0x40000003>;
+				entry-latency-us = <125>;
+				exit-latency-us = <180>;
+				min-residency-us = <595>;
+				local-timer-stop;
+			};
+		};
 	};
 
 	firmware {
Signature · 1 line
2.17.1
#21 lore raw

PATCH 6/8 arm64: dts: qcom: msm8996: Add PSCI cpuidle low power states

In reply to Amit Kucheria

Add device bindings for cpuidle states for cpu devices.

---
 arch/arm64/boot/dts/qcom/msm8996.dtsi | 28 +++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +28 -0
index c761269caf80..b615bcb9e351 100644
@@ -95,6 +95,7 @@
 			compatible = "qcom,kryo";
 			reg = <0x0 0x0>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			next-level-cache = <&L2_0>;
 			L2_0: l2-cache {
 			      compatible = "cache";
@@ -107,6 +108,7 @@
 			compatible = "qcom,kryo";
 			reg = <0x0 0x1>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -115,6 +117,7 @@
 			compatible = "qcom,kryo";
 			reg = <0x0 0x100>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			next-level-cache = <&L2_1>;
 			L2_1: l2-cache {
 			      compatible = "cache";
@@ -127,6 +130,7 @@
 			compatible = "qcom,kryo";
 			reg = <0x0 0x101>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			next-level-cache = <&L2_1>;
 		};
 
@@ -151,6 +155,30 @@
 				};
 			};
 		};
+
+		idle-states {
+			entry-method="psci";
+
+			LITTLE_CPU_PD: little-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "standalone-power-collapse";
+				arm,psci-suspend-param = <0x00000004>;
+				entry-latency-us = <40>;
+				exit-latency-us = <40>;
+				min-residency-us = <300>;
+				local-timer-stop;
+			};
+
+			BIG_CPU_PD: big-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "standalone-power-collapse";
+				arm,psci-suspend-param = <0x00000004>;
+				entry-latency-us = <40>;
+				exit-latency-us = <40>;
+				min-residency-us = <300>;
+				local-timer-stop;
+			};
+		};
 	};
 
 	thermal-zones {
Signature · 1 line
2.17.1
#25 lore raw

PATCH 7/8 arm64: dts: qcom: msm8998: Add PSCI cpuidle low power states

In reply to Amit Kucheria

Add device bindings for cpuidle states for cpu devices.

---
 arch/arm64/boot/dts/qcom/msm8998.dtsi | 32 +++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +32 -0
index 3fd0769fe648..208281f318e2 100644
@@ -78,6 +78,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x0>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L2_0: l2-cache {
@@ -97,6 +98,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x1>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L1_I_1: l1-icache {
@@ -112,6 +114,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x2>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L1_I_2: l1-icache {
@@ -127,6 +130,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x3>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L1_I_3: l1-icache {
@@ -142,6 +146,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x100>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L2_1: l2-cache {
@@ -161,6 +166,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x101>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L1_I_101: l1-icache {
@@ -176,6 +182,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x102>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L1_I_102: l1-icache {
@@ -191,6 +198,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x103>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L1_I_103: l1-icache {
@@ -238,6 +246,30 @@
 				};
 			};
 		};
+
+		idle-states {
+			entry-method="psci";
+
+			LITTLE_CPU_PD: little-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "little-power-down";
+				arm,psci-suspend-param = <0x00000002>;
+				entry-latency-us = <43>;
+				exit-latency-us = <43>;
+				min-residency-us = <200>;
+				local-timer-stop;
+			};
+
+			BIG_CPU_PD: big-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "big-power-down";
+				arm,psci-suspend-param = <0x00000002>;
+				entry-latency-us = <41>;
+				exit-latency-us = <41>;
+				min-residency-us = <200>;
+				local-timer-stop;
+			};
+		};
 	};
 
 	firmware {
Signature · 1 line
2.17.1
#32 lore raw

PATCH 8/8 arm64: dts: qcom: sdm845: Add PSCI cpuidle low power states

In reply to Amit Kucheria

From: "Raju P.L.S.S.S.N" <[email protected]>

Add device bindings for cpuidle states for cpu devices.

[amit: rename the idle-states to more generic names and fixups]

---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 62 ++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +62 -0
index 5308f1671824..2c8c54e4bd77 100644
@@ -119,6 +119,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x0>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD &LITTLE_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 0>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_0>;
@@ -136,6 +137,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x100>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD &LITTLE_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 0>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_100>;
@@ -150,6 +152,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x200>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD &LITTLE_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 0>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_200>;
@@ -164,6 +167,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x300>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD &LITTLE_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 0>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_300>;
@@ -178,6 +182,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x400>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD &BIG_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 1>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_400>;
@@ -192,6 +197,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x500>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD &BIG_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 1>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_500>;
@@ -206,6 +212,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x600>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD &BIG_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 1>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_600>;
@@ -220,6 +227,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x700>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD &BIG_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 1>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_700>;
@@ -228,6 +236,60 @@
 				next-level-cache = <&L3_0>;
 			};
 		};
+
+		idle-states {
+			entry-method = "psci";
+
+			LITTLE_CPU_PD: little-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "little-power-down";
+				arm,psci-suspend-param = <0x40000003>;
+				entry-latency-us = <350>;
+				exit-latency-us = <461>;
+				min-residency-us = <1890>;
+				local-timer-stop;
+			};
+
+			LITTLE_CPU_RPD: little-rail-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "little-rail-power-down";
+				arm,psci-suspend-param = <0x40000004>;
+				entry-latency-us = <360>;
+				exit-latency-us = <531>;
+				min-residency-us = <3934>;
+				local-timer-stop;
+			};
+
+			BIG_CPU_PD: big-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "big-power-down";
+				arm,psci-suspend-param = <0x40000003>;
+				entry-latency-us = <264>;
+				exit-latency-us = <621>;
+				min-residency-us = <952>;
+				local-timer-stop;
+			};
+
+			BIG_CPU_RPD: big-rail-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "big-rail-power-down";
+				arm,psci-suspend-param = <0x40000004>;
+				entry-latency-us = <702>;
+				exit-latency-us = <1061>;
+				min-residency-us = <4488>;
+				local-timer-stop;
+			};
+
+			CLUSTER_PD: cluster-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "cluster-power-down";
+				arm,psci-suspend-param = <0x400000F4>;
+				entry-latency-us = <3263>;
+				exit-latency-us = <6562>;
+				min-residency-us = <9987>;
+				local-timer-stop;
+			};
+		};
 	};
 
 	pmu {
Signature · 1 line
2.17.1
Acked-by on v1 1/8
#2 lore raw

Re: [PATCHv1 1/8] arm64: dts: Fix various entry-method properties to reflect documentation

In reply to Amit Kucheria
Quoted 9 lines · Amit Kucheria

The idle-states binding documentation[1] mentions that the 'entry-method' property is required on 64-bit platforms and must be set to "psci".

We fixed up all uses of the entry-method property in
commit e9880240e4f4 ("arm64: dts: Fix various entry-method properties to reflect documentation"). But a new one has appeared. Fix it up.

Cc Sudeep Holla <[email protected]>

Ah right, new ones always appear for short period. Anyways,

Quoted 21 lines
---
 arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +1 -2
index 2896bbcfa3bb..42e7822a0227 100644
@@ -51,7 +51,7 @@
 		 * PSCI node is not added default, U-boot will add missing
 		 * parts if it determines to use PSCI.
 		 */
-		entry-method = "arm,psci";
+		entry-method = "psci";
 
 		CPU_PH20: cpu-ph20 {
 			compatible = "arm,idle-state";
--

2.17.1

Acked-by on v1 2/8
#7 lore raw

Re: [PATCHv1 2/8] Documentation: arm: Link idle-states binding to code

In reply to Amit Kucheria
Quoted 18 lines · Amit Kucheria

The enable-method needs to be psci for the psci_cpuidle_ops to be correctly registered.

Add a note to the binding documentation on where to find the declaration of the enable-method since it is a macro and escapes any attempts to grep for it.

---
 Documentation/devicetree/bindings/arm/idle-states.txt | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/arm/idle-states.txt +0 -0
index 45730ba60af5..3a42335a6f3d 100644

Documentation/devicetree/bindings/arm/idle-states.txt processor idle states, defined as device tree nodes, are listed. · line 245

Quoted 7 lines
Documentation/devicetree/bindings/arm/idle-states.txt +4 -0
@@ -239,6 +239,10 @@ processor idle states, defined as device tree nodes, are listed.
 			# On ARM v8 64-bit this property is required and must
 			  be:
 			   - "psci"
+			     (This assumes that the enable-method is "psci"
+			     in the cpu node[6] that then uses the
+			     CPUIDLE_METHOD_OF_DECLARE macro to setup the
+			     psci_cpuidle_ops callbacks)

I don't prefer to refer some Linux implementation macros in DT bindings as they may disappear any day. Further, the use of CPUIDLE_METHOD_OF_DECLARE is restricted to ARM32 platforms only. So better to move it down without the reference to the above macro or any kernel implementation details if possible.

Documentation/devicetree/bindings/arm/idle-states.txt processor idle states, defined as device tree nodes, are listed. · line 247

Quoted 2 lines
Documentation/devicetree/bindings/arm/idle-states.txt +0 -0
 			# On ARM 32-bit systems this property is optional
 

Something like:
"This assumes that the "enable-method" property is set to "psci" in in the cpu node[6] and use this property to set up the CPU idle management in OS PM implementations"

With something on these line, you can add:

--
Regards,
Sudeep

#26 lore raw

Re: [PATCHv1 7/8] arm64: dts: qcom: msm8998: Add PSCI cpuidle low power states

In reply to Amit Kucheria
Quoted 13 lines · Amit Kucheria

Add device bindings for cpuidle states for cpu devices.

---
 arch/arm64/boot/dts/qcom/msm8998.dtsi | 32 +++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +0 -0
index 3fd0769fe648..208281f318e2 100644

arch/arm64/boot/dts/qcom/msm8998.dtsi line 81

Quoted 4 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +1 -0
@@ -78,6 +78,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x0>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;

For some reason, I was expecting the big cores to come first, but according to /proc/cpuinfo, cores 0-3 are part 0x801, while cores 4-7 are part 0x800.

According to https://github.com/pytorch/cpuinfo/blob/master/src/arm/uarch.c

0x801 = Low-power Kryo 260 / 280 "Silver" -> Cortex-A53
0x800 = High-performance Kryo 260 (r10p2) / Kryo 280 (r10p1) "Gold" -> Cortex-A73

Quoted 63 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +7 -0
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L2_0: l2-cache {
@@ -97,6 +98,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x1>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L1_I_1: l1-icache {
@@ -112,6 +114,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x2>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L1_I_2: l1-icache {
@@ -127,6 +130,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x3>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L1_I_3: l1-icache {
@@ -142,6 +146,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x100>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L2_1: l2-cache {
@@ -161,6 +166,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x101>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L1_I_101: l1-icache {
@@ -176,6 +182,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x102>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L1_I_102: l1-icache {
@@ -191,6 +198,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x103>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L1_I_103: l1-icache {
@@ -238,6 +246,30 @@
 				};
 			};
 		};

arch/arm64/boot/dts/qcom/msm8998.dtsi line 258

Quoted 10 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +10 -0
+
+		idle-states {
+			entry-method="psci";
+
+			LITTLE_CPU_PD: little-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "little-power-down";
+				arm,psci-suspend-param = <0x00000002>;
+				entry-latency-us = <43>;
+				exit-latency-us = <43>;

Little cores have higher latency (+5%) than big cores?

Quoted 4 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +4 -0
+				min-residency-us = <200>;
+				local-timer-stop;
+			};
+

arch/arm64/boot/dts/qcom/msm8998.dtsi line 272

Quoted 10 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +10 -0
+			BIG_CPU_PD: big-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "big-power-down";
+				arm,psci-suspend-param = <0x00000002>;
+				entry-latency-us = <41>;
+				exit-latency-us = <41>;
+				min-residency-us = <200>;
+				local-timer-stop;
+			};
+		};

What is the simplest way to test this patch?

Regards.

#27 lore raw

Re: [PATCHv1 7/8] arm64: dts: qcom: msm8998: Add PSCI cpuidle low power states

Quoted 24 lines · Marc Gonzalez
Quoted 13 lines · Amit Kucheria

Add device bindings for cpuidle states for cpu devices.

---
 arch/arm64/boot/dts/qcom/msm8998.dtsi | 32 +++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +0 -0
index 3fd0769fe648..208281f318e2 100644

arch/arm64/boot/dts/qcom/msm8998.dtsi line 81

Quoted 4 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +1 -0
@@ -78,6 +78,7 @@
                      compatible = "arm,armv8";
                      reg = <0x0 0x0>;
                      enable-method = "psci";
+                     cpu-idle-states = <&LITTLE_CPU_PD>;

For some reason, I was expecting the big cores to come first, but according to /proc/cpuinfo, cores 0-3 are part 0x801, while cores 4-7 are part 0x800.

Quoted 4 lines

According to https://github.com/pytorch/cpuinfo/blob/master/src/arm/uarch.c

0x801 = Low-power Kryo 260 / 280 "Silver" -> Cortex-A53
0x800 = High-performance Kryo 260 (r10p2) / Kryo 280 (r10p1) "Gold" -> Cortex-A73

Hmm, did I mess up the order of the big and LITTLE cores? I'll take a look again.

Quoted 91 lines
Quoted 63 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +7 -0
                      efficiency = <1024>;
                      next-level-cache = <&L2_0>;
                      L2_0: l2-cache {
@@ -97,6 +98,7 @@
                      compatible = "arm,armv8";
                      reg = <0x0 0x1>;
                      enable-method = "psci";
+                     cpu-idle-states = <&LITTLE_CPU_PD>;
                      efficiency = <1024>;
                      next-level-cache = <&L2_0>;
                      L1_I_1: l1-icache {
@@ -112,6 +114,7 @@
                      compatible = "arm,armv8";
                      reg = <0x0 0x2>;
                      enable-method = "psci";
+                     cpu-idle-states = <&LITTLE_CPU_PD>;
                      efficiency = <1024>;
                      next-level-cache = <&L2_0>;
                      L1_I_2: l1-icache {
@@ -127,6 +130,7 @@
                      compatible = "arm,armv8";
                      reg = <0x0 0x3>;
                      enable-method = "psci";
+                     cpu-idle-states = <&LITTLE_CPU_PD>;
                      efficiency = <1024>;
                      next-level-cache = <&L2_0>;
                      L1_I_3: l1-icache {
@@ -142,6 +146,7 @@
                      compatible = "arm,armv8";
                      reg = <0x0 0x100>;
                      enable-method = "psci";
+                     cpu-idle-states = <&BIG_CPU_PD>;
                      efficiency = <1536>;
                      next-level-cache = <&L2_1>;
                      L2_1: l2-cache {
@@ -161,6 +166,7 @@
                      compatible = "arm,armv8";
                      reg = <0x0 0x101>;
                      enable-method = "psci";
+                     cpu-idle-states = <&BIG_CPU_PD>;
                      efficiency = <1536>;
                      next-level-cache = <&L2_1>;
                      L1_I_101: l1-icache {
@@ -176,6 +182,7 @@
                      compatible = "arm,armv8";
                      reg = <0x0 0x102>;
                      enable-method = "psci";
+                     cpu-idle-states = <&BIG_CPU_PD>;
                      efficiency = <1536>;
                      next-level-cache = <&L2_1>;
                      L1_I_102: l1-icache {
@@ -191,6 +198,7 @@
                      compatible = "arm,armv8";
                      reg = <0x0 0x103>;
                      enable-method = "psci";
+                     cpu-idle-states = <&BIG_CPU_PD>;
                      efficiency = <1536>;
                      next-level-cache = <&L2_1>;
                      L1_I_103: l1-icache {
@@ -238,6 +246,30 @@
                              };
                      };
              };

arch/arm64/boot/dts/qcom/msm8998.dtsi line 258

Quoted 10 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +10 -0
+
+             idle-states {
+                     entry-method="psci";
+
+                     LITTLE_CPU_PD: little-power-down {
+                             compatible = "arm,idle-state";
+                             idle-state-name = "little-power-down";
+                             arm,psci-suspend-param = <0x00000002>;
+                             entry-latency-us = <43>;
+                             exit-latency-us = <43>;

Little cores have higher latency (+5%) than big cores?

Quoted 4 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +4 -0
+                             min-residency-us = <200>;
+                             local-timer-stop;
+                     };
+

arch/arm64/boot/dts/qcom/msm8998.dtsi line 272

Quoted 10 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +10 -0
+                     BIG_CPU_PD: big-power-down {
+                             compatible = "arm,idle-state";
+                             idle-state-name = "big-power-down";
+                             arm,psci-suspend-param = <0x00000002>;
+                             entry-latency-us = <41>;
+                             exit-latency-us = <41>;
+                             min-residency-us = <200>;
+                             local-timer-stop;
+                     };
+             };
Quoted 1 line

What is the simplest way to test this patch?

You should be able to see state transitions in /sys/devices/cpu/cpu?/cpuidle/*/*

$ grep "" /sys/devices/cpu/cpu?/cpuidle/*/*

And if you have an instrumented board with power rails exposed, you could measure the cpu rails with and without some load on the CPUs. That'd help us tune the values too, in the future.

Regards,
Amit

#28 lore raw

Re: [PATCHv1 7/8] arm64: dts: qcom: msm8998: Add PSCI cpuidle low power states

Quoted 25 lines · Amit Kucheria
Quoted 24 lines · Marc Gonzalez
Quoted 13 lines · Amit Kucheria

Add device bindings for cpuidle states for cpu devices.

---
  arch/arm64/boot/dts/qcom/msm8998.dtsi | 32 +++++++++++++++++++++++++++
  1 file changed, 32 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +0 -0
index 3fd0769fe648..208281f318e2 100644

arch/arm64/boot/dts/qcom/msm8998.dtsi line 81

Quoted 4 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +1 -0
@@ -78,6 +78,7 @@
                       compatible = "arm,armv8";
                       reg = <0x0 0x0>;
                       enable-method = "psci";
+                     cpu-idle-states = <&LITTLE_CPU_PD>;

For some reason, I was expecting the big cores to come first, but according to /proc/cpuinfo, cores 0-3 are part 0x801, while cores 4-7 are part 0x800.

Quoted 7 lines
Quoted 4 lines

According to https://github.com/pytorch/cpuinfo/blob/master/src/arm/uarch.c

0x801 = Low-power Kryo 260 / 280 "Silver" -> Cortex-A53
0x800 = High-performance Kryo 260 (r10p2) / Kryo 280 (r10p1) "Gold" -> Cortex-A73

Hmm, did I mess up the order of the big and LITTLE cores? I'll take a look again.

Sorry for being unclear. I was saying I expected the opposite, but it appears the order in your patch is correct ;-)

Little cores have higher latency (+5%) than big cores?

Regards.

#29 lore raw

Re: [PATCHv1 7/8] arm64: dts: qcom: msm8998: Add PSCI cpuidle low power states

Quoted 30 lines · Marc Gonzalez
Quoted 27 lines · Amit Kucheria
Quoted 26 lines · Marc Gonzalez
Quoted 13 lines · Amit Kucheria

Add device bindings for cpuidle states for cpu devices.

---
  arch/arm64/boot/dts/qcom/msm8998.dtsi | 32 +++++++++++++++++++++++++++
  1 file changed, 32 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +0 -0
index 3fd0769fe648..208281f318e2 100644

arch/arm64/boot/dts/qcom/msm8998.dtsi line 81

Quoted 4 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +1 -0
@@ -78,6 +78,7 @@
                       compatible = "arm,armv8";
                       reg = <0x0 0x0>;
                       enable-method = "psci";
+                     cpu-idle-states = <&LITTLE_CPU_PD>;

For some reason, I was expecting the big cores to come first, but according to /proc/cpuinfo, cores 0-3 are part 0x801, while cores 4-7 are part 0x800.

According to https://github.com/pytorch/cpuinfo/blob/master/src/arm/uarch.c

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

0x801 = Low-power Kryo 260 / 280 "Silver" -> Cortex-A53
0x800 = High-performance Kryo 260 (r10p2) / Kryo 280 (r10p1) "Gold" -> Cortex-A73

Hmm, did I mess up the order of the big and LITTLE cores? I'll take a look again.

Sorry for being unclear. I was saying I expected the opposite, but it appears the order in your patch is correct ;-)

OK :-)

Quoted 1 line

Little cores have higher latency (+5%) than big cores?

No, that is a result of me naively converting the downstream numbers into cpuidle parameters for upstream. There is scope for tuning those numbers with more instrumentation. My hope is that we will attract more contributions once the basic idle states have landed upstream i.e. change the story from "cpuidle isn't supported in upstream QC platforms" to "cpuidle needs some tuning"

Regards,
Amit

Reviewed-by on v1 1/8
#3 lore raw

Re: [PATCHv1 1/8] arm64: dts: Fix various entry-method properties to reflect documentation

In reply to Amit Kucheria

On Fri 10 May 04:29 PDT 2019, Amit Kucheria wrote:

Subject indicates pluralism, but this fixes a specific platform (board?). I think you should update that.

Quoted 9 lines

The idle-states binding documentation[1] mentions that the 'entry-method' property is required on 64-bit platforms and must be set to "psci".

We fixed up all uses of the entry-method property in
commit e9880240e4f4 ("arm64: dts: Fix various entry-method properties to reflect documentation"). But a new one has appeared. Fix it up.

Cc Sudeep Holla <[email protected]>

The message looks good though, so with a new subject you have my:

Regards,
Bjorn

Quoted 21 lines
---
 arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +1 -1
index 2896bbcfa3bb..42e7822a0227 100644
@@ -51,7 +51,7 @@
 		 * PSCI node is not added default, U-boot will add missing
 		 * parts if it determines to use PSCI.
 		 */
-		entry-method = "arm,psci";
+		entry-method = "psci";
 
 		CPU_PH20: cpu-ph20 {
 			compatible = "arm,idle-state";
Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCHv1 1/8] arm64: dts: Fix various entry-method properties to reflect documentation

Quoted 5 lines · Bjorn Andersson

On Fri 10 May 04:29 PDT 2019, Amit Kucheria wrote:

Subject indicates pluralism, but this fixes a specific platform (board?). I think you should update that.

Copy paste from the previous cleanup commit :-) Will fix.

Quoted 8 lines
Quoted 8 lines

The idle-states binding documentation[1] mentions that the 'entry-method' property is required on 64-bit platforms and must be set to "psci".

We fixed up all uses of the entry-method property in
commit e9880240e4f4 ("arm64: dts: Fix various entry-method properties to reflect documentation"). But a new one has appeared. Fix it up.

Quoted 5 lines
Quoted 1 line
Cc Sudeep Holla <[email protected]>

The message looks good though, so with a new subject you have my:

Thanks

Quoted 22 lines
Quoted 22 lines
---
 arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +1 -2
index 2896bbcfa3bb..42e7822a0227 100644
@@ -51,7 +51,7 @@
               * PSCI node is not added default, U-boot will add missing
               * parts if it determines to use PSCI.
               */
-             entry-method = "arm,psci";
+             entry-method = "psci";
 
              CPU_PH20: cpu-ph20 {
                      compatible = "arm,idle-state";
--

2.17.1

Reviewed-by on v1 1/8
#5 lore raw

Re: [PATCHv1 1/8] arm64: dts: Fix various entry-method properties to reflect documentation

In reply to Amit Kucheria
Quoted 1 line · Amit Kucheria

The idle-states binding documentation[1] mentions that the

This [1] reference is a null pointer ;)

Other than that:

Quoted 29 lines

'entry-method' property is required on 64-bit platforms and must be set to "psci".

We fixed up all uses of the entry-method property in
commit e9880240e4f4 ("arm64: dts: Fix various entry-method properties to reflect documentation"). But a new one has appeared. Fix it up.

---
 arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +1 -1
index 2896bbcfa3bb..42e7822a0227 100644
@@ -51,7 +51,7 @@
 		 * PSCI node is not added default, U-boot will add missing
 		 * parts if it determines to use PSCI.
 		 */
-		entry-method = "arm,psci";
+		entry-method = "psci";
 
 		CPU_PH20: cpu-ph20 {
 			compatible = "arm,idle-state";
Signature · 1 line
2.17.1
#35 lore raw
In reply to Amit Kucheria
Quoted 7 lines · Amit Kucheria

Fix up a few entry-method="psci" issues and then add cpuidle low power states for msm8996, msm8998, qcs404, sdm845. All these have been tested to only make sure that the C-states are entered from Linux point-of-view.

We will continue to add more states and make power measurements to tweak some of these numbers, but getting these merged will allow other people to use these platforms to work on cpuidle, eas and related topics.

Hello Amit,

Your subject looks a bit weird:
[PATCHv1 0/8] qcom: Add cpuidle to some platforms

No need to specify reroll count if it is the first version, and there is usually a space between PATCH and reroll count.

git format-patch [(--reroll-count|-v) <n>]
it should take care of this for you.

Please also add all that is on either to: or cc: in any patch in the series as
cc: for the cover letter.

Kind regards,
Niklas

Quoted 30 lines

Amit Kucheria (6):
arm64: dts: Fix various entry-method properties to reflect
documentation
Documentation: arm: Link idle-states binding to code
arm64: dts: qcom: msm8916: Add entry-method property for the
idle-states node
arm64: dts: qcom: msm8916: Use more generic idle state names
arm64: dts: qcom: msm8996: Add PSCI cpuidle low power states
arm64: dts: qcom: msm8998: Add PSCI cpuidle low power states

Niklas Cassel (1):
arm64: dts: qcom: qcs404: Add PSCI cpuidle low power states

Raju P.L.S.S.S.N (1):
arm64: dts: qcom: sdm845: Add PSCI cpuidle low power states

 .../devicetree/bindings/arm/idle-states.txt   |  7 +++
 .../arm64/boot/dts/freescale/fsl-ls1028a.dtsi |  2 +-
 arch/arm64/boot/dts/qcom/msm8916.dtsi         | 13 ++--
 arch/arm64/boot/dts/qcom/msm8996.dtsi         | 28 +++++++++
 arch/arm64/boot/dts/qcom/msm8998.dtsi         | 32 ++++++++++
 arch/arm64/boot/dts/qcom/qcs404.dtsi          | 18 ++++++
 arch/arm64/boot/dts/qcom/sdm845.dtsi          | 62 +++++++++++++++++++
 7 files changed, 156 insertions(+), 6 deletions(-)

--
2.17.1

Reviewed-by on v1 3/8
#9 lore raw

Re: [PATCHv1 3/8] arm64: dts: qcom: msm8916: Add entry-method property for the idle-states node

In reply to Amit Kucheria
Quoted 14 lines · Amit Kucheria

The idle-states binding documentation[1] mentions that the 'entry-method' property is required on 64-bit platforms and must be set to "psci".

---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/msm8916.dtsi +0 -0
index 0803ca8c02da..ded1052e5693 100644

arch/arm64/boot/dts/qcom/msm8916.dtsi line 162

Quoted 5 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +2 -0
@@ -158,6 +158,8 @@
 		};
 
 		idle-states {
+			entry-method="psci";
+

Please add a space before and after "=".

With that:

Quoted 6 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +0 -0
 			CPU_SPC: spc {
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x40000002>;
Signature · 1 line
2.17.1
#12 lore raw

Re: [PATCHv1 4/8] arm64: dts: qcom: msm8916: Use more generic idle state names

In reply to Amit Kucheria
Quoted 50 lines · Amit Kucheria

Instead of using Qualcomm-specific terminology, use generic node names for the idle states that are easier to understand. Move the description into the "idle-state-name" property.

---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +4 -4
index ded1052e5693..400b609bb3fd 100644
@@ -110,7 +110,7 @@
 			reg = <0x0>;
 			next-level-cache = <&L2_0>;
 			enable-method = "psci";
-			cpu-idle-states = <&CPU_SPC>;
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			clocks = <&apcs>;
 			operating-points-v2 = <&cpu_opp_table>;
 			#cooling-cells = <2>;
@@ -122,7 +122,7 @@
 			reg = <0x1>;
 			next-level-cache = <&L2_0>;
 			enable-method = "psci";
-			cpu-idle-states = <&CPU_SPC>;
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			clocks = <&apcs>;
 			operating-points-v2 = <&cpu_opp_table>;
 			#cooling-cells = <2>;
@@ -134,7 +134,7 @@
 			reg = <0x2>;
 			next-level-cache = <&L2_0>;
 			enable-method = "psci";
-			cpu-idle-states = <&CPU_SPC>;
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			clocks = <&apcs>;
 			operating-points-v2 = <&cpu_opp_table>;
 			#cooling-cells = <2>;
@@ -146,7 +146,7 @@
 			reg = <0x3>;
 			next-level-cache = <&L2_0>;
 			enable-method = "psci";
-			cpu-idle-states = <&CPU_SPC>;
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			clocks = <&apcs>;
 			operating-points-v2 = <&cpu_opp_table>;
 			#cooling-cells = <2>;

arch/arm64/boot/dts/qcom/msm8916.dtsi line 161

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +0 -0
@@ -160,8 +160,9 @@
 		idle-states {
 			entry-method="psci";

Please add a space before and after "=".

arch/arm64/boot/dts/qcom/msm8916.dtsi line 163

Quoted 3 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +1 -1
-			CPU_SPC: spc {
+			CPU_SLEEP_0: cpu-sleep-0 {

While I like your idea of using power state names from Server Base System Architecture document (SBSA) where applicable, does each qcom power state have a matching state in SBSA?

These are the qcom power states:
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/Documentation/devicetree/bindings/arm/msm/lpm-levels.txt?h=msm-4.4#n53

Note that qcom defines:
"wfi", "retention", "gdhs", "pc", "fpc"
while SBSA simply defines "idle_standby" (aka wfi), "idle_retention", "sleep".

Unless you know the equivalent name for each qcom power state (perhaps several qcom power states are really the same SBSA state?), I think that you should omit the renaming from this patch series.

Quoted 8 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +1 -0
 				compatible = "arm,idle-state";
+				idle-state-name = "standalone-power-collapse";
 				arm,psci-suspend-param = <0x40000002>;
 				entry-latency-us = <130>;
 				exit-latency-us = <150>;
Signature · 1 line
2.17.1
#19 lore raw

Re: [PATCHv1 5/8] arm64: dts: qcom: qcs404: Add PSCI cpuidle low power states

In reply to Amit Kucheria
Quoted 50 lines · Amit Kucheria

From: Niklas Cassel <[email protected]>

Add device bindings for cpuidle states for cpu devices.

[amit: rename the idle-states to more generic names and fixups]

---
 arch/arm64/boot/dts/qcom/qcs404.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/qcom/qcs404.dtsi +4 -0
index e8fd26633d57..369c59c35bc7 100644
@@ -30,6 +30,7 @@
 			compatible = "arm,cortex-a53";
 			reg = <0x100>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -38,6 +39,7 @@
 			compatible = "arm,cortex-a53";
 			reg = <0x101>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -46,6 +48,7 @@
 			compatible = "arm,cortex-a53";
 			reg = <0x102>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -54,6 +57,7 @@
 			compatible = "arm,cortex-a53";
 			reg = <0x103>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			next-level-cache = <&L2_0>;
 		};
 

arch/arm64/boot/dts/qcom/qcs404.dtsi line 70

Quoted 6 lines
arch/arm64/boot/dts/qcom/qcs404.dtsi +3 -0
@@ -61,6 +65,20 @@
 			compatible = "cache";
 			cache-level = <2>;
 		};
+
+		idle-states {
+			entry-method="psci";

Please add a space before and after "=".

arch/arm64/boot/dts/qcom/qcs404.dtsi line 72

Quoted 2 lines
arch/arm64/boot/dts/qcom/qcs404.dtsi +2 -0
+
+			CPU_SLEEP_0: cpu-sleep-0 {

Regarding CPU_SLEEP_0 vs CPU_PC, see my comment on patch 4/8.

Quoted 15 lines
arch/arm64/boot/dts/qcom/qcs404.dtsi +9 -0
+				compatible = "arm,idle-state";
+				idle-state-name = "standalone-power-collapse";
+				arm,psci-suspend-param = <0x40000003>;
+				entry-latency-us = <125>;
+				exit-latency-us = <180>;
+				min-residency-us = <595>;
+				local-timer-stop;
+			};
+		};
 	};
 
 	firmware {
Signature · 1 line
2.17.1
#22 lore raw

Re: [PATCHv1 6/8] arm64: dts: qcom: msm8996: Add PSCI cpuidle low power states

In reply to Amit Kucheria
Quoted 44 lines · Amit Kucheria

Add device bindings for cpuidle states for cpu devices.

---
 arch/arm64/boot/dts/qcom/msm8996.dtsi | 28 +++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +4 -0
index c761269caf80..b615bcb9e351 100644
@@ -95,6 +95,7 @@
                      compatible = "qcom,kryo";
                      reg = <0x0 0x0>;
                      enable-method = "psci";
+                     cpu-idle-states = <&LITTLE_CPU_PD>;
                      next-level-cache = <&L2_0>;
                      L2_0: l2-cache {
                            compatible = "cache";
@@ -107,6 +108,7 @@
                      compatible = "qcom,kryo";
                      reg = <0x0 0x1>;
                      enable-method = "psci";
+                     cpu-idle-states = <&LITTLE_CPU_PD>;
                      next-level-cache = <&L2_0>;
              };
 
@@ -115,6 +117,7 @@
                      compatible = "qcom,kryo";
                      reg = <0x0 0x100>;
                      enable-method = "psci";
+                     cpu-idle-states = <&BIG_CPU_PD>;
                      next-level-cache = <&L2_1>;
                      L2_1: l2-cache {
                            compatible = "cache";
@@ -127,6 +130,7 @@
                      compatible = "qcom,kryo";
                      reg = <0x0 0x101>;
                      enable-method = "psci";
+                     cpu-idle-states = <&BIG_CPU_PD>;
                      next-level-cache = <&L2_1>;
              };
 

arch/arm64/boot/dts/qcom/msm8996.dtsi line 160

Quoted 6 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +3 -0
@@ -151,6 +155,30 @@
                              };
                      };
              };
+
+             idle-states {
+                     entry-method="psci";

Please add a space before and after "=".

arch/arm64/boot/dts/qcom/msm8996.dtsi line 162

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +2 -0
+
+                     LITTLE_CPU_PD: little-power-down {

In Documentation/devicetree/bindings/arm/idle-states.txt they seem to use labels such as CPU_SLEEP_0_0 for the first cluster and CPU_SLEEP_1_0 for the second cluster.

Please also consider my comment in patch 4/8.

arch/arm64/boot/dts/qcom/msm8996.dtsi line 167

Quoted 5 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +5 -0
+                             compatible = "arm,idle-state";
+                             idle-state-name = "standalone-power-collapse";
+                             arm,psci-suspend-param = <0x00000004>;
+                             entry-latency-us = <40>;
+                             exit-latency-us = <40>;

Where did you get the latency values from? Downstream seems to use qcom,latency-us = <80> for "fpc".

(Sure downstream also defines "fpc-def", but that seems to require additional psci code/calls that doesn't exist upstream.)

arch/arm64/boot/dts/qcom/msm8996.dtsi line 169

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +2 -0
+                             min-residency-us = <300>;
+                             local-timer-stop;

Are you sure that the local timer is stopped?
the equivalent DT property to "local-timer-stop" in downstream is "qcom,use-broadcast-timer", and this property seems to be missing from this node:
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/arch/arm/boot/dts/qcom/msm8996-pm.dtsi?h=msm-4.4#n158

You could try to remove "local-timer-stop", if it is really needed, then the system should hang without this property.

arch/arm64/boot/dts/qcom/msm8996.dtsi line 177

Quoted 8 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +8 -0
+                     };
+
+                     BIG_CPU_PD: big-power-down {
+                             compatible = "arm,idle-state";
+                             idle-state-name = "standalone-power-collapse";
+                             arm,psci-suspend-param = <0x00000004>;
+                             entry-latency-us = <40>;
+                             exit-latency-us = <40>;

Where did you get the latency values from? Downstream seems to use qcom,latency-us = <80> for "fpc".

(Sure downstream also defines "fpc-def", but that seems to require additional psci code/calls that doesn't exist upstream.)

arch/arm64/boot/dts/qcom/msm8996.dtsi line 179

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +2 -0
+                             min-residency-us = <300>;
+                             local-timer-stop;

Are you sure that the local timer is stopped?
the equivalent DT property to "local-timer-stop" in downstream is "qcom,use-broadcast-timer", and this property seems to be missing from this node:
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/arch/arm/boot/dts/qcom/msm8996-pm.dtsi?h=msm-4.4#n247

You could try to remove "local-timer-stop", if it is really needed, then the system should hang without this property.

Quoted 8 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +2 -1
+                     };
+             };
      };
 
      thermal-zones {
--

2.17.1

#30 lore raw

Re: [PATCHv1 7/8] arm64: dts: qcom: msm8998: Add PSCI cpuidle low power states

In reply to Amit Kucheria
Quoted 77 lines · Amit Kucheria

Add device bindings for cpuidle states for cpu devices.

---
 arch/arm64/boot/dts/qcom/msm8998.dtsi | 32 +++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +8 -0
index 3fd0769fe648..208281f318e2 100644
@@ -78,6 +78,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x0>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L2_0: l2-cache {
@@ -97,6 +98,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x1>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L1_I_1: l1-icache {
@@ -112,6 +114,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x2>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L1_I_2: l1-icache {
@@ -127,6 +130,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x3>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L1_I_3: l1-icache {
@@ -142,6 +146,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x100>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L2_1: l2-cache {
@@ -161,6 +166,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x101>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L1_I_101: l1-icache {
@@ -176,6 +182,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x102>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L1_I_102: l1-icache {
@@ -191,6 +198,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x103>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L1_I_103: l1-icache {

arch/arm64/boot/dts/qcom/msm8998.dtsi line 251

Quoted 6 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +3 -0
@@ -238,6 +246,30 @@
 				};
 			};
 		};
+
+		idle-states {
+			entry-method="psci";

Please add a space before and after "=".

arch/arm64/boot/dts/qcom/msm8998.dtsi line 253

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +2 -0
+
+			LITTLE_CPU_PD: little-power-down {

In Documentation/devicetree/bindings/arm/idle-states.txt they seem to use labels such as CPU_SLEEP_0_0 for the first cluster and CPU_SLEEP_1_0 for the second cluster.

Please also consider my comment in patch 4/8.

arch/arm64/boot/dts/qcom/msm8998.dtsi line 255

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +2 -0
+				compatible = "arm,idle-state";
+				idle-state-name = "little-power-down";

Since all other idle-state-name in this series uses the qualcomm terminology for idle states, I think this should as well.

arch/arm64/boot/dts/qcom/msm8998.dtsi line 256

Quoted 1 line
arch/arm64/boot/dts/qcom/msm8998.dtsi +1 -0
+				arm,psci-suspend-param = <0x00000002>;

PSCI suspend param 0x2 is actually "retention":
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/arch/arm/boot/dts/qcom/msm8998-pm.dtsi?h=msm-4.4#n155

So it actually feels incorrect to call this "power-down".

All other patches in this series has added support for standalone power collapse, so why not add support for SPC rather than retention?

(For SPC arm,psci-suspend-param should be <0x40000003> .)

arch/arm64/boot/dts/qcom/msm8998.dtsi line 258

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +2 -0
+				entry-latency-us = <43>;
+				exit-latency-us = <43>;

Shouldn't the latency be <86> ?
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/arch/arm/boot/dts/qcom/msm8998-pm.dtsi?h=msm-4.4#n157
AFAICT downstream assigns the exit_latency to what is parses from "qcom,latency-us":
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/drivers/cpuidle/lpm-levels.c?h=msm-4.4#n1712

arch/arm64/boot/dts/qcom/msm8998.dtsi line 260

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +2 -0
+				min-residency-us = <200>;
+				local-timer-stop;

Are you sure that the local timer is stopped?
the equivalent DT property to "local-timer-stop" in downstream is "qcom,use-broadcast-timer", and this property seems to be missing from this node:
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/arch/arm/boot/dts/qcom/msm8998-pm.dtsi?h=msm-4.4#n153

You could try to remove "local-timer-stop", if it is really needed, then the system should hang without this property.

Quoted 18 lines
arch/arm64/boot/dts/qcom/msm8998.dtsi +12 -0
+			};
+
+			BIG_CPU_PD: big-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "big-power-down";
+				arm,psci-suspend-param = <0x00000002>;
+				entry-latency-us = <41>;
+				exit-latency-us = <41>;
+				min-residency-us = <200>;
+				local-timer-stop;
+			};
+		};
 	};
 
 	firmware {
Signature · 1 line
2.17.1
#33 lore raw

Re: [PATCHv1 8/8] arm64: dts: qcom: sdm845: Add PSCI cpuidle low power states

In reply to Amit Kucheria
Quoted 129 lines · Amit Kucheria

From: "Raju P.L.S.S.S.N" <[email protected]>

Add device bindings for cpuidle states for cpu devices.

[amit: rename the idle-states to more generic names and fixups]

---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 62 ++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +50 -0
index 5308f1671824..2c8c54e4bd77 100644
@@ -119,6 +119,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x0>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD &LITTLE_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 0>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_0>;
@@ -136,6 +137,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x100>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD &LITTLE_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 0>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_100>;
@@ -150,6 +152,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x200>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD &LITTLE_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 0>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_200>;
@@ -164,6 +167,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x300>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD &LITTLE_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 0>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_300>;
@@ -178,6 +182,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x400>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD &BIG_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 1>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_400>;
@@ -192,6 +197,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x500>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD &BIG_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 1>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_500>;
@@ -206,6 +212,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x600>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD &BIG_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 1>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_600>;
@@ -220,6 +227,7 @@
 			compatible = "qcom,kryo385";
 			reg = <0x0 0x700>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD &BIG_CPU_RPD &CLUSTER_PD>;
 			qcom,freq-domain = <&cpufreq_hw 1>;
 			#cooling-cells = <2>;
 			next-level-cache = <&L2_700>;
@@ -228,6 +236,60 @@
 				next-level-cache = <&L3_0>;
 			};
 		};
+
+		idle-states {
+			entry-method = "psci";
+
+			LITTLE_CPU_PD: little-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "little-power-down";
+				arm,psci-suspend-param = <0x40000003>;
+				entry-latency-us = <350>;
+				exit-latency-us = <461>;
+				min-residency-us = <1890>;
+				local-timer-stop;
+			};
+
+			LITTLE_CPU_RPD: little-rail-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "little-rail-power-down";
+				arm,psci-suspend-param = <0x40000004>;
+				entry-latency-us = <360>;
+				exit-latency-us = <531>;
+				min-residency-us = <3934>;
+				local-timer-stop;
+			};
+
+			BIG_CPU_PD: big-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "big-power-down";
+				arm,psci-suspend-param = <0x40000003>;
+				entry-latency-us = <264>;
+				exit-latency-us = <621>;
+				min-residency-us = <952>;
+				local-timer-stop;
+			};
+
+			BIG_CPU_RPD: big-rail-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "big-rail-power-down";
+				arm,psci-suspend-param = <0x40000004>;
+				entry-latency-us = <702>;
+				exit-latency-us = <1061>;
+				min-residency-us = <4488>;
+				local-timer-stop;

arch/arm64/boot/dts/qcom/sdm845.dtsi line 290

Quoted 10 lines
arch/arm64/boot/dts/qcom/sdm845.dtsi +10 -0
+			};
+
+			CLUSTER_PD: cluster-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "cluster-power-down";
+				arm,psci-suspend-param = <0x400000F4>;
+				entry-latency-us = <3263>;
+				exit-latency-us = <6562>;
+				min-residency-us = <9987>;
+				local-timer-stop;

I'm surprised that this power state is not defined in downstream node qcom,pm-cluster@0
https://source.codeaurora.org/quic/la/kernel/msm-4.9/tree/arch/arm64/boot/dts/qcom/sdm845-pm.dtsi?h=msm-4.9

Also note that Ulf and Lina's cluster idling patch series:
https://patchwork.kernel.org/project/linux-arm-msm/list/?series=117055
hasn't been merged yet.

Is it really safe to add a cluster power state without this series?

If the firmware fails to enter this cluster power state, won't the cpuidle governor continue to try to enter this power state? Thus basically disabling cpuidle, since the governor will never try to enter the per cpu power states?

It would be interesting with statistics of how many times we've tried to enter this power state, together with how many times entering this power state has failed. If this percentage is very high, then we probably need the cluster idling patch series before enabling this power state.

Quoted 8 lines
arch/arm64/boot/dts/qcom/sdm845.dtsi +2 -0
+			};
+		};
 	};
 
 	pmu {
Signature · 1 line
2.17.1
#13 lore raw

Re: [PATCHv1 4/8] arm64: dts: qcom: msm8916: Use more generic idle state names

In reply to Niklas Cassel
Quoted 68 lines · Niklas Cassel
Quoted 50 lines · Amit Kucheria

Instead of using Qualcomm-specific terminology, use generic node names for the idle states that are easier to understand. Move the description into the "idle-state-name" property.

---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +4 -4
index ded1052e5693..400b609bb3fd 100644
@@ -110,7 +110,7 @@
                      reg = <0x0>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;
@@ -122,7 +122,7 @@
                      reg = <0x1>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;
@@ -134,7 +134,7 @@
                      reg = <0x2>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;
@@ -146,7 +146,7 @@
                      reg = <0x3>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;

arch/arm64/boot/dts/qcom/msm8916.dtsi line 161

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +0 -0
@@ -160,8 +160,9 @@
              idle-states {
                      entry-method="psci";

Please add a space before and after "=".

arch/arm64/boot/dts/qcom/msm8916.dtsi line 163

Quoted 3 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +1 -1
-                     CPU_SPC: spc {
+                     CPU_SLEEP_0: cpu-sleep-0 {

While I like your idea of using power state names from Server Base System Architecture document (SBSA) where applicable, does each qcom power state have a matching state in SBSA?

These are the qcom power states:
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/Documentation/devicetree/bindings/arm/msm/lpm-levels.txt?h=msm-4.4#n53

Quoted 7 lines

Note that qcom defines:
"wfi", "retention", "gdhs", "pc", "fpc"
while SBSA simply defines "idle_standby" (aka wfi), "idle_retention", "sleep".

Unless you know the equivalent name for each qcom power state (perhaps several qcom power states are really the same SBSA state?), I think that you should omit the renaming from this patch series.

That is what SLEEP_0, SLEEP_1, SLEEP_2 could be used for.

IOW, all these qcom definitions are nicely represented in the state-name and we could simply stick to SLEEP_0, SLEEP_1 for the node names. There is wide variability in the the names of the qcom idle states across SoC families downstream, so I'd argue against using those for the node names.

Just for cpu states (non-wfi) I see the use of the following names downstream across families. The C<num> seems to come from x86 world[1]:

- C4, standalone power collapse (spc)
- C4, power collapse (fpc)
- C2D, retention
- C3, power collapse (pc)
- C4, rail power collapse (rail-pc)

[1] https://www.hardwaresecrets.com/everything-you-need-to-know-about-the-cpu-c-states-power-saving-modes/

Quoted 8 lines
Quoted 8 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +1 -1
                              compatible = "arm,idle-state";
+                             idle-state-name = "standalone-power-collapse";
                              arm,psci-suspend-param = <0x40000002>;
                              entry-latency-us = <130>;
                              exit-latency-us = <150>;
--

2.17.1

#14 lore raw

Re: [PATCHv1 4/8] arm64: dts: qcom: msm8916: Use more generic idle state names

Quoted 73 lines · Amit Kucheria
Quoted 72 lines · Niklas Cassel
Quoted 50 lines · Amit Kucheria

Instead of using Qualcomm-specific terminology, use generic node names for the idle states that are easier to understand. Move the description into the "idle-state-name" property.

---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +4 -4
index ded1052e5693..400b609bb3fd 100644
@@ -110,7 +110,7 @@
                      reg = <0x0>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;
@@ -122,7 +122,7 @@
                      reg = <0x1>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;
@@ -134,7 +134,7 @@
                      reg = <0x2>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;
@@ -146,7 +146,7 @@
                      reg = <0x3>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;

arch/arm64/boot/dts/qcom/msm8916.dtsi line 161

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +0 -0
@@ -160,8 +160,9 @@
              idle-states {
                      entry-method="psci";

Please add a space before and after "=".

arch/arm64/boot/dts/qcom/msm8916.dtsi line 163

Quoted 3 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +1 -1
-                     CPU_SPC: spc {
+                     CPU_SLEEP_0: cpu-sleep-0 {

While I like your idea of using power state names from Server Base System Architecture document (SBSA) where applicable, does each qcom power state have a matching state in SBSA?

These are the qcom power states:
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/Documentation/devicetree/bindings/arm/msm/lpm-levels.txt?h=msm-4.4#n53

Note that qcom defines:
"wfi", "retention", "gdhs", "pc", "fpc"
while SBSA simply defines "idle_standby" (aka wfi), "idle_retention", "sleep".

Quoted 5 lines
Quoted 3 lines

Unless you know the equivalent name for each qcom power state (perhaps several qcom power states are really the same SBSA state?), I think that you should omit the renaming from this patch series.

That is what SLEEP_0, SLEEP_1, SLEEP_2 could be used for.

Ok, sounds good to me.

Quoted 11 lines

IOW, all these qcom definitions are nicely represented in the state-name and we could simply stick to SLEEP_0, SLEEP_1 for the node names. There is wide variability in the the names of the qcom idle states across SoC families downstream, so I'd argue against using those for the node names.

Just for cpu states (non-wfi) I see the use of the following names downstream across families. The C<num> seems to come from x86 world[1]:

Quoted 7 lines

- C4, standalone power collapse (spc)
- C4, power collapse (fpc)
- C2D, retention
- C3, power collapse (pc)
- C4, rail power collapse (rail-pc)

[1] https://www.hardwaresecrets.com/everything-you-need-to-know-about-the-cpu-c-states-power-saving-modes/

Indeed, there seems to be mixed names used, I've also seen "fpc-def".

So, you have convinced me.

Kind regards,
Niklas

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +1 -1
                              compatible = "arm,idle-state";
+                             idle-state-name = "standalone-power-collapse";
                              arm,psci-suspend-param = <0x40000002>;
                              entry-latency-us = <130>;
                              exit-latency-us = <150>;
--

2.17.1

#23 lore raw

Re: [PATCHv1 6/8] arm64: dts: qcom: msm8996: Add PSCI cpuidle low power states

In reply to Niklas Cassel
Quoted 55 lines · Niklas Cassel
Quoted 44 lines · Amit Kucheria

Add device bindings for cpuidle states for cpu devices.

---
 arch/arm64/boot/dts/qcom/msm8996.dtsi | 28 +++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +4 -0
index c761269caf80..b615bcb9e351 100644
@@ -95,6 +95,7 @@
                      compatible = "qcom,kryo";
                      reg = <0x0 0x0>;
                      enable-method = "psci";
+                     cpu-idle-states = <&LITTLE_CPU_PD>;
                      next-level-cache = <&L2_0>;
                      L2_0: l2-cache {
                            compatible = "cache";
@@ -107,6 +108,7 @@
                      compatible = "qcom,kryo";
                      reg = <0x0 0x1>;
                      enable-method = "psci";
+                     cpu-idle-states = <&LITTLE_CPU_PD>;
                      next-level-cache = <&L2_0>;
              };
 
@@ -115,6 +117,7 @@
                      compatible = "qcom,kryo";
                      reg = <0x0 0x100>;
                      enable-method = "psci";
+                     cpu-idle-states = <&BIG_CPU_PD>;
                      next-level-cache = <&L2_1>;
                      L2_1: l2-cache {
                            compatible = "cache";
@@ -127,6 +130,7 @@
                      compatible = "qcom,kryo";
                      reg = <0x0 0x101>;
                      enable-method = "psci";
+                     cpu-idle-states = <&BIG_CPU_PD>;
                      next-level-cache = <&L2_1>;
              };
 

arch/arm64/boot/dts/qcom/msm8996.dtsi line 160

Quoted 6 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +3 -0
@@ -151,6 +155,30 @@
                              };
                      };
              };
+
+             idle-states {
+                     entry-method="psci";

Please add a space before and after "=".

Quoted 6 lines

arch/arm64/boot/dts/qcom/msm8996.dtsi line 162

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +2 -0
+
+                     LITTLE_CPU_PD: little-power-down {

In Documentation/devicetree/bindings/arm/idle-states.txt they seem to use labels such as CPU_SLEEP_0_0 for the first cluster and CPU_SLEEP_1_0 for the second cluster.

Will change this to LITTLE_CPU_SLEEP_0. I feel there is value in keeping BIG and LITTLE in the name explicitly to improve readability when correlating the idle state parameters to each CPU.

Quoted 12 lines

Please also consider my comment in patch 4/8.

arch/arm64/boot/dts/qcom/msm8996.dtsi line 167

Quoted 5 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +5 -0
+                             compatible = "arm,idle-state";
+                             idle-state-name = "standalone-power-collapse";
+                             arm,psci-suspend-param = <0x00000004>;
+                             entry-latency-us = <40>;
+                             exit-latency-us = <40>;

Where did you get the latency values from? Downstream seems to use qcom,latency-us = <80> for "fpc".

Will fix.

Quoted 6 lines

(Sure downstream also defines "fpc-def", but that seems to require additional psci code/calls that doesn't exist upstream.)

arch/arm64/boot/dts/qcom/msm8996.dtsi line 169

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +2 -0
+                             min-residency-us = <300>;
+                             local-timer-stop;
Quoted 8 lines

Are you sure that the local timer is stopped?
the equivalent DT property to "local-timer-stop" in downstream is "qcom,use-broadcast-timer", and this property seems to be missing from this node:
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/arch/arm/boot/dts/qcom/msm8996-pm.dtsi?h=msm-4.4#n158

You could try to remove "local-timer-stop", if it is really needed, then the system should hang without this property.

Will review and test again.

Quoted 37 lines

arch/arm64/boot/dts/qcom/msm8996.dtsi line 177

Quoted 9 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +8 -0
+                     };
+
+                     BIG_CPU_PD: big-power-down {
+                             compatible = "arm,idle-state";
+                             idle-state-name = "standalone-power-collapse";
+                             arm,psci-suspend-param = <0x00000004>;
+                             entry-latency-us = <40>;
+                             exit-latency-us = <40>;

Where did you get the latency values from? Downstream seems to use qcom,latency-us = <80> for "fpc".

(Sure downstream also defines "fpc-def", but that seems to require additional psci code/calls that doesn't exist upstream.)

arch/arm64/boot/dts/qcom/msm8996.dtsi line 179

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +2 -0
+                             min-residency-us = <300>;
+                             local-timer-stop;

Are you sure that the local timer is stopped?
the equivalent DT property to "local-timer-stop" in downstream is "qcom,use-broadcast-timer", and this property seems to be missing from this node:
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/arch/arm/boot/dts/qcom/msm8996-pm.dtsi?h=msm-4.4#n247

You could try to remove "local-timer-stop", if it is really needed, then the system should hang without this property.

Quoted 8 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +2 -1
+                     };
+             };
      };
 
      thermal-zones {
--

2.17.1

Acked-by on v1 3/8
#10 lore raw

Re: [PATCHv1 3/8] arm64: dts: qcom: msm8916: Add entry-method property for the idle-states node

In reply to Amit Kucheria
Quoted 5 lines · Amit Kucheria

The idle-states binding documentation[1] mentions that the 'entry-method' property is required on 64-bit platforms and must be set to "psci".

Quoted 18 lines
---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/msm8916.dtsi +2 -0
index 0803ca8c02da..ded1052e5693 100644
@@ -158,6 +158,8 @@
 		};
 
 		idle-states {
+			entry-method="psci";
+
 			CPU_SPC: spc {
 				compatible = "arm,idle-state";
 				arm,psci-suspend-param = <0x40000002>;
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Acked-by on v1 4/8
#17 lore raw

Re: [PATCHv1 4/8] arm64: dts: qcom: msm8916: Use more generic idle state names

In reply to Amit Kucheria
Quoted 5 lines · Amit Kucheria

Instead of using Qualcomm-specific terminology, use generic node names for the idle states that are easier to understand. Move the description into the "idle-state-name" property.

Quoted 56 lines
---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +6 -5
index ded1052e5693..400b609bb3fd 100644
@@ -110,7 +110,7 @@
 			reg = <0x0>;
 			next-level-cache = <&L2_0>;
 			enable-method = "psci";
-			cpu-idle-states = <&CPU_SPC>;
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			clocks = <&apcs>;
 			operating-points-v2 = <&cpu_opp_table>;
 			#cooling-cells = <2>;
@@ -122,7 +122,7 @@
 			reg = <0x1>;
 			next-level-cache = <&L2_0>;
 			enable-method = "psci";
-			cpu-idle-states = <&CPU_SPC>;
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			clocks = <&apcs>;
 			operating-points-v2 = <&cpu_opp_table>;
 			#cooling-cells = <2>;
@@ -134,7 +134,7 @@
 			reg = <0x2>;
 			next-level-cache = <&L2_0>;
 			enable-method = "psci";
-			cpu-idle-states = <&CPU_SPC>;
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			clocks = <&apcs>;
 			operating-points-v2 = <&cpu_opp_table>;
 			#cooling-cells = <2>;
@@ -146,7 +146,7 @@
 			reg = <0x3>;
 			next-level-cache = <&L2_0>;
 			enable-method = "psci";
-			cpu-idle-states = <&CPU_SPC>;
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			clocks = <&apcs>;
 			operating-points-v2 = <&cpu_opp_table>;
 			#cooling-cells = <2>;
@@ -160,8 +160,9 @@
 		idle-states {
 			entry-method="psci";
 
-			CPU_SPC: spc {
+			CPU_SLEEP_0: cpu-sleep-0 {
 				compatible = "arm,idle-state";
+				idle-state-name = "standalone-power-collapse";
 				arm,psci-suspend-param = <0x40000002>;
 				entry-latency-us = <130>;
 				exit-latency-us = <150>;
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Acked-by on v1 5/8
#20 lore raw

Re: [PATCHv1 5/8] arm64: dts: qcom: qcs404: Add PSCI cpuidle low power states

In reply to Amit Kucheria
Quoted 9 lines · Amit Kucheria

From: Niklas Cassel <[email protected]>

Add device bindings for cpuidle states for cpu devices.

[amit: rename the idle-states to more generic names and fixups]

Quoted 62 lines
---
 arch/arm64/boot/dts/qcom/qcs404.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/qcom/qcs404.dtsi +18 -0
index e8fd26633d57..369c59c35bc7 100644
@@ -30,6 +30,7 @@
 			compatible = "arm,cortex-a53";
 			reg = <0x100>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -38,6 +39,7 @@
 			compatible = "arm,cortex-a53";
 			reg = <0x101>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -46,6 +48,7 @@
 			compatible = "arm,cortex-a53";
 			reg = <0x102>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -54,6 +57,7 @@
 			compatible = "arm,cortex-a53";
 			reg = <0x103>;
 			enable-method = "psci";
+			cpu-idle-states = <&CPU_SLEEP_0>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -61,6 +65,20 @@
 			compatible = "cache";
 			cache-level = <2>;
 		};
+
+		idle-states {
+			entry-method="psci";
+
+			CPU_SLEEP_0: cpu-sleep-0 {
+				compatible = "arm,idle-state";
+				idle-state-name = "standalone-power-collapse";
+				arm,psci-suspend-param = <0x40000003>;
+				entry-latency-us = <125>;
+				exit-latency-us = <180>;
+				min-residency-us = <595>;
+				local-timer-stop;
+			};
+		};
 	};
 
 	firmware {
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#24 lore raw

Re: [PATCHv1 6/8] arm64: dts: qcom: msm8996: Add PSCI cpuidle low power states

In reply to Amit Kucheria
Quoted 12 lines · Amit Kucheria

Add device bindings for cpuidle states for cpu devices.

---
 arch/arm64/boot/dts/qcom/msm8996.dtsi | 28 +++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +0 -0
index c761269caf80..b615bcb9e351 100644

arch/arm64/boot/dts/qcom/msm8996.dtsi line 98

Quoted 4 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +1 -0
@@ -95,6 +95,7 @@
 			compatible = "qcom,kryo";
 			reg = <0x0 0x0>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;

It is the same micro architecture, the CPUS differ by their max OPP. Shall we call it really little?

I take the opportunity to report the capacity-dmips-mhz attribute is missing. The max capacity computation is not triggered, thus the scheduler see the same capacity for both cluster even if one has less OPP. Adding capacity-dmips-mhz = <1024>; to all CPUs will fix it.

Quoted 59 lines
arch/arm64/boot/dts/qcom/msm8996.dtsi +27 -0
 			next-level-cache = <&L2_0>;
 			L2_0: l2-cache {
 			      compatible = "cache";
@@ -107,6 +108,7 @@
 			compatible = "qcom,kryo";
 			reg = <0x0 0x1>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			next-level-cache = <&L2_0>;
 		};
 
@@ -115,6 +117,7 @@
 			compatible = "qcom,kryo";
 			reg = <0x0 0x100>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			next-level-cache = <&L2_1>;
 			L2_1: l2-cache {
 			      compatible = "cache";
@@ -127,6 +130,7 @@
 			compatible = "qcom,kryo";
 			reg = <0x0 0x101>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			next-level-cache = <&L2_1>;
 		};
 
@@ -151,6 +155,30 @@
 				};
 			};
 		};
+
+		idle-states {
+			entry-method="psci";
+
+			LITTLE_CPU_PD: little-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "standalone-power-collapse";
+				arm,psci-suspend-param = <0x00000004>;
+				entry-latency-us = <40>;
+				exit-latency-us = <40>;
+				min-residency-us = <300>;
+				local-timer-stop;
+			};
+
+			BIG_CPU_PD: big-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "standalone-power-collapse";
+				arm,psci-suspend-param = <0x00000004>;
+				entry-latency-us = <40>;
+				exit-latency-us = <40>;
+				min-residency-us = <300>;
+				local-timer-stop;
+			};
+		};
 	};
 
 	thermal-zones {
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Acked-by on v1 7/8
#31 lore raw

Re: [PATCHv1 7/8] arm64: dts: qcom: msm8998: Add PSCI cpuidle low power states

In reply to Amit Kucheria
Quoted 4 lines · Amit Kucheria

Add device bindings for cpuidle states for cpu devices.

Quoted 104 lines
---
 arch/arm64/boot/dts/qcom/msm8998.dtsi | 32 +++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +32 -0
index 3fd0769fe648..208281f318e2 100644
@@ -78,6 +78,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x0>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L2_0: l2-cache {
@@ -97,6 +98,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x1>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L1_I_1: l1-icache {
@@ -112,6 +114,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x2>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L1_I_2: l1-icache {
@@ -127,6 +130,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x3>;
 			enable-method = "psci";
+			cpu-idle-states = <&LITTLE_CPU_PD>;
 			efficiency = <1024>;
 			next-level-cache = <&L2_0>;
 			L1_I_3: l1-icache {
@@ -142,6 +146,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x100>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L2_1: l2-cache {
@@ -161,6 +166,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x101>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L1_I_101: l1-icache {
@@ -176,6 +182,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x102>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L1_I_102: l1-icache {
@@ -191,6 +198,7 @@
 			compatible = "arm,armv8";
 			reg = <0x0 0x103>;
 			enable-method = "psci";
+			cpu-idle-states = <&BIG_CPU_PD>;
 			efficiency = <1536>;
 			next-level-cache = <&L2_1>;
 			L1_I_103: l1-icache {
@@ -238,6 +246,30 @@
 				};
 			};
 		};
+
+		idle-states {
+			entry-method="psci";
+
+			LITTLE_CPU_PD: little-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "little-power-down";
+				arm,psci-suspend-param = <0x00000002>;
+				entry-latency-us = <43>;
+				exit-latency-us = <43>;
+				min-residency-us = <200>;
+				local-timer-stop;
+			};
+
+			BIG_CPU_PD: big-power-down {
+				compatible = "arm,idle-state";
+				idle-state-name = "big-power-down";
+				arm,psci-suspend-param = <0x00000002>;
+				entry-latency-us = <41>;
+				exit-latency-us = <41>;
+				min-residency-us = <200>;
+				local-timer-stop;
+			};
+		};
 	};
 
 	firmware {
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Acked-by on v1 8/8
#34 lore raw

Re: [PATCHv1 8/8] arm64: dts: qcom: sdm845: Add PSCI cpuidle low power states

In reply to Amit Kucheria
Quoted 11 lines · Amit Kucheria

From: "Raju P.L.S.S.S.N" <[email protected]>

Add device bindings for cpuidle states for cpu devices.

[amit: rename the idle-states to more generic names and fixups]

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#15 lore raw

Re: [PATCHv1 4/8] arm64: dts: qcom: msm8916: Use more generic idle state names

In reply to Niklas Cassel
Quoted 102 lines · Niklas Cassel
Quoted 73 lines · Amit Kucheria
Quoted 72 lines · Niklas Cassel
Quoted 50 lines · Amit Kucheria

Instead of using Qualcomm-specific terminology, use generic node names for the idle states that are easier to understand. Move the description into the "idle-state-name" property.

---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +4 -4
index ded1052e5693..400b609bb3fd 100644
@@ -110,7 +110,7 @@
                      reg = <0x0>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;
@@ -122,7 +122,7 @@
                      reg = <0x1>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;
@@ -134,7 +134,7 @@
                      reg = <0x2>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;
@@ -146,7 +146,7 @@
                      reg = <0x3>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;

arch/arm64/boot/dts/qcom/msm8916.dtsi line 161

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +0 -0
@@ -160,8 +160,9 @@
              idle-states {
                      entry-method="psci";

Please add a space before and after "=".

arch/arm64/boot/dts/qcom/msm8916.dtsi line 163

Quoted 3 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +1 -1
-                     CPU_SPC: spc {
+                     CPU_SLEEP_0: cpu-sleep-0 {

While I like your idea of using power state names from Server Base System Architecture document (SBSA) where applicable, does each qcom power state have a matching state in SBSA?

These are the qcom power states:
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/Documentation/devicetree/bindings/arm/msm/lpm-levels.txt?h=msm-4.4#n53

Note that qcom defines:
"wfi", "retention", "gdhs", "pc", "fpc"
while SBSA simply defines "idle_standby" (aka wfi), "idle_retention", "sleep".

Quoted 5 lines
Quoted 3 lines

Unless you know the equivalent name for each qcom power state (perhaps several qcom power states are really the same SBSA state?), I think that you should omit the renaming from this patch series.

That is what SLEEP_0, SLEEP_1, SLEEP_2 could be used for.

Ok, sounds good to me.

Quoted 11 lines

IOW, all these qcom definitions are nicely represented in the state-name and we could simply stick to SLEEP_0, SLEEP_1 for the node names. There is wide variability in the the names of the qcom idle states across SoC families downstream, so I'd argue against using those for the node names.

Just for cpu states (non-wfi) I see the use of the following names downstream across families. The C<num> seems to come from x86 world[1]:

Quoted 7 lines

- C4, standalone power collapse (spc)
- C4, power collapse (fpc)
- C2D, retention
- C3, power collapse (pc)
- C4, rail power collapse (rail-pc)

[1] https://www.hardwaresecrets.com/everything-you-need-to-know-about-the-cpu-c-states-power-saving-modes/

Quoted 7 lines

Indeed, there seems to be mixed names used, I've also seen "fpc-def".

So, you have convinced me.

Kind regards,
Niklas

Can I take that as a Reviewed-by?

Reviewed-by
#16 lore raw

Re: [PATCHv1 4/8] arm64: dts: qcom: msm8916: Use more generic idle state names

Quoted 105 lines · Amit Kucheria
Quoted 104 lines · Niklas Cassel
Quoted 73 lines · Amit Kucheria
Quoted 72 lines · Niklas Cassel
Quoted 50 lines · Amit Kucheria

Instead of using Qualcomm-specific terminology, use generic node names for the idle states that are easier to understand. Move the description into the "idle-state-name" property.

---
 arch/arm64/boot/dts/qcom/msm8916.dtsi | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +4 -4
index ded1052e5693..400b609bb3fd 100644
@@ -110,7 +110,7 @@
                      reg = <0x0>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;
@@ -122,7 +122,7 @@
                      reg = <0x1>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;
@@ -134,7 +134,7 @@
                      reg = <0x2>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;
@@ -146,7 +146,7 @@
                      reg = <0x3>;
                      next-level-cache = <&L2_0>;
                      enable-method = "psci";
-                     cpu-idle-states = <&CPU_SPC>;
+                     cpu-idle-states = <&CPU_SLEEP_0>;
                      clocks = <&apcs>;
                      operating-points-v2 = <&cpu_opp_table>;
                      #cooling-cells = <2>;

arch/arm64/boot/dts/qcom/msm8916.dtsi line 161

Quoted 2 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +0 -0
@@ -160,8 +160,9 @@
              idle-states {
                      entry-method="psci";

Please add a space before and after "=".

arch/arm64/boot/dts/qcom/msm8916.dtsi line 163

Quoted 3 lines
arch/arm64/boot/dts/qcom/msm8916.dtsi +1 -1
-                     CPU_SPC: spc {
+                     CPU_SLEEP_0: cpu-sleep-0 {

While I like your idea of using power state names from Server Base System Architecture document (SBSA) where applicable, does each qcom power state have a matching state in SBSA?

These are the qcom power states:
https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/Documentation/devicetree/bindings/arm/msm/lpm-levels.txt?h=msm-4.4#n53

Note that qcom defines:
"wfi", "retention", "gdhs", "pc", "fpc"
while SBSA simply defines "idle_standby" (aka wfi), "idle_retention", "sleep".

Quoted 5 lines
Quoted 3 lines

Unless you know the equivalent name for each qcom power state (perhaps several qcom power states are really the same SBSA state?), I think that you should omit the renaming from this patch series.

That is what SLEEP_0, SLEEP_1, SLEEP_2 could be used for.

Ok, sounds good to me.

Quoted 11 lines

IOW, all these qcom definitions are nicely represented in the state-name and we could simply stick to SLEEP_0, SLEEP_1 for the node names. There is wide variability in the the names of the qcom idle states across SoC families downstream, so I'd argue against using those for the node names.

Just for cpu states (non-wfi) I see the use of the following names downstream across families. The C<num> seems to come from x86 world[1]:

Quoted 7 lines

- C4, standalone power collapse (spc)
- C4, power collapse (fpc)
- C2D, retention
- C3, power collapse (pc)
- C4, rail power collapse (rail-pc)

[1] https://www.hardwaresecrets.com/everything-you-need-to-know-about-the-cpu-c-states-power-saving-modes/

Indeed, there seems to be mixed names used, I've also seen "fpc-def".

Quoted 7 lines
Quoted 5 lines

So, you have convinced me.

Kind regards,
Niklas

Can I take that as a Reviewed-by?