Message ID | 20190513192300.653-18-ulf.hansson@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ARM/ARM64: Support hierarchical CPU arrangement for PSCI | expand |
On Mon, May 13, 2019 at 09:22:59PM +0200, Ulf Hansson wrote: > From: Lina Iyer <lina.iyer@linaro.org> > > In the hierarchical layout, we are creating power domains around each CPU > and describes the idle states for them inside the power domain provider > node. Note that, the CPU's idle states still needs to be compatible with > "arm,idle-state". > > Furthermore, represent the CPU cluster as a separate master power domain, > powering the CPU's power domains. The cluster node, contains the idle > states for the cluster and each idle state needs to be compatible with the > "domain-idle-state". > > If the running platform is using a PSCI FW that supports the OS initiated > CPU suspend mode, which likely should be the case unless the PSCI FW is > very old, this change triggers the PSCI driver to enable it. > > Cc: Andy Gross <andy.gross@linaro.org> > Cc: David Brown <david.brown@linaro.org> > Signed-off-by: Lina Iyer <lina.iyer@linaro.org> > Co-developed-by: Ulf Hansson <ulf.hansson@linaro.org> > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> > --- [...] > @@ -166,12 +170,57 @@ > min-residency-us = <2000>; > local-timer-stop; > }; > + > + CLUSTER_RET: cluster-retention { > + compatible = "domain-idle-state"; > + arm,psci-suspend-param = <0x1000010>; > + entry-latency-us = <500>; > + exit-latency-us = <500>; > + min-residency-us = <2000>; > + }; > + > + CLUSTER_PWRDN: cluster-gdhs { > + compatible = "domain-idle-state"; > + arm,psci-suspend-param = <0x1000030>; > + entry-latency-us = <2000>; > + exit-latency-us = <2000>; > + min-residency-us = <6000>; > + }; > }; > }; I was trying to understand the composition of composite state parameters in this series and that made me look at these DT examples. What format does the above platform use ? I tried matching them to both original as well as extended format and I fail to understand. Assuming original format: State power_state PowerLevel StateType StateID SPC 0x40000002 0(core) 0(Retention) 0x2 (Res0 b[29]=1?) CLUSTER_RET 0x1000010 1(clusters) 0(Retention) 0x10 CLUSTER_PWRDN 0x1000030 1(clusters) 0(Retention?) 0x30 Now extended format: State power_state StateType StateID SPC 0x40000002 0(Retention) 0x40000002 (Res0 b[29]=1?) CLUSTER_RET 0x1000010 0(Retention) 0x1000010 CLUSTER_PWRDN 0x1000030 0(Retention?) 0x1000030 What am I missing ? -- Regards, Sudeep
On Tue, Jul 16 2019 at 08:47 -0600, Sudeep Holla wrote: >On Mon, May 13, 2019 at 09:22:59PM +0200, Ulf Hansson wrote: >> From: Lina Iyer <lina.iyer@linaro.org> >> >> In the hierarchical layout, we are creating power domains around each CPU >> and describes the idle states for them inside the power domain provider >> node. Note that, the CPU's idle states still needs to be compatible with >> "arm,idle-state". >> >> Furthermore, represent the CPU cluster as a separate master power domain, >> powering the CPU's power domains. The cluster node, contains the idle >> states for the cluster and each idle state needs to be compatible with the >> "domain-idle-state". >> >> If the running platform is using a PSCI FW that supports the OS initiated >> CPU suspend mode, which likely should be the case unless the PSCI FW is >> very old, this change triggers the PSCI driver to enable it. >> >> Cc: Andy Gross <andy.gross@linaro.org> >> Cc: David Brown <david.brown@linaro.org> >> Signed-off-by: Lina Iyer <lina.iyer@linaro.org> >> Co-developed-by: Ulf Hansson <ulf.hansson@linaro.org> >> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> >> --- > >[...] > >> @@ -166,12 +170,57 @@ >> min-residency-us = <2000>; >> local-timer-stop; >> }; >> + >> + CLUSTER_RET: cluster-retention { >> + compatible = "domain-idle-state"; >> + arm,psci-suspend-param = <0x1000010>; >> + entry-latency-us = <500>; >> + exit-latency-us = <500>; >> + min-residency-us = <2000>; >> + }; >> + >> + CLUSTER_PWRDN: cluster-gdhs { >> + compatible = "domain-idle-state"; >> + arm,psci-suspend-param = <0x1000030>; >> + entry-latency-us = <2000>; >> + exit-latency-us = <2000>; >> + min-residency-us = <6000>; >> + }; >> }; >> }; > >I was trying to understand the composition of composite state parameters >in this series and that made me look at these DT examples. > This was meant to depict a hierarchical state format for OSI. >What format does the above platform use ? I tried matching them to >both original as well as extended format and I fail to understand. >Assuming original format: > State power_state PowerLevel StateType StateID > SPC 0x40000002 0(core) 0(Retention) 0x2 (Res0 b[29]=1?) > CLUSTER_RET 0x1000010 1(clusters) 0(Retention) 0x10 > CLUSTER_PWRDN 0x1000030 1(clusters) 0(Retention?) 0x30 >Now extended format: > State power_state StateType StateID > SPC 0x40000002 0(Retention) 0x40000002 (Res0 b[29]=1?) > CLUSTER_RET 0x1000010 0(Retention) 0x1000010 The composite state would comprise of CPU state and Cluster state. So for the last CPU entering idle - (CLUSTER_RET | SPC) 0x41000012 > CLUSTER_PWRDN 0x1000030 0(Retention?) 0x1000030 > (CLUSTER_PWRDN | SPC) 0x41000032 Hope this helps. Lina
On Tue, Jul 16, 2019 at 02:36:31PM -0600, Lina Iyer wrote: > On Tue, Jul 16 2019 at 08:47 -0600, Sudeep Holla wrote: > > On Mon, May 13, 2019 at 09:22:59PM +0200, Ulf Hansson wrote: > > > From: Lina Iyer <lina.iyer@linaro.org> > > > > > > In the hierarchical layout, we are creating power domains around each CPU > > > and describes the idle states for them inside the power domain provider > > > node. Note that, the CPU's idle states still needs to be compatible with > > > "arm,idle-state". > > > > > > Furthermore, represent the CPU cluster as a separate master power domain, > > > powering the CPU's power domains. The cluster node, contains the idle > > > states for the cluster and each idle state needs to be compatible with the > > > "domain-idle-state". > > > > > > If the running platform is using a PSCI FW that supports the OS initiated > > > CPU suspend mode, which likely should be the case unless the PSCI FW is > > > very old, this change triggers the PSCI driver to enable it. > > > > > > Cc: Andy Gross <andy.gross@linaro.org> > > > Cc: David Brown <david.brown@linaro.org> > > > Signed-off-by: Lina Iyer <lina.iyer@linaro.org> > > > Co-developed-by: Ulf Hansson <ulf.hansson@linaro.org> > > > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> > > > --- > > > > [...] > > > > > @@ -166,12 +170,57 @@ > > > min-residency-us = <2000>; > > > local-timer-stop; > > > }; > > > + > > > + CLUSTER_RET: cluster-retention { > > > + compatible = "domain-idle-state"; > > > + arm,psci-suspend-param = <0x1000010>; > > > + entry-latency-us = <500>; > > > + exit-latency-us = <500>; > > > + min-residency-us = <2000>; > > > + }; > > > + > > > + CLUSTER_PWRDN: cluster-gdhs { > > > + compatible = "domain-idle-state"; > > > + arm,psci-suspend-param = <0x1000030>; > > > + entry-latency-us = <2000>; > > > + exit-latency-us = <2000>; > > > + min-residency-us = <6000>; > > > + }; > > > }; > > > }; > > > > I was trying to understand the composition of composite state parameters > > in this series and that made me look at these DT examples. > > > This was meant to depict a hierarchical state format for OSI. > Hmm, I am more confused. We have 2 formats: original and extended. 1. Original: 31:26 Reserved. Must be zero. 25:24 PowerLevel 23:17 Reserved. Must be zero. 16 StateType 15:0 StateID 2. Extended 31 Reserved. Must be zero. 30 StateType 29:28 Reserved. Must be zero. 27:0 StateID I was trying to match them to that. I think I commented on other patches. I think simple OR logic breaks with extended format easily if StateIDs are not carefully crafted which is not mandated and hence the trouble. The same holds to original format but with PowerLevel, it slightly relaxing things a bit but still it needs to be crafted when firmware decides these parameters. E.g.: what is done with HiKey platform is completely wrong. It's helpful if we want to avoid save/restore for retention states. CPU_PM_CPU_IDLE_ENTER_RETENTION vs CPU_PM_CPU_IDLE_ENTER > > What format does the above platform use ? I tried matching them to > > both original as well as extended format and I fail to understand. > > Assuming original format: > > State power_state PowerLevel StateType StateID > > SPC 0x40000002 0(core) 0(Retention) 0x2 (Res0 b[29]=1?) > > CLUSTER_RET 0x1000010 1(clusters) 0(Retention) 0x10 > > CLUSTER_PWRDN 0x1000030 1(clusters) 0(Retention?) 0x30 > > Now extended format: > > State power_state StateType StateID > > SPC 0x40000002 0(Retention) 0x40000002 (Res0 b[29]=1?) > > CLUSTER_RET 0x1000010 0(Retention) 0x1000010 > The composite state would comprise of CPU state and Cluster state. > So for the last CPU entering idle - > (CLUSTER_RET | SPC) > 0x41000012 > > CLUSTER_PWRDN 0x1000030 0(Retention?) 0x1000030 > > > (CLUSTER_PWRDN | SPC) > 0x41000032 > > Hope this helps. > I just follow OR logic. I have made wrong reference to bit 29 above(I can't read simple 32 bit number anymore :(), it should bit 30 and if this platform follow extended state, then it makes some sense. But I expect CLUSTER_PWRDN also to have bit 30 set. I tried to match to both formats and failed to understand which it follows, so thought of asking. -- Regards, Sudeep
diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi index 0803ca8c02da..1bb33f0326b5 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -110,10 +110,11 @@ reg = <0x0>; next-level-cache = <&L2_0>; enable-method = "psci"; - cpu-idle-states = <&CPU_SPC>; clocks = <&apcs>; operating-points-v2 = <&cpu_opp_table>; #cooling-cells = <2>; + power-domains = <&CPU_PD0>; + power-domain-names = "psci"; }; CPU1: cpu@1 { @@ -122,10 +123,11 @@ reg = <0x1>; next-level-cache = <&L2_0>; enable-method = "psci"; - cpu-idle-states = <&CPU_SPC>; clocks = <&apcs>; operating-points-v2 = <&cpu_opp_table>; #cooling-cells = <2>; + power-domains = <&CPU_PD1>; + power-domain-names = "psci"; }; CPU2: cpu@2 { @@ -134,10 +136,11 @@ reg = <0x2>; next-level-cache = <&L2_0>; enable-method = "psci"; - cpu-idle-states = <&CPU_SPC>; clocks = <&apcs>; operating-points-v2 = <&cpu_opp_table>; #cooling-cells = <2>; + power-domains = <&CPU_PD2>; + power-domain-names = "psci"; }; CPU3: cpu@3 { @@ -146,10 +149,11 @@ reg = <0x3>; next-level-cache = <&L2_0>; enable-method = "psci"; - cpu-idle-states = <&CPU_SPC>; clocks = <&apcs>; operating-points-v2 = <&cpu_opp_table>; #cooling-cells = <2>; + power-domains = <&CPU_PD3>; + power-domain-names = "psci"; }; L2_0: l2-cache { @@ -166,12 +170,57 @@ min-residency-us = <2000>; local-timer-stop; }; + + CLUSTER_RET: cluster-retention { + compatible = "domain-idle-state"; + arm,psci-suspend-param = <0x1000010>; + entry-latency-us = <500>; + exit-latency-us = <500>; + min-residency-us = <2000>; + }; + + CLUSTER_PWRDN: cluster-gdhs { + compatible = "domain-idle-state"; + arm,psci-suspend-param = <0x1000030>; + entry-latency-us = <2000>; + exit-latency-us = <2000>; + min-residency-us = <6000>; + }; }; }; psci { compatible = "arm,psci-1.0"; method = "smc"; + + CPU_PD0: cpu-pd0 { + #power-domain-cells = <0>; + power-domains = <&CLUSTER_PD>; + domain-idle-states = <&CPU_SPC>; + }; + + CPU_PD1: cpu-pd1 { + #power-domain-cells = <0>; + power-domains = <&CLUSTER_PD>; + domain-idle-states = <&CPU_SPC>; + }; + + CPU_PD2: cpu-pd2 { + #power-domain-cells = <0>; + power-domains = <&CLUSTER_PD>; + domain-idle-states = <&CPU_SPC>; + }; + + CPU_PD3: cpu-pd3 { + #power-domain-cells = <0>; + power-domains = <&CLUSTER_PD>; + domain-idle-states = <&CPU_SPC>; + }; + + CLUSTER_PD: cluster-pd { + #power-domain-cells = <0>; + domain-idle-states = <&CLUSTER_RET>, <&CLUSTER_PWRDN>; + }; }; pmu {