aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorShreyas B. Prabhu <shreyas@linux.vnet.ibm.com>2014-12-09 13:56:51 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2014-12-14 18:46:40 -0500
commit8eb8ac89a364305d05ad16be983b7890eb462cc3 (patch)
tree4661793e77c8b83bc5c805f3502a8fb5a037aa32 /drivers
parent8117ac6a6c2fa0f847ff6a21a1f32c8d2c8501d0 (diff)
powerpc/powernv: Enable Offline CPUs to enter deep idle states
The secondary threads should enter deep idle states so as to gain maximum powersavings when the entire core is offline. To do so the offline path must be made aware of the available deepest idle state. Hence probe the device tree for the possible idle states in powernv core code and expose the deepest idle state through flags. Since the device tree is probed by the cpuidle driver as well, move the parameters required to discover the idle states into an appropriate common place to both the driver and the powernv core code. Another point is that fastsleep idle state may require workarounds in the kernel to function properly. This workaround is introduced in the subsequent patches. However neither the cpuidle driver or the hotplug path need be bothered about this workaround. They will be taken care of by the core powernv code. Originally-by: Srivatsa S. Bhat <srivatsa@mit.edu> Signed-off-by: Preeti U. Murthy <preeti@linux.vnet.ibm.com> Signed-off-by: Shreyas B. Prabhu <shreyas@linux.vnet.ibm.com> Reviewed-by: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: linux-pm@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cpuidle/cpuidle-powernv.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
index 7d3a3497dd4c..0a7d827897e4 100644
--- a/drivers/cpuidle/cpuidle-powernv.c
+++ b/drivers/cpuidle/cpuidle-powernv.c
@@ -16,13 +16,10 @@
16 16
17#include <asm/machdep.h> 17#include <asm/machdep.h>
18#include <asm/firmware.h> 18#include <asm/firmware.h>
19#include <asm/opal.h>
19#include <asm/runlatch.h> 20#include <asm/runlatch.h>
20 21
21/* Flags and constants used in PowerNV platform */
22
23#define MAX_POWERNV_IDLE_STATES 8 22#define MAX_POWERNV_IDLE_STATES 8
24#define IDLE_USE_INST_NAP 0x00010000 /* Use nap instruction */
25#define IDLE_USE_INST_SLEEP 0x00020000 /* Use sleep instruction */
26 23
27struct cpuidle_driver powernv_idle_driver = { 24struct cpuidle_driver powernv_idle_driver = {
28 .name = "powernv_idle", 25 .name = "powernv_idle",
@@ -198,7 +195,7 @@ static int powernv_add_idle_states(void)
198 * target residency to be 10x exit_latency 195 * target residency to be 10x exit_latency
199 */ 196 */
200 latency_ns = be32_to_cpu(idle_state_latency[i]); 197 latency_ns = be32_to_cpu(idle_state_latency[i]);
201 if (flags & IDLE_USE_INST_NAP) { 198 if (flags & OPAL_PM_NAP_ENABLED) {
202 /* Add NAP state */ 199 /* Add NAP state */
203 strcpy(powernv_states[nr_idle_states].name, "Nap"); 200 strcpy(powernv_states[nr_idle_states].name, "Nap");
204 strcpy(powernv_states[nr_idle_states].desc, "Nap"); 201 strcpy(powernv_states[nr_idle_states].desc, "Nap");
@@ -211,7 +208,7 @@ static int powernv_add_idle_states(void)
211 nr_idle_states++; 208 nr_idle_states++;
212 } 209 }
213 210
214 if (flags & IDLE_USE_INST_SLEEP) { 211 if (flags & OPAL_PM_SLEEP_ENABLED) {
215 /* Add FASTSLEEP state */ 212 /* Add FASTSLEEP state */
216 strcpy(powernv_states[nr_idle_states].name, "FastSleep"); 213 strcpy(powernv_states[nr_idle_states].name, "FastSleep");
217 strcpy(powernv_states[nr_idle_states].desc, "FastSleep"); 214 strcpy(powernv_states[nr_idle_states].desc, "FastSleep");