Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1cc0da7 authored by Mahesh Sivasubramanian's avatar Mahesh Sivasubramanian
Browse files

msm: pm: Add support for System PC with multiple online cores.



The current power management code supports System PC during idle only on
the last online core. Rearchitect power management pm code to support
System PC when multiple cores are online.

The existing PM code relies on a levels table to determine the various
sleep modes including the system sleep states. Splitting them into cpu
and system specific levels is a more appropriate representation of the
existing system. As a part of this rearchitecture, the decision to enter
a low power mode is made within lpm_levels module.

To this effect, the lpm_levels directly registers with the cpuidle
framework instead of relying on a glue msm-cpuidle driver. The
functionality of the cpuidle driver was limited to calling into a pm
driver and without providing any additional functionality and is
encapsulated by the lpm-levels driver.

When more than one core is online, the current model prevents entering
idle power collapse on all cores and the deepest sleep mode that a
cpu could enter is standalone power collapse. To achieve better power
savings when several cores are online all the time, it is important for
multiple cores to enter a deeper system sleep state by configuring L2
and RPM.

Each core entering the deepest sleep mode sets a cpumask. The last core
to enter the deepest sleep mode will acquire a lock and will be
responsible for configuring the system low power modes. The last core
going down will configure the system wide resources with the lock held
to prevent race with another core waking up around the same time.

With this change the idle PC becomes more of a soft state where each
core identifies that its safe to enter a system sleep state. The
decision to enter a system sleep mode is based on the next wakeup event
across all cores. Also it should be noted power mode is significantly
lower than what was used for System PC with earlier representation. This
is because the cpu modes represent the latency associated with entering
a given CPU mode only and residency of the system modes are reflected in
the corresponding system level.

Change-Id: I474cc85c6220473fdaa87e14e3b0a199e95d7eb7
Signed-off-by: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
parent a1c4085f
Loading
Loading
Loading
Loading
+91 −29
Original line number Diff line number Diff line
* Low Power Management Levels

The application processor in MSM can do a variety of C-States for low power
management. These C-States are invoked by the CPUIdle framework when the core
becomes idle. But based on the time available until the next scheduled wakeup,
the system can do several low power modes. The combination is captured in the
device tree as lpm-level.
management. The LPM module performs the CPU and System low power modes based
on it latency and residency information of the individual CPU/System low power
levels.

The required nodes for lpm-levels are:
The first level node represents the properties of the system and includes
second level node to represent the low power modes of cpu and system.

[First Level Nodes]
Required properties:

- compatible: "qcom,lpm-levels"
- reg: The numeric level id

The optional nodes for the First level nodes are:
- qcom,no-l2-saw: Indicates if this target has an L2 SAW (SPM and AVS wrapper).
- qcom,default-l2-state: Indicates what the default low power state of the L2
		SAW should be. This property should be mentioned when there is
		a L2 saw.
- qcom,allow-synced-levels:  Indicates if certain low power modes should be
		synchronized across all cores so as to configure a system
		low power mode.

[Second Level Nodes]
Required properties to define CPU low power modes :
- compatible = "qcom,cpu-modes";
- qcom,mode: The sleep mode of the processor, values for the property are:
		"wfi" - Wait for Interrupt
		"ramp_down_and_wfi" - Ramp down and wait for interrupt
		"retention" - Retention
		"standalone_pc" - Standalone power collapse
		"pc" - Power Collapse
		"retention" - Retention
		"pc_suspend" - Suspended Power Collapse
		"pc_no_xo_shutdown" - Power Collapse with no XO shutdown
- qcom,latency-us: The latency in handling the interrupt if this level was
		chosen, in uSec
- qcom,ss-power: The steady state power expelled when the processor is in this
		 level in mWatts
- qcom,energy-overhead: The energy used up in entering and exiting this level
		 in mWatts.uSec
- qcom,time-overhead: The time spent in entering and exiting this level in uS
- qcom,use-broadcast-timer: Indicates that the timer gets reset during power
		collapse and the cpu relies on Broadcast timer for scheduled
		wakeups.

Required propertieis to define System low power mode :
- compatible: "qcom,system-modes"
- qcom,l2: The state of L2 cache. Values are:
		"l2_cache_pc" - L2 cache in power collapse
		"l2_cache_pc_no_rpm" - L2 cache in power collapse. This mode wouldn't inform the RPM
		"l2_cache_pc_no_rpm" - L2 cache in power collapse. This mode
				wouldn't inform the RPM
		"l2_cache_retenetion" - L2 cache in retention
		"l2_cache_gdhs" - L2 cache in GDHS
		"l2_cache_active" - L2 cache in active mode

- qcom,latency-us: The latency in handling the interrupt if this level was
		chosen, in uSec
- qcom,ss-power: The steady state power expelled when the processor is in this
@@ -31,22 +58,57 @@ The required nodes for lpm-levels are:
- qcom,energy-overhead: The energy used up in entering and exiting this level
		in mWatts.uSec
- qcom,time-overhead: The time spent in entering and exiting this level in uS

The optional nodes for lpm-levels are :
-  qcom,no-l2-saw: Indicates if this target has an L2 SAW (SPM and AVS wrapper).
-  qcom,default-l2-state: Indicates what the default low power state of the L2 SAW should be. This property is used only when there is an L2 SAW.
- qcom,min-cpu-mode: The min cpu sleep mode at which the given system level is
		valid. All cpus should have entered this low power mode before
		this system level can be chosen.
- qcom,sync-mode: The entry into this system mode should be synchronized across
		between all online CPUs.
- qcom,send-rpm-sleep-set: The system mode notifies RPM of Apps sleep and should
		send the current sleep set votes and configure MPM before
		entering this low power mode.

Example:

qcom,lpm-levels {
	qcom,no-l2-saw;
	qcom,lpm-level@0 {
		reg = <0>;
		compatible = "qcom,lpm-levels";
		qcom,default-l2-state = "l2_cache_retention";
		#address-cells = <1>;
		#size-cells = <1>;

		qcom,cpu-modes {
			compatible = "qcom,cpu-modes";
			qcom,cpu-mode@0 {
				qcom,mode = "wfi";
		qcom,l2 = "l2_cache_active";
		qcom,latency-us = <100>;
		qcom,ss-power = <650>;
		qcom,energy-overhead = <801>;
		qcom,time-overhead = <200>;
				qcom,latency-us = <1>;
				qcom,ss-power = <715>;
				qcom,energy-overhead = <17700>;
				qcom,time-overhead = <2>;
			};

			qcom,cpu-mode@1 {
				qcom,mode = "retention";
				qcom,latency-us = <35>;
				qcom,ss-power = <542>;
				qcom,energy-overhead = <34920>;
				qcom,time-overhead = <40>;
			};
		};
		qcom,system-modes {
			compatible = "qcom,system-modes";

			qcom,system-mode@0 {
				qcom,l2 = "l2_cache_gdhs";
				qcom,latency-us = <20000>;
				qcom,ss-power = <163>;
				qcom,energy-overhead = <1577736>;
				qcom,time-overhead = <5067>;
			};

			qcom,system-mode@1 {
				qcom,l2 = "l2_cache_pc";
				qcom,latency-us = <30000>;
				qcom,ss-power = <83>;
				qcom,energy-overhead = <2274420>;
				qcom,time-overhead = <6605>;
			};
		};
};
+56 −44
Original line number Diff line number Diff line
@@ -134,57 +134,69 @@
		compatible = "qcom,lpm-levels";
		qcom,default-l2-state = "l2_cache_retention";
		#address-cells = <1>;
		#size-cells = <0>;
		#size-cells = <1>;

		qcom,cpu-modes {
			compatible = "qcom,cpu-modes";

		qcom,lpm-level@0 {
			reg = <0x0>;
			qcom,cpu-mode@0 {
				qcom,mode = "wfi";
			qcom,l2 = "l2_cache_active";
				qcom,latency-us = <1>;
				qcom,ss-power = <715>;
				qcom,energy-overhead = <17700>;
				qcom,time-overhead = <2>;
			};

		qcom,lpm-level@1 {
			reg = <0x1>;
			qcom,cpu-mode@1 {
				qcom,mode = "retention";
			qcom,l2 = "l2_cache_active";
				qcom,latency-us = <35>;
				qcom,ss-power = <542>;
				qcom,energy-overhead = <34920>;
				qcom,time-overhead = <40>;
			};


		qcom,lpm-level@2 {
			reg = <0x2>;
			qcom,cpu-mode@2 {
				qcom,mode = "standalone_pc";
			qcom,l2 = "l2_cache_active";
				qcom,latency-us = <300>;
				qcom,ss-power = <476>;
				qcom,energy-overhead = <225300>;
				qcom,time-overhead = <350>;
			};

		qcom,lpm-level@3 {
			reg = <0x3>;
			qcom,cpu-mode@3 {
				qcom,mode = "pc";
				qcom,latency-us = <500>;
				qcom,ss-power = <400>;
				qcom,energy-overhead = <280000>;
				qcom,time-overhead = <500>;
				qcom,use-broadcast-timer;
			};

		};
		qcom,system-modes {
			compatible = "qcom,system-modes";

			qcom,system-mode@0 {
				qcom,l2 = "l2_cache_gdhs";
			qcom,latency-us = <2817>;
				qcom,latency-us = <20000>;
				qcom,ss-power = <163>;
				qcom,energy-overhead = <1577736>;
				qcom,time-overhead = <5067>;
				qcom,min-cpu-mode= "pc";
				qcom,send-rpm-sleep-set;
				qcom,sync-mode;
			};

		qcom,lpm-level@4 {
			reg = <0x4>;
			qcom,mode = "pc";
			qcom,system-mode@1 {
				qcom,l2 = "l2_cache_pc";
			qcom,latency-us = <3922>;
				qcom,latency-us = <30000>;
				qcom,ss-power = <83>;
				qcom,energy-overhead = <2274420>;
				qcom,time-overhead = <6605>;
				qcom,min-cpu-mode = "pc";
				qcom,send-rpm-sleep-set;
				qcom,sync-mode;
			};
		};
	};

+46 −25
Original line number Diff line number Diff line
@@ -32,34 +32,55 @@
		#address-cells = <1>;
		#size-cells = <0>;

		qcom,lpm-level@0 {
			reg = <0x0>;
		qcom,cpu-modes {
			compatible = "qcom,cpu-modes";
			qcom,cpu-mode@0 {
				qcom,mode = "wfi";
			qcom,l2 = "l2_cache_active";
				qcom,latency-us = <100>;
				qcom,ss-power = <8000>;
				qcom,energy-overhead = <100000>;
				qcom,time-overhead = <1>;
			};

		qcom,lpm-level@1 {
			reg = <0x1>;
			qcom,cpu-mode@1 {
				qcom,mode = "standalone_pc";
			qcom,l2 = "l2_cache_active";
				qcom,latency-us = <2000>;
				qcom,ss-power = <5000>;
				qcom,energy-overhead = <60100000>;
				qcom,time-overhead = <3000>;
			};

		qcom,lpm-level@2 {
			reg = <0x2>;
			qcom,cpu-mode@2 {
				qcom,mode = "pc";
				qcom,latency-us = <30000>;
				qcom,ss-power = <5000>;
				qcom,energy-overhead = <60350000>;
				qcom,time-overhead = <7300>;
			};
		};
		qcom,system-modes {
			compatible = "qcom,system-modes";

			qcom,system-mode@0 {
				qcom,l2 = "l2_cache_pc";
				qcom,latency-us = <2000>;
				qcom,ss-power = <5000>;
				qcom,energy-overhead = <60100000>;
				qcom,time-overhead = <3000>;
				qcom,min-cpu-mode= "standalone_pc";
				qcom,sync-mode;
			};

			qcom,system-mode@1 {
				qcom,l2 = "l2_cache_pc";
				qcom,latency-us = <30000>;
				qcom,ss-power = <5000>;
				qcom,energy-overhead = <60350000>;
				qcom,time-overhead = <7300>;
				qcom,min-cpu-mode= "pc";
				qcom,send-rpm-sleep-set;
				qcom,sync-mode;
			};
		};
	};

+60 −34
Original line number Diff line number Diff line
@@ -111,44 +111,70 @@
		#address-cells = <1>;
		#size-cells = <0>;

		qcom,lpm-level@0 {
			reg = <0x0>;
		qcom,cpu-modes {
			compatible = "qcom,cpu-modes";

			qcom,cpu-mode@0 {
				qcom,mode = "wfi";
			qcom,l2 = "l2_cache_active";
				qcom,latency-us = <1>;
				qcom,ss-power = <530>;
				qcom,energy-overhead = <52800>;
				qcom,time-overhead = <100>;
			};

		qcom,lpm-level@1 {
			reg = <0x1>;
			qcom,cpu-mode@1 {
				qcom,mode = "standalone_pc";
			qcom,l2 = "l2_cache_active";
				qcom,latency-us = <500>;
				qcom,ss-power = <410>;
				qcom,energy-overhead = <603400>;
				qcom,time-overhead = <1200>;
				qcom,use-broadcast-timer;
			};

		qcom,lpm-level@2 {
			reg = <0x2>;
			qcom,cpu-mode@2 {
				qcom,mode = "pc";
				qcom,latency-us = <550>;
				qcom,ss-power = <372>;
				qcom,energy-overhead = <700000>;
				qcom,time-overhead = <1410>;
				qcom,use-broadcast-timer;
			};
		};

		qcom,system-modes {
			compatible = "qcom,system-modes";

			qcom,system-mode@0 {
				qcom,l2 = "l2_cache_gdhs";
				qcom,latency-us = <10700>;
				qcom,ss-power = <372>;
				qcom,energy-overhead = <738750>;
				qcom,time-overhead = <1410>;
				qcom,min-cpu-mode= "pc";
				qcom,send-rpm-sleep-set;
				qcom,sync-mode;
			};

			qcom,system-mode@1 {
				qcom,l2 = "l2_cache_pc_no_rpm";
				qcom,latency-us = <1000>;
				qcom,ss-power = <315>;
				qcom,energy-overhead = <1027150>;
				qcom,time-overhead = <2400>;
				qcom,min-cpu-mode= "standalone_pc";
				qcom,sync-mode;
			};

		qcom,lpm-level@3 {
			reg = <0x3>;
			qcom,mode = "pc";
			qcom,system-mode@2 {
				qcom,l2 = "l2_cache_pc";
			qcom,latency-us = <11000>;
				qcom,latency-us = <12700>;
				qcom,ss-power = <315>;
				qcom,energy-overhead = <1027150>;
				qcom,time-overhead = <2400>;
				qcom,min-cpu-mode= "pc";
				qcom,send-rpm-sleep-set;
				qcom,sync-mode;
			};
		};
	};

+59 −43
Original line number Diff line number Diff line
@@ -113,54 +113,70 @@
		#address-cells = <1>;
		#size-cells = <0>;

		qcom,lpm-level@0 {
			reg = <0x0>;
		qcom,cpu-modes {
			compatible = "qcom,cpu-modes";

			qcom,cpu-mode@0 {
				qcom,mode = "wfi";
			qcom,l2 = "l2_cache_active";
				qcom,latency-us = <1>;
				qcom,ss-power = <530>;
				qcom,energy-overhead = <52800>;
				qcom,time-overhead = <100>;
			};

		qcom,lpm-level@1 {
			reg = <0x1>;
			qcom,cpu-mode@1 {
				qcom,mode = "standalone_pc";
			qcom,l2 = "l2_cache_active";
				qcom,latency-us = <500>;
				qcom,ss-power = <410>;
				qcom,energy-overhead = <603400>;
				qcom,time-overhead = <1200>;
				qcom,use-broadcast-timer;
			};

		qcom,lpm-level@2 {
			reg = <0x2>;
			qcom,cpu-mode@2 {
				qcom,mode = "pc";
				qcom,latency-us = <550>;
				qcom,ss-power = <372>;
				qcom,energy-overhead = <700000>;
				qcom,time-overhead = <1410>;
				qcom,use-broadcast-timer;
			};
		};

		qcom,system-modes {
			compatible = "qcom,system-modes";

			qcom,system-mode@0 {
				qcom,l2 = "l2_cache_gdhs";
				qcom,latency-us = <10700>;
				qcom,ss-power = <372>;
				qcom,energy-overhead = <738750>;
				qcom,time-overhead = <1410>;
				qcom,min-cpu-mode= "pc";
				qcom,send-rpm-sleep-set;
				qcom,sync-mode;
			};

		qcom,lpm-level@3 {
			reg = <0x3>;
			qcom,mode = "pc";
			qcom,system-mode@1 {
				qcom,l2 = "l2_cache_pc_no_rpm";
				qcom,latency-us = <1000>;
				qcom,ss-power = <315>;
				qcom,energy-overhead = <1027150>;
				qcom,time-overhead = <2400>;
				qcom,min-cpu-mode= "standalone_pc";
				qcom,sync-mode;
			};

		qcom,lpm-level@4 {
			reg = <0x4>;
			qcom,mode = "pc";
			qcom,system-mode@2 {
				qcom,l2 = "l2_cache_pc";
			qcom,latency-us = <11000>;
				qcom,latency-us = <12700>;
				qcom,ss-power = <315>;
				qcom,energy-overhead = <1027150>;
				qcom,time-overhead = <2400>;
				qcom,min-cpu-mode= "pc";
				qcom,send-rpm-sleep-set;
				qcom,sync-mode;
			};
		};
	};

Loading