Commit Graph

27 Commits

Author SHA1 Message Date
Maulik Shah f68dd7dac0 lpm-levels: Remove kfree for memory allocated with devm_kzalloc
Do not use kfree for memory allocated with devm_kzalloc during
failures as device memory will get freed in device release.

Change-Id: I6c4d3f8ed55ab02e3e70a1fe65452a8817c8b64e
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
2019-07-27 22:08:40 +02:00
syphyr 4be5f1ef2b cpuidle: Remove unnecessary WARN for calculate_residency
WARN:
calculate_residency: Incorrect power attributes for LPM

Change-Id: I186bcd8d8dee5a0c1961770498749c7ef9df7b74
2019-07-27 21:45:56 +02:00
LuK1337 39a771baad Merge tag 'LA.BR.1.3.6-05410-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD
"LA.BR.1.3.6-05410-8976.0"
2018-02-06 13:11:45 +01:00
Mahesh Sivasubramanian f26d726552 drivers: cpuidle: lpm-levels: Fix untrusted pointer dereference.
The list_for_each macro was not used correctly, where the intermediate
variable would be LIST_POISON, resulting in a untrusted pointer
dereference. Switch to using list_for_each_entry_safe to for safe
removal of a list entry.

Change-Id: I0e0fd5dd9f251b5093d6e9d6335387512ec59249
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
2018-01-24 16:29:27 +05:30
LuK1337 fc9499e55a Import latest Samsung release
* Package version: T713XXU2BQCO

Change-Id: I293d9e7f2df458c512d59b7a06f8ca6add610c99
2017-04-18 03:43:52 +02:00
Srinivas Rao L 180479982a cpuidle: lpm-levels: Fix possible null pointer access
Fix possible null pointer access, possible attempt to access
array out of bounds and indentation.

Change-Id: If32501d18f57e50aeb378ed8965bfc3e236a6b2c
Signed-off-by: Srinivas Rao L <lsrao@codeaurora.org>
2016-11-08 16:10:31 +05:30
Raju P.L.S.S.S.N cec5c130c6 lpm-levels: Use minimum residency values for mode selection
The low power mode selection logic has problems while
selecting best mode both in cpu and cluster selection.
When latency requirement is not met, the level selection
loop breaks without selecting another possible shallow
power mode that meets both latency and residency
requirements. The residencies are initialized to ~0
(0xFFFFFFFF) when a particular mode is disabled in idle
context. This results in wrong selection of shallower
mode in suspend context instead of selecting best possible
deepest low power mode (assuming the mode is enabled in
suspend context but disabled in idle context). This can
have impact on power.

The change addresses this by selecting a possible
shallower power mode that can meet the latency criteria.
It also initializes the residencies to 0 when a mode is
not allowed in idle context. This results in selection
of deepest low power mode in suspend context and
saves power.

Change-Id: I90a3496026f92522544a0abd7ffeeeb88f1732f6
Signed-off-by: Raju P.L.S.S.S.N <rplsssn@codeaurora.org>
2016-11-08 16:10:30 +05:30
Archana Sathyakumar 285cdfb61b lpm-levels: Use residency instead of power and energy overhead
The driver looks through all the enabled modes and does energy
calculation runtime before it selects a low power mode to enter.
With residency values, the cpu/cluster can choose the low power
mode as soon as it comes across the low power mode which meets
residency constraint.

Change-Id: I593810a9cf95ead9031bb9b8608b1da78a7b066f
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Signed-off-by: Raju P.L.S.S.S.N <rplsssn@codeaurora.org>
2016-11-08 16:09:35 +05:30
Archana Sathyakumar a57340d9aa lpm-levels: Add reset property for cluster notifications
Add information on which cluster low power mode causing reset of that
cluster level. This data will be used to send out pm notifications.

Change-Id: I4eb4f3cacb590bbc1110770d422dfbfe67bb338a
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
2015-08-11 06:17:48 -07:00
Linux Build Service Account 873f37a248 Merge "lpm-levels: Support cluster pm notifications in PSCI mode" 2015-08-10 22:37:11 -07:00
Archana Sathyakumar 013b82e5dc lpm-levels: Support cluster pm notifications in PSCI mode
Number of devices for each cluster is not available in PSCI mode.
Add this information in the DT and have this information available
in order to support cluster pm notification in PSCI mode as well.

Change-Id: I3328a9fa68df07b6b605bec7a13810007cb3a525
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
2015-08-10 07:22:08 -07:00
Mahesh Sivasubramanian 4a96d743a9 cpuidle: lpm-levels-of: Support for partial goods
On targets, where some hardware CPUs are non functional, the bootloader
might prevent that CPU from being brought out of reset and remove it from
list of supported CPUs. To account for these scenarios, the cpuidle driver
shouldn't throw a error when a CPU phandle doesn't map to a corresponding
logical CPU id.

CRs-fixed: 756327
Change-Id: Ie11c078fb54028fcc3ae973a9cf9fd6d685d295c
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
2015-08-10 19:08:45 +05:30
Mahesh Sivasubramanian b9c0e7b60f cpuidle: lpm-levels: Add support for PSCI
Add support to terminate all low power modes in PSCI. The lpm-levels will
work with version 1.0 of PSCI specification using the OS initiated scheme.
The lpm-levels driver would determine the last man standing and vote into
TZ accordingly.

Change-Id: I7cbe2ded36ab320334dcf3f971fd6d4a36a881bf
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
2015-07-27 16:48:47 +05:30
Archana Sathyakumar ddfac78378 lpm-levels: Add L3 flag to the smc call
For L3 level collapse, the secure level OS needs a flag to clear the
vote to keep L3 active. Send this flag along with L2 flag in the smc
call.

Change-Id: I79794465ff725fb0d37c3519a37a0f8cb04ed441
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
2015-07-27 16:48:39 +05:30
Archana Sathyakumar a81bc97fdd lpm-levels: Support l3 and cbf modes
Add low power mode configuration for l3 and cbf

Change-Id: I871172c0fd7f5a28575d4687bbba31bb88e76753
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
2015-07-27 16:48:35 +05:30
Venkat Devarasetty abc3015db3 cpuidle: lpm-levels: Disable dynamic routing of interrupts
LPM driver routes rpm-smd and mpm interrupts dynamically to the core
that is going to wake up next. For some targets for power reasons
it is recommended to affine these interrupts always to specific cores.

Add option to disable dynamic routing of these interrupts inside LPM
driver.

Change-Id: Ice2059a61f5dd9daf734ff74c86babe3fe133ec0
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
2015-02-10 23:32:19 +05:30
Murali Nalajala 16323e6eef cpu_pm: Add level to the cluster pm notification
Cluster pm notifications without level information increases difficulty
and complexity for the registered drivers to figure out when the last
coherency level is going into power collapse.

Send notifications with level information that allows the registered
drivers to easily determine the cluster level that is going in/out of
power collapse.

There is an issue with this implementation. GIC driver saves and
restores the distributed registers as part of cluster notifications. On
newer platforms there are multiple cluster levels are defined (e.g l2,
cci etc). These cluster level notofications can happen independently.
On MSM platforms GIC is still active while the cluster sleeps in idle,
causing the GIC state to be overwritten with an incorrect previous state
of the interrupts. This leads to a system hang. Do not save and restore
on any L2 and higher cache coherency level sleep entry and exit.

Change-Id: I31918d6383f19e80fe3b064cfaf0b55e16b97eb6
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
2015-01-07 22:31:58 -08:00
Srinivas Rao L 1fd2a2caaf msm: lpm-levels: Initialize last level for cluster at probe
Cluster lpm's last executed level info needs to be initialized at probe.
This data when left uninitialized would result in the top level cluster
having an incorrect, lpm state, view of a child cluster. This incorrect
view could result in one of the following race conditions. CCI could be
programmed to enter a low power mode even though one of the cores is
online. RPM SPM interrupt may be masked by a core that is not the last
core in the system.

Change-Id: I663da7e9b5972ed572546c0d87ce8851ecf8e56b
Signed-off-by: Srinivas Rao L <lsrao@codeaurora.org>
2014-12-22 09:47:30 -08:00
Linux Build Service Account ef21ffcfcc Merge "msm: lpm: Add support for registering lpm clock gating mode" 2014-10-22 15:58:05 -07:00
Murali Nalajala e6ac510186 msm: lpm-levels-of: fix accessing out of bound memory
CPU's lpm level kobjects are dynamically allocated based on the
number of CPU's in that cluster. The kobject's are then indexed
using the cpu number. This results in the driver writing to and
using memory not allocated to it. Fix this by using an index
starting from zero to index into the allocated kobject array.

CRs-fixed: 739886
Change-Id: I033590c89ad800087007ed6ba60fe558c2221767
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
2014-10-17 15:59:47 -07:00
Karthik Parsha 455347d19f msm: lpm: Add support for registering lpm clock gating mode
An SPM is able to support Clock Gating along with the other low power
modes. Add support for parsing clock gating lpm mode in the lpm driver.

Change-Id: Idac6f7d415cfbe9490aef5c7933d72626e15acae
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
2014-10-14 10:35:22 -07:00
Venkat Devarasetty c80cf034c0 msm: lpm-levels-of: avoid NULL pointer dereference
Cpu node name is printed in error case when its matching
node is not found. If cpu_node is NULL we must avoid its
dereference. Move the print statement so that it is not
accessed when cpu node variable is NULL.

Change-Id: I373d668403c61e9fce76d1d5b4d0f225fa277d16
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
2014-08-01 18:53:07 +05:30
Venkat Devarasetty b3cee487aa Revert "msm: add default enable mode option for lpm levels"
This reverts commit b774cded4a.
Change is no more needed as 8939 boots with all low power modes
enabled by default.

Change-Id: Ia70c0f1974c01086ea18bba8015925528bdd4c48
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
2014-06-09 15:28:09 +05:30
Venkat Devarasetty b774cded4a msm: add default enable mode option for lpm levels
With cluster architecture changes all lpm modes are
enabled at boot. There are crashes at boot when all
lpms are enabled at boot. Add an option to enable
only selected modes at boot up.

Change-Id: Iebeab667aad8d12926b7a3a92deb8ca47c68bfb3
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
2014-06-06 13:03:13 +05:30
Praveen Chidambaram dfbc6bef45 msm: lpm_levels: Allow enable/disable LPM for cpus and clusters
Add sysfs interface to allow/disallow low power modes. Every level
specified in the Devicetree for each cpu and cluster will have an
idle_enabled and suspend_enabled option that controls the availability of
the low power mode for CPUIdle and HOTPLUG/Suspend frameworks.

Change-Id: Ic27f3a586eb9992c611411d2a13365b909ae48a3
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
2014-05-22 09:28:51 -06:00
Praveen Chidambaram 1ade5c364e msm: lpm: Support cluster low power modes for cpu hotplug
When all cpus in any cluster are powered down, we would want to do cluster
low power modes and save power draw by devices like L2, associated with the
cluster. Also, bubble up and allow low power modes on top level clusters.

Change-Id: I68bc2ccbb3cff884da9356ef9aad88d5c2207c10
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
2014-05-20 18:55:00 -06:00
Mahesh Sivasubramanian 0bae66c38a msm: lpm-levels: Support for cluster power management
Add power management support for multilevel cluster. The code is redesigned
to support low power modes with multiple hierarchies of clusters.

Change-Id: I0d0142e53bf2fe6152e7791f09bcb4d35a82e461
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
2014-05-20 18:54:35 -06:00