Commit Graph

53 Commits

Author SHA1 Message Date
Mohammed Khajapasha 97c52b7b61 lpm: Free the allocated resource to avoid memory leak
Free the allocated memory for level_name to avoid the
memory leak in regsiter_cpu_lpm_stats().

Change-Id: I24f0feff2e05963986eaaf54610a8a5ed079b692
Signed-off-by: Mohammed Khajapasha <mkhaja@codeaurora.org>
2015-06-09 16:40:50 -07:00
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 91a033ad82 cpuidle: lpm-workarounds: Add module lpm-workarounds
Add new module lpm-workarounds to support workarounds for
low power modes driver. Add workaround support for unvote
CX turbo vote during exit of rpm assisted power collapse.
On some targets rpm bumps up the CX to turbo while
coming out of power collapse, to reduce the power impact
of this the workaround is necessary.

Change-Id: I11b6e96f02dd3a0dec189ee568a1f7baa3e8894a
Signed-off-by: Srinivas Rao L <lsrao@codeaurora.org>
2014-12-29 15:55:35 +05:30
Abhijeet Dharmapurikar 0fad2540ff msm: lpm-levels: use correct enums for level modes
struct lpm_cluster_level's mode is an array of enum representing
SPM low power modes. The current code compares the values in it
with enum msm_pm_sleep_mode which represents cpu sleep modes.

Fix this by comparing mode with SPM low power modes.

Change-Id: I49ae054298f4f8f71a4a4476c541db3ec69935d0
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2014-12-16 10:08:38 -08:00
Karthik Parsha 6220429a63 msm: lpm-levels: Add support for CCI auto hardware clock gating
CCI auto hardware clock gating is exercised independent of CCI
SPM. To support auto hardware clock gating, disable CCI SPM when
clock gating lpm level is chosen.

Change-Id: Iec20be34708c85161675c977153ef7198d926346
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
2014-12-11 09:11:04 -08:00
Karthik Parsha 657774e422 msm: spm: Add support to use SPM for clock gating mode
On targets that support auto clock gating, spm needs to be disabled
for the hardware to do auto clock gating. If auto clock gating is not
supported or not used, spm needs to be left enabled when programmed
for clock gating.

Add driver support to keep the spm enabled, and, if qchannel interface
is present then add driver support to enable spm legacy mode. This
would keep the spm enabled for clock gating. Use the dt flag
qcom,use-spm-clock-gating to determine if spm needs to be used for
clock gating.

Also, fix lpm-levels driver to support clock gating and auto clock gating
modes.

Change-Id: I4c796d7e063633e41910e780ee2a05e5205db0bd
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
2014-11-19 13:01:55 -08:00
Linux Build Service Account 3201425365 Merge "msm: lpm: Fix cpu and cluster pm notifications" 2014-11-13 18:56:45 -08:00
Linux Build Service Account 13c4f09da1 Merge "msm: lpm-levels: Add support for CCI auto hardware clock gating" 2014-11-12 20:51:32 -08:00
Archana Sathyakumar 1c3ce9135b msm: lpm: Fix cpu and cluster pm notifications
Issue:
System hangs as soon as USB is unplugged from the device.
Cpu pm notifications are to be sent only in the power collapse path,
but it is sent when cpu enters any low power modes. This results in
undesired and unexpected behavior.

Send cpu pm notifications only for power collapse and idle path.

Change-Id: I779152cd05c65b116e9ac88856de729c1212fe16
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
2014-11-12 17:28:59 -07:00
Linux Build Service Account 42dc0a7daf Merge "qcom: msm: event-timer: Add eventimer migration framework" 2014-11-12 09:47:23 -08:00
Karthik Parsha 560abc3679 msm: lpm-levels: Add support for CCI auto hardware clock gating
CCI auto hardware clock gating is exercised independent of CCI
SPM. To support auto hardware clock gating, disable CCI SPM when
clock gating lpm level is chosen.

Change-Id: Ice9cfdb9277e8604b9ac02541907caa6d30e160a
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
2014-11-11 12:08:23 -08:00
Murali Nalajala 85ecb4f722 qcom: msm: event-timer: Add eventimer migration framework
Currently, all the event timers are associated to CPU0. These event
timers are not bind to any of the IRQs and always handled(hrtimer)
by CPU0. This event timers framework make sure event timers are
bound to clients IRQs and when the IRQ affinity has changed event
timer framework will make sure to move associated event timer to
a new CPU based on IRQ affinity.

CRs-fixed: 719258
Change-Id: Idbce3d5195655f558f74c208216f75515d235b8e
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
2014-11-09 15:17:50 -08:00
Archana Sathyakumar 57fdc6cd37 msm: lpm: Send cluster pm notifications
Similar to cpu pm notifications, send cluster notifications whenever a
cluster goes into low power mode.  Ensure that cpu pm notifications are
sent out for the all the cpus on the power domain before cluster
notification is sent out.

CRs-fixed: 751893
Change-Id: Ib098d41c4ec750c7af8142bb99977d9b417bf2f0
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
2014-11-07 10:49:26 -07:00
Venkat Devarasetty 9e84f2e110 lpm-levels: Add a NULL check of next event time
The next event value could be NULL if there is no event
queued. Add a NULL check to avoid wrong calculation of
next wakeup time.

Change-Id: I1ddd8db1803c8f88e99c050e8e40fb6cb5326bda
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
2014-10-31 13:58:36 +05:30
Linux Build Service Account 5a1d0037b2 Merge "ARM64: smp: Prevent cluster LPM modes when pending IPIs on cluster CPUs" 2014-10-29 09:20:26 -07:00
Mahesh Sivasubramanian 50711f8b45 ARM64: smp: Prevent cluster LPM modes when pending IPIs on cluster CPUs
LPM modes can fail if there is a pending IPI interrupt at GIC CPU
interface. On some usecases frequent failure of LPM modes can
cause power and performance degradation. Hence, prevent cluster
low power modes when there is a pending IPI on cluster CPUs.

Change-Id: Id8a0ac24e4867ef824e0a6f11d989f1e1a2b0e93
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
2014-10-24 17:10:40 -07:00
Praveen Chidambaram fe6c032d63 msm: spm: Support RPM handshake control bit in SPM
SAW2 3.0 supports RPM handshake using SAW2_SPM_CTL register for the
sleep command in the SPM sequence. This allows a single power collapse
sequence for both cases when we don't want to notify RPM on apps power
down and when we want to.

This implementation is the same across all IPs in the apps processor
subsystem, but only a few SAW modules are allowed to notify RPM and
handshake with RPM when executing the 0x03 sleep command. Disallow and
check incorrect call on SPM, based on the flag provided in the device
tree.

Based on this flag in DT, set the SLP_CMD_MODE bit in SPM_CTL
register. Fail to set the low power mode if we are trying to send
rpm notification for a mode that does not support rpm notification.

Change-Id: I5527bd8da62673d68867842dbd80000d67965e6a
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
2014-10-15 17:31:27 -06:00
Linux Build Service Account 4ad24a1129 Merge "lpm-levels: Move cpuidle tracepoints within lpm_levels" 2014-10-11 18:12:46 -07:00
Linux Build Service Account cd300ee01f Merge "msm: lpm: Fix race condition in entering system level power collapse" 2014-09-13 17:25:37 -07:00
Archana Sathyakumar ba83fb899c lpm-levels: Move cpuidle tracepoints within lpm_levels
Currently the cpuidle driver considers the mode selected by menu
governor for trace events. lpm_levels recalculates the cpu and system
modes within the enter_sleep function and overwrites the menu governor
mode selection with its decision. Due to this other modules that are
dependent on these tracepoints collect incorrect low power mode
information.

Move the tracepoint within lpm_levels such that the mode selected within
lpm-levels is correctly reported and traced.

Change-Id: I9059a107da21ceebe11ae83427d36a28cf3f1a8e
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
2014-09-11 18:37:38 -06:00
Karthik Parsha ce2aba5b4c msm: lpm: Fix race condition in entering system level power collapse
System level power collapse should only be configured from the last core
entering power collapse. Incorrect input parameters, when configuring
system level cluster power collapse, would result in the system having an
inconsistent view of the lpm status of one or more cores in a cluster.
This race condition would allow multiple cores to program the system level
cluster to enter power collapse. As part of configuring the system level
cluster to enter power collapse several operations are performed. Due to
the race condition these operations can end up being executed on a core
that is not the last core in the cluster. This duplicate execution could
result in a system state that is critical and nonrecoverable.

When configuring system level cluster power collapse, use a child mask that
identifies the current low power mode status of the children, to make sure
that the system level cluster power collapse is only configured by the last
child entering power collapse.

The check to see if the core that is attempting to configure system level
cluster for power collapse is indeed the last core, is a critical section.
Protect this check inside a spinlock.

CRs-fixed: 714779
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
Change-Id: Ic44f1e12253ae508aa3a5d4962f77b1408b860f8
2014-09-11 11:38:38 -07:00
Syed Rameez Mustafa a7692d8d88 cpuidle: lpm-levels: Report correct C-states to the scheduler
The scheduler currently receives the low power mode level that a CPU
is about to enter whereby 0 indicates the shallowest sleep state and
higher numbers indicate deeper sleep states. The scheduler, however,
operates on the notion of C-states whereby 0 indicates an active state
and a higher numbers indicate different sleep states. Due to this
mismatch the scheduler is unable to distinguish between an active CPU
and a CPU in the shallowest sleep state. Fix this by translating the
low power mode level to the appropriate C-state before communicating
it to the scheduler.

Change-Id: I60d985626cb799d436172c00861f05538c2b382a
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
2014-09-08 11:29:12 -07:00
Mahesh Sivasubramanian 1ba5d3ee9b cpuidle: lpm-levels: Flush L2 cache when hotplug happens before probe
If CPU hotplug is initiated before probe, the L2 of the cluster is not
configured for any low power mode and is not flushed. This results in data
incoherencies in ramdumps in particular, if the system crashed after.

To ensure that L2 is flushed, flush L2 during hotplug until lpm-levels
module is probed

CRs-fixed: 715757
Change-Id: I0fb203da68e78d4f0c4acf96db9e5863268d1f52
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
2014-08-27 14:02:20 -06:00
Karthik Parsha c7742f7c06 msm: lpm: Ignore cluster level with notify rpm if rpm acks are pending
When selecting a cluster level, if a level can result in sleep set
transition and there are pending rpm acks, then ignore that level in the
search for the best cluster level.

CRs-fixed: 705303
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
Change-Id: I915297b0b74c013bdeb69026e69204e7c6dc39b1
2014-08-14 15:13:51 +05:30
Mahesh Sivasubramanian b15fe8e06e msm: lpm-levels: Fix issue with coresight save/restore
The coresight save/restore functions needs to be called when the L2 of the
respective clusters are placed in power collapse/GDHS. On a multi-cluster
system, keeping track of this using a static variable could result in
incorrect save/restore of CTI registers. Fix by using a variable
associated with a cluster.

Change-Id: Ib4ba5790af2a9e3bc245f1ef5010930b5cf4921c
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
2014-08-06 14:09:46 -06:00
Linux Build Service Account d4a22ea9d3 Merge "Merge remote-tracking branch 'quic/tmp-hmp' into msm-3.10" 2014-07-23 19:19:22 -07:00
Linux Build Service Account df0a158a87 Merge "msm: rpm-smd: Increase the max outstanding sleep set messages to 24" 2014-07-23 14:01:03 -07:00
Srivatsa Vaddagiri 5652270c3f msm: lpm_levels: inform the scheduler about cpu C-states
Scheduler needs to distinguish cpus that are in different C-states.
Having information on C-states, especially the cost of exiting a
particular state will help the scheduler make better task placement
decisions.

This patch extends the msm power management driver to provide required
information to the scheduler.

Change-Id: I569d5f8b3e18b0444e5517be500e82bf27d3d22f
Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
2014-07-22 14:23:02 -07:00
Karthik Parsha 29282e892d msm: rpm-smd: Increase the max outstanding sleep set messages to 24
When sending sleep-set requests send up 24 requests before reading any
acks.  The RX FIFO can hold 24 acks. Increase the threshold to the
max number of acks the FIFO can hold, so as to delay the process of
emptying the FIFO.

Also check and return an err on timeout and propagate that error up the
call chain.

Change-Id: Ic774fad65fbaa1906fcc7c51ab0d8b3766b8a987
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
2014-07-21 13:34:20 -07:00
Archana Sathyakumar 8875045cef lpm-levels: Log cluster_enter event only for non default levels
Only cluster_enter events log for default levels causes
inconsistency. Log them only if the any low power mode is selected.

CRs-fixed: 692014
Change-Id: I5c549c1f9139d67a73e288a0393a19e52e9d2412
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
2014-07-15 15:50:27 -06:00
Linux Build Service Account ad983c2fa6 Merge "lpm_levels: Select mode based on steady state power for hotplug" 2014-07-15 01:51:32 -07:00
Archana Sathyakumar 2eb821458e lpm_levels: Select mode based on steady state power for hotplug
Currently we choose power collapse or standalone power collapse
as default mode for hotplug. Instead select deepest mode based
on the least steady state power.

If lpm isn't probed yet, then check for mode availability for
this spm device and select this mode for cpu hotplug.

Change-Id: Ia54994ae4ed65af20318fdbe68095ac7177ad759
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
2014-07-14 16:53:28 -06:00
Mahesh Sivasubramanian fb54e802a6 cpuidle: lpm-levels: Fix logic in choosing a cluster low power
If atleast one of the core in a cluster is online, the cluster low power
modes should be determined by the idle characteristics. In one scenario,
when the last core to configure the cluster enters the low power modes
as a part of hotlug but the remainder of the cores are online, the
selection of the cluster low power modes should use parameters related
to idle states and not suspend states.

Change-Id: Ia0af8b57f668225736cfe4a7a33436fed6ffcd4a
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
2014-07-10 15:21:04 -06:00
Venkat Devarasetty 1e1a85c422 msm: lpm: do not allow system level modes if pending rpm ack
Do not allow APSS cores to enter system level mode if there
is a pending acknowledge from RPM. At the same time allow
cores to enter individual power collapse as the cpu collapse
overhead time is low as compared to system level modes.

Change-Id: I6bb4048529690b4ceee8555b27444ece6da82e4a
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
2014-07-01 21:44:31 -07:00
Praveen Chidambaram 56f3340c26 msm: lpm-levels: Remove incorrect BUG_ON() called from hotplug path
The cluster_select() code is used for hotplug as well. When cores are
hotplugged as a result of suspend/resume, the cores in the cluster would
be offline, resulting in the cpumask_and() evaluating to 0, resulting
in the control hitting the incorrect BUG_ON().

Change-Id: Ifa4d7e1ee06384a2e371663294bfbe68bb4d523a
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
2014-06-30 09:58:19 -06:00
Praveen Chidambaram acddfa88e7 msm: lpm-levels: Apply QoS requests only to relevant cpus.
Use the PM QoS cpu/cupmask variant to provide a mimimum CPU_DMA_LATENCY
for the requesting kernel modules. Kernel modules may specify individual
cpus/cpumask but mostly can set the IRQ affinity for QoS. The PM QoS
framework distils the requirement and can provide the latency
requirement for each cpu or a collection of cpus.

Change-Id: I5f5465653496427d3d40a25ec46570d3c183239e
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
2014-06-25 14:07:25 -06:00
Linux Build Service Account b0903a72c5 Merge "msm: lpm: check for next wake up against current time" 2014-06-24 14:27:45 -07:00
Mahesh Sivasubramanian d38bbf5417 cpuidle: lpm-levels: Add ftrace logging for idle low power modes
Add ftrace events to log entry/exit of cluster and cpu low power modes.
Also, add events to log parameters passed down to secure code during
power collapse.

Change-Id: I76e2faf63a80155509d6e3e610db1daa611c0b6a
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
2014-06-18 09:46:43 -06:00
Linux Build Service Account 00ddd1e8b7 Merge "lpm-levels: Remove hotplug serialization before cluster initialization" 2014-06-16 18:06:00 -07:00
Venkat Devarasetty 0c2194e659 msm: lpm: check for next wake up against current time
If the next wake up time for a core is less than the
current time then we should not subtract current time
from next event time which results in a large negative
value. In case the earliest event is expired already
then do not enter cluster low power mode.

Change-Id: Iab04ef9fa4a64e76817254f9c6af4af2d80abb26
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
2014-06-16 23:04:31 +05:30
Karthik Parsha 3a6eceeb8f msm: lpm-levels: Allow clock gating even when sleep_disabled is set
The system can boot with all low power modes disabled by setting
sleep_disabled. In this scenario clock gating would also be disabled.
This could lead to thermal conditions that would result in the cores
being hotplugged. Even in the case where all other low power modes are
disabled allow the system to select clock gating as the default level.

Change-Id: I9460dbb417947987a8519813f98ac68de36ba538
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
2014-06-13 16:27:31 -07:00
Archana Sathyakumar 25740ee68d lpm-levels: Remove hotplug serialization before cluster initialization
In the event where cpu hotplug happens before lpm probe completion,
it fails as the per_cpu cluster variables and the remote spin lock
has not been initialized yet.

There is no need to serialize hotplug before reading all the cluster
levels for the target in the probe. Return the default flag and do
not acquire the remote spin lock in lpm_cpu_pre_pc_cb call.

Change-Id: Idbffa9c3a5ca5b4e8edf280760f26558230eb461
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
2014-06-10 17:31:56 -06:00
Karthik Parsha b43f28d4a8 msm: lpm-levels: Match suspend tracking across suspend and resume
When the system enters suspend, this entry is tracked by a variable. Unset
this variable on exiting suspend.

Change-Id: I35a1f2caf38940ef95ad6c9a1627ff107061f0f1
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
2014-06-09 10:37:49 -07:00
Mahesh Sivasubramanian 7d24a55021 msm: lpm-levels: Fix cpu votes for lpm-level nodes
When kernel is booted with lesser than max cpus possible, the lpm
levels' cpu mask does not account for hotplugged cores to be able to
enter a cluster/system low power mode. Fix by accounting for offline
cpus in the levels structure.

Change-Id: Icca70bf64d9faa511ce8611507101889051702a7
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
2014-06-01 11:01:54 -07:00
Linux Build Service Account 162358c79d Merge "lpm_levels: Fix num_childs_in_sync initialization" 2014-05-31 19:44:17 -07:00
Archana Sathyakumar abf45b0929 lpm_levels: Fix num_childs_in_sync initialization
Currently num_childs_in_sync does not get initialized as cluster
lookup returns NULL. Initialize the variable after per_cpu cluster
nodes are initialized.

Change-Id: Iae30debe7c52324d6e2cb666ef96ee894144358e
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
2014-05-30 13:27:56 -06:00
Mahesh Sivasubramanian 6feb62015a msm: lpm-levels: Add kernel parameter to disable sleep
By default, the lpm levels are disabled. For debug scenarios, it is
beneficial to start the device with low power modes disabled. Provide a
module parameter to override the default behavior

Change-Id: I79c5fa665fdf2b3d6331e2c51e22a5990ba5bf1f
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
2014-05-28 13:54:18 -06:00
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
Linux Build Service Account fa06910036 Merge "msm: lpm-levels: Save and restore cpu ctis on L2 SCU power transition" 2014-05-21 21:25:06 -07:00
Karthik Parsha 5b3a36486e msm: lpm-levels: Save and restore cpu ctis on L2 SCU power transition
L2 SCU is turned off on L2 PC and L2 GDHS. Save and then restore cpu ctis
on L2 entering PC or GDHS and restore on exit.

Change-Id: I20360f8be213a634b5a4f9aa4cb7e0ef0aa263be
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
2014-05-21 08:54:39 -07:00