blob: 9ebedd972df0bb8ebd139fde57597f47e6055da6 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +05302/*
3 * cpuidle-powernv - idle state cpuidle driver.
4 * Adapted from drivers/cpuidle/cpuidle-pseries
5 *
6 */
7
8#include <linux/kernel.h>
9#include <linux/module.h>
10#include <linux/init.h>
11#include <linux/moduleparam.h>
12#include <linux/cpuidle.h>
13#include <linux/cpu.h>
14#include <linux/notifier.h>
Preeti U Murthy0d948732014-02-26 05:39:06 +053015#include <linux/clockchips.h>
Preeti U Murthy08888392014-02-26 05:39:20 +053016#include <linux/of.h>
Preeti U Murthy92c83ff52015-02-18 06:34:17 +010017#include <linux/slab.h>
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +053018
19#include <asm/machdep.h>
20#include <asm/firmware.h>
Shreyas B. Prabhu8eb8ac82014-12-10 00:26:51 +053021#include <asm/opal.h>
Nicolas Pitre591ac0c2014-02-17 10:59:29 -050022#include <asm/runlatch.h>
Gautham R. Shenoy09206b62017-01-25 14:06:28 +053023#include <asm/cpuidle.h>
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +053024
Gautham R. Shenoy9e9fc6f2017-01-25 14:06:27 +053025/*
26 * Expose only those Hardware idle states via the cpuidle framework
27 * that have latency value below POWERNV_THRESHOLD_LATENCY_NS.
28 */
Shreyas B. Prabhu3005c592016-07-08 11:50:52 +053029#define POWERNV_THRESHOLD_LATENCY_NS 200000
30
Andrew Donnellaned613902016-11-22 16:08:06 +110031static struct cpuidle_driver powernv_idle_driver = {
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +053032 .name = "powernv_idle",
33 .owner = THIS_MODULE,
34};
35
Nicholas Piggin624e46d2017-06-14 23:02:40 +100036static int max_idle_state __read_mostly;
37static struct cpuidle_state *cpuidle_state_table __read_mostly;
Shreyas B. Prabhu3005c592016-07-08 11:50:52 +053038
Gautham R. Shenoy09206b62017-01-25 14:06:28 +053039struct stop_psscr_table {
40 u64 val;
41 u64 mask;
42};
43
Nicholas Piggin624e46d2017-06-14 23:02:40 +100044static struct stop_psscr_table stop_psscr_table[CPUIDLE_STATE_MAX] __read_mostly;
Shreyas B. Prabhu3005c592016-07-08 11:50:52 +053045
Gautham R. Shenoy0a4ec6a2018-05-31 17:45:09 +053046static u64 default_snooze_timeout __read_mostly;
Nicholas Piggin624e46d2017-06-14 23:02:40 +100047static bool snooze_timeout_en __read_mostly;
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +053048
Gautham R. Shenoy0a4ec6a2018-05-31 17:45:09 +053049static u64 get_snooze_timeout(struct cpuidle_device *dev,
50 struct cpuidle_driver *drv,
51 int index)
52{
53 int i;
54
55 if (unlikely(!snooze_timeout_en))
56 return default_snooze_timeout;
57
58 for (i = index + 1; i < drv->state_count; i++) {
Rafael J. Wysocki99e98d32019-11-04 12:16:17 +010059 if (dev->states_usage[i].disable)
Gautham R. Shenoy0a4ec6a2018-05-31 17:45:09 +053060 continue;
61
Rafael J. Wysocki99e98d32019-11-04 12:16:17 +010062 return drv->states[i].target_residency * tb_ticks_per_usec;
Gautham R. Shenoy0a4ec6a2018-05-31 17:45:09 +053063 }
64
65 return default_snooze_timeout;
66}
67
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +053068static int snooze_loop(struct cpuidle_device *dev,
69 struct cpuidle_driver *drv,
70 int index)
71{
Shilpasri G Bhat78eaa102015-06-18 16:53:11 +053072 u64 snooze_exit_time;
73
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +053074 set_thread_flag(TIF_POLLING_NRFLAG);
75
Nicholas Piggin3fc5ee922017-06-14 23:02:39 +100076 local_irq_enable();
77
Gautham R. Shenoy0a4ec6a2018-05-31 17:45:09 +053078 snooze_exit_time = get_tb() + get_snooze_timeout(dev, drv, index);
Aboorva Devarajan5ddcc032022-11-14 20:26:11 +053079 dev->poll_time_limit = false;
Nicolas Pitre591ac0c2014-02-17 10:59:29 -050080 ppc64_runlatch_off();
Anton Blanchard26eb48a2017-04-04 07:54:13 +100081 HMT_very_low();
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +053082 while (!need_resched()) {
Nicholas Piggin7ded4292017-06-14 23:02:41 +100083 if (likely(snooze_timeout_en) && get_tb() > snooze_exit_time) {
84 /*
85 * Task has not woken up but we are exiting the polling
86 * loop anyway. Require a barrier after polling is
87 * cleared to order subsequent test of need_resched().
88 */
89 clear_thread_flag(TIF_POLLING_NRFLAG);
Aboorva Devarajan5ddcc032022-11-14 20:26:11 +053090 dev->poll_time_limit = true;
Nicholas Piggin7ded4292017-06-14 23:02:41 +100091 smp_mb();
Shilpasri G Bhat78eaa102015-06-18 16:53:11 +053092 break;
Nicholas Piggin7ded4292017-06-14 23:02:41 +100093 }
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +053094 }
95
96 HMT_medium();
Nicolas Pitre591ac0c2014-02-17 10:59:29 -050097 ppc64_runlatch_on();
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +053098 clear_thread_flag(TIF_POLLING_NRFLAG);
Nicholas Piggin3fc5ee922017-06-14 23:02:39 +100099
Nicholas Pigginf1343d02017-11-17 02:00:51 +1000100 local_irq_disable();
101
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530102 return index;
103}
104
105static int nap_loop(struct cpuidle_device *dev,
106 struct cpuidle_driver *drv,
107 int index)
108{
Nicholas Piggin2201f992017-06-13 23:05:45 +1000109 power7_idle_type(PNV_THREAD_NAP);
110
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530111 return index;
112}
113
preeticc5a2f72015-06-24 01:48:01 -0500114/* Register for fastsleep only in oneshot mode of broadcast */
115#ifdef CONFIG_TICK_ONESHOT
Preeti U Murthy0d948732014-02-26 05:39:06 +0530116static int fastsleep_loop(struct cpuidle_device *dev,
117 struct cpuidle_driver *drv,
118 int index)
119{
120 unsigned long old_lpcr = mfspr(SPRN_LPCR);
121 unsigned long new_lpcr;
122
123 if (unlikely(system_state < SYSTEM_RUNNING))
124 return index;
125
126 new_lpcr = old_lpcr;
Michael Neuling9b6a68d2014-06-11 15:59:27 +1000127 /* Do not exit powersave upon decrementer as we've setup the timer
128 * offload.
Preeti U Murthy0d948732014-02-26 05:39:06 +0530129 */
Michael Neuling9b6a68d2014-06-11 15:59:27 +1000130 new_lpcr &= ~LPCR_PECE1;
Preeti U Murthy0d948732014-02-26 05:39:06 +0530131
132 mtspr(SPRN_LPCR, new_lpcr);
Nicholas Piggin2201f992017-06-13 23:05:45 +1000133
134 power7_idle_type(PNV_THREAD_SLEEP);
Preeti U Murthy0d948732014-02-26 05:39:06 +0530135
136 mtspr(SPRN_LPCR, old_lpcr);
137
138 return index;
139}
preeticc5a2f72015-06-24 01:48:01 -0500140#endif
Shreyas B. Prabhu3005c592016-07-08 11:50:52 +0530141
142static int stop_loop(struct cpuidle_device *dev,
143 struct cpuidle_driver *drv,
144 int index)
145{
Nicholas Pigginffd29612020-08-19 19:47:00 +1000146 arch300_idle_type(stop_psscr_table[index].val,
Gautham R. Shenoy09206b62017-01-25 14:06:28 +0530147 stop_psscr_table[index].mask);
Shreyas B. Prabhu3005c592016-07-08 11:50:52 +0530148 return index;
149}
150
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530151/*
152 * States for dedicated partition case.
153 */
Shreyas B. Prabhu169f3fa2016-07-08 11:50:50 +0530154static struct cpuidle_state powernv_states[CPUIDLE_STATE_MAX] = {
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530155 { /* Snooze */
156 .name = "snooze",
157 .desc = "snooze",
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530158 .exit_latency = 0,
159 .target_residency = 0,
Aboorva Devarajan5ddcc032022-11-14 20:26:11 +0530160 .enter = snooze_loop,
161 .flags = CPUIDLE_FLAG_POLLING },
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530162};
163
Sebastian Andrzej Siewior10fcca92016-08-24 11:12:59 +0200164static int powernv_cpuidle_cpu_online(unsigned int cpu)
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530165{
Sebastian Andrzej Siewior10fcca92016-08-24 11:12:59 +0200166 struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu);
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530167
168 if (dev && cpuidle_get_driver()) {
Sebastian Andrzej Siewior10fcca92016-08-24 11:12:59 +0200169 cpuidle_pause_and_lock();
170 cpuidle_enable_device(dev);
171 cpuidle_resume_and_unlock();
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530172 }
Sebastian Andrzej Siewior10fcca92016-08-24 11:12:59 +0200173 return 0;
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530174}
175
Sebastian Andrzej Siewior10fcca92016-08-24 11:12:59 +0200176static int powernv_cpuidle_cpu_dead(unsigned int cpu)
177{
178 struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu);
179
180 if (dev && cpuidle_get_driver()) {
181 cpuidle_pause_and_lock();
182 cpuidle_disable_device(dev);
183 cpuidle_resume_and_unlock();
184 }
185 return 0;
186}
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530187
188/*
189 * powernv_cpuidle_driver_init()
190 */
191static int powernv_cpuidle_driver_init(void)
192{
193 int idle_state;
194 struct cpuidle_driver *drv = &powernv_idle_driver;
195
196 drv->state_count = 0;
197
198 for (idle_state = 0; idle_state < max_idle_state; ++idle_state) {
199 /* Is the state not enabled? */
200 if (cpuidle_state_table[idle_state].enter == NULL)
201 continue;
202
203 drv->states[drv->state_count] = /* structure copy */
204 cpuidle_state_table[idle_state];
205
206 drv->state_count += 1;
207 }
208
Vaidyanathan Srinivasan293d2642017-03-23 20:52:46 +0530209 /*
210 * On the PowerNV platform cpu_present may be less than cpu_possible in
211 * cases when firmware detects the CPU, but it is not available to the
212 * OS. If CONFIG_HOTPLUG_CPU=n, then such CPUs are not hotplugable at
213 * run time and hence cpu_devices are not created for those CPUs by the
214 * generic topology_init().
215 *
216 * drv->cpumask defaults to cpu_possible_mask in
217 * __cpuidle_driver_init(). This breaks cpuidle on PowerNV where
218 * cpu_devices are not created for CPUs in cpu_possible_mask that
219 * cannot be hot-added later at run time.
220 *
221 * Trying cpuidle_register_device() on a CPU without a cpu_device is
222 * incorrect, so pass a correct CPU mask to the generic cpuidle driver.
223 */
224
225 drv->cpumask = (struct cpumask *)cpu_present_mask;
226
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530227 return 0;
228}
229
Gautham R. Shenoy9e9fc6f2017-01-25 14:06:27 +0530230static inline void add_powernv_state(int index, const char *name,
231 unsigned int flags,
232 int (*idle_fn)(struct cpuidle_device *,
233 struct cpuidle_driver *,
234 int),
235 unsigned int target_residency,
236 unsigned int exit_latency,
Gautham R. Shenoy09206b62017-01-25 14:06:28 +0530237 u64 psscr_val, u64 psscr_mask)
Gautham R. Shenoy9e9fc6f2017-01-25 14:06:27 +0530238{
Wolfram Sangccf28722022-08-18 23:00:01 +0200239 strscpy(powernv_states[index].name, name, CPUIDLE_NAME_LEN);
240 strscpy(powernv_states[index].desc, name, CPUIDLE_NAME_LEN);
Gautham R. Shenoy9e9fc6f2017-01-25 14:06:27 +0530241 powernv_states[index].flags = flags;
242 powernv_states[index].target_residency = target_residency;
243 powernv_states[index].exit_latency = exit_latency;
244 powernv_states[index].enter = idle_fn;
Akshay Adiga1961aca2018-07-05 17:10:22 +0530245 /* For power8 and below psscr_* will be 0 */
Gautham R. Shenoy09206b62017-01-25 14:06:28 +0530246 stop_psscr_table[index].val = psscr_val;
247 stop_psscr_table[index].mask = psscr_mask;
Gautham R. Shenoy9e9fc6f2017-01-25 14:06:27 +0530248}
249
Gautham R. Shenoy785a12a2017-08-08 14:13:15 +0530250extern u32 pnv_get_supported_cpuidle_states(void);
Preeti U Murthy08888392014-02-26 05:39:20 +0530251static int powernv_add_idle_states(void)
252{
Preeti U Murthy08888392014-02-26 05:39:20 +0530253 int nr_idle_states = 1; /* Snooze */
Akshay Adiga1961aca2018-07-05 17:10:22 +0530254 int dt_idle_states;
Gautham R. Shenoy09206b62017-01-25 14:06:28 +0530255 u32 has_stop_states = 0;
Akshay Adiga1961aca2018-07-05 17:10:22 +0530256 int i;
Gautham R. Shenoy785a12a2017-08-08 14:13:15 +0530257 u32 supported_flags = pnv_get_supported_cpuidle_states();
258
Preeti U Murthy08888392014-02-26 05:39:20 +0530259
260 /* Currently we have snooze statically defined */
Akshay Adiga1961aca2018-07-05 17:10:22 +0530261 if (nr_pnv_idle_states <= 0) {
262 pr_warn("cpuidle-powernv : Only Snooze is available\n");
Preeti U Murthy92c83ff52015-02-18 06:34:17 +0100263 goto out;
Preeti U Murthy08888392014-02-26 05:39:20 +0530264 }
265
Akshay Adiga1961aca2018-07-05 17:10:22 +0530266 /* TODO: Count only states which are eligible for cpuidle */
267 dt_idle_states = nr_pnv_idle_states;
Gautham R. Shenoyecad4502017-03-15 13:45:53 +0530268
Shreyas B. Prabhu957efce2016-07-08 11:50:51 +0530269 /*
270 * Since snooze is used as first idle state, max idle states allowed is
271 * CPUIDLE_STATE_MAX -1
272 */
Akshay Adiga1961aca2018-07-05 17:10:22 +0530273 if (nr_pnv_idle_states > CPUIDLE_STATE_MAX - 1) {
Shreyas B. Prabhu957efce2016-07-08 11:50:51 +0530274 pr_warn("cpuidle-powernv: discovered idle states more than allowed");
275 dt_idle_states = CPUIDLE_STATE_MAX - 1;
276 }
277
Shreyas B. Prabhu3005c592016-07-08 11:50:52 +0530278 /*
279 * If the idle states use stop instruction, probe for psscr values
Gautham R. Shenoy09206b62017-01-25 14:06:28 +0530280 * and psscr mask which are necessary to specify required stop level.
Shreyas B. Prabhu3005c592016-07-08 11:50:52 +0530281 */
Akshay Adiga1961aca2018-07-05 17:10:22 +0530282 has_stop_states = (pnv_idle_states[0].flags &
Gautham R. Shenoy09206b62017-01-25 14:06:28 +0530283 (OPAL_PM_STOP_INST_FAST | OPAL_PM_STOP_INST_DEEP));
Preeti U Murthy92c83ff52015-02-18 06:34:17 +0100284
Preeti U Murthy08888392014-02-26 05:39:20 +0530285 for (i = 0; i < dt_idle_states; i++) {
Gautham R. Shenoy9e9fc6f2017-01-25 14:06:27 +0530286 unsigned int exit_latency, target_residency;
Gautham R. Shenoyf9122ee2017-05-16 14:19:48 +0530287 bool stops_timebase = false;
Akshay Adiga1961aca2018-07-05 17:10:22 +0530288 struct pnv_idle_states_t *state = &pnv_idle_states[i];
Gautham R. Shenoy785a12a2017-08-08 14:13:15 +0530289
290 /*
291 * Skip the platform idle state whose flag isn't in
292 * the supported_cpuidle_states flag mask.
293 */
Akshay Adiga1961aca2018-07-05 17:10:22 +0530294 if ((state->flags & supported_flags) != state->flags)
Gautham R. Shenoy785a12a2017-08-08 14:13:15 +0530295 continue;
Shreyas B. Prabhu3005c592016-07-08 11:50:52 +0530296 /*
297 * If an idle state has exit latency beyond
298 * POWERNV_THRESHOLD_LATENCY_NS then don't use it
299 * in cpu-idle.
300 */
Akshay Adiga1961aca2018-07-05 17:10:22 +0530301 if (state->latency_ns > POWERNV_THRESHOLD_LATENCY_NS)
Shreyas B. Prabhu3005c592016-07-08 11:50:52 +0530302 continue;
Gautham R. Shenoy9e9fc6f2017-01-25 14:06:27 +0530303 /*
304 * Firmware passes residency and latency values in ns.
305 * cpuidle expects it in us.
306 */
Akshay Adiga1961aca2018-07-05 17:10:22 +0530307 exit_latency = DIV_ROUND_UP(state->latency_ns, 1000);
308 target_residency = DIV_ROUND_UP(state->residency_ns, 1000);
Preeti U Murthy08888392014-02-26 05:39:20 +0530309
Akshay Adiga1961aca2018-07-05 17:10:22 +0530310 if (has_stop_states && !(state->valid))
Gautham R. Shenoy09206b62017-01-25 14:06:28 +0530311 continue;
Gautham R. Shenoy09206b62017-01-25 14:06:28 +0530312
Akshay Adiga1961aca2018-07-05 17:10:22 +0530313 if (state->flags & OPAL_PM_TIMEBASE_STOP)
Gautham R. Shenoyf9122ee2017-05-16 14:19:48 +0530314 stops_timebase = true;
315
Akshay Adiga1961aca2018-07-05 17:10:22 +0530316 if (state->flags & OPAL_PM_NAP_ENABLED) {
Preeti U Murthy08888392014-02-26 05:39:20 +0530317 /* Add NAP state */
Gautham R. Shenoy9e9fc6f2017-01-25 14:06:27 +0530318 add_powernv_state(nr_idle_states, "Nap",
319 CPUIDLE_FLAG_NONE, nap_loop,
Gautham R. Shenoy09206b62017-01-25 14:06:28 +0530320 target_residency, exit_latency, 0, 0);
Gautham R. Shenoyf9122ee2017-05-16 14:19:48 +0530321 } else if (has_stop_states && !stops_timebase) {
Akshay Adiga1961aca2018-07-05 17:10:22 +0530322 add_powernv_state(nr_idle_states, state->name,
Gautham R. Shenoy9e9fc6f2017-01-25 14:06:27 +0530323 CPUIDLE_FLAG_NONE, stop_loop,
324 target_residency, exit_latency,
Akshay Adiga1961aca2018-07-05 17:10:22 +0530325 state->psscr_val,
326 state->psscr_mask);
preeticc5a2f72015-06-24 01:48:01 -0500327 }
328
329 /*
330 * All cpuidle states with CPUIDLE_FLAG_TIMER_STOP set must come
331 * within this config dependency check.
332 */
333#ifdef CONFIG_TICK_ONESHOT
Akshay Adiga1961aca2018-07-05 17:10:22 +0530334 else if (state->flags & OPAL_PM_SLEEP_ENABLED ||
335 state->flags & OPAL_PM_SLEEP_ENABLED_ER1) {
Preeti U Murthy08888392014-02-26 05:39:20 +0530336 /* Add FASTSLEEP state */
Gautham R. Shenoy9e9fc6f2017-01-25 14:06:27 +0530337 add_powernv_state(nr_idle_states, "FastSleep",
338 CPUIDLE_FLAG_TIMER_STOP,
339 fastsleep_loop,
Gautham R. Shenoy09206b62017-01-25 14:06:28 +0530340 target_residency, exit_latency, 0, 0);
Gautham R. Shenoyf9122ee2017-05-16 14:19:48 +0530341 } else if (has_stop_states && stops_timebase) {
Akshay Adiga1961aca2018-07-05 17:10:22 +0530342 add_powernv_state(nr_idle_states, state->name,
Gautham R. Shenoy9e9fc6f2017-01-25 14:06:27 +0530343 CPUIDLE_FLAG_TIMER_STOP, stop_loop,
344 target_residency, exit_latency,
Akshay Adiga1961aca2018-07-05 17:10:22 +0530345 state->psscr_val,
346 state->psscr_mask);
Preeti U Murthy08888392014-02-26 05:39:20 +0530347 }
preeticc5a2f72015-06-24 01:48:01 -0500348#endif
Gautham R. Shenoyf9122ee2017-05-16 14:19:48 +0530349 else
350 continue;
Preeti U Murthy92c83ff52015-02-18 06:34:17 +0100351 nr_idle_states++;
Preeti U Murthy08888392014-02-26 05:39:20 +0530352 }
Preeti U Murthy92c83ff52015-02-18 06:34:17 +0100353out:
Preeti U Murthy08888392014-02-26 05:39:20 +0530354 return nr_idle_states;
355}
356
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530357/*
358 * powernv_idle_probe()
359 * Choose state table for shared versus dedicated partition
360 */
361static int powernv_idle_probe(void)
362{
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530363 if (cpuidle_disable != IDLE_NO_OVERRIDE)
364 return -ENODEV;
365
Stewart Smithe4d54f72015-12-09 17:18:20 +1100366 if (firmware_has_feature(FW_FEATURE_OPAL)) {
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530367 cpuidle_state_table = powernv_states;
Preeti U Murthy08888392014-02-26 05:39:20 +0530368 /* Device tree can indicate more idle states */
369 max_idle_state = powernv_add_idle_states();
Gautham R. Shenoy0a4ec6a2018-05-31 17:45:09 +0530370 default_snooze_timeout = TICK_USEC * tb_ticks_per_usec;
371 if (max_idle_state > 1)
Shilpasri G Bhat78eaa102015-06-18 16:53:11 +0530372 snooze_timeout_en = true;
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530373 } else
374 return -ENODEV;
375
376 return 0;
377}
378
379static int __init powernv_processor_idle_init(void)
380{
381 int retval;
382
383 retval = powernv_idle_probe();
384 if (retval)
385 return retval;
386
387 powernv_cpuidle_driver_init();
388 retval = cpuidle_register(&powernv_idle_driver, NULL);
389 if (retval) {
390 printk(KERN_DEBUG "Registration of powernv driver failed.\n");
391 return retval;
392 }
393
Sebastian Andrzej Siewior10fcca92016-08-24 11:12:59 +0200394 retval = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
395 "cpuidle/powernv:online",
396 powernv_cpuidle_cpu_online, NULL);
397 WARN_ON(retval < 0);
398 retval = cpuhp_setup_state_nocalls(CPUHP_CPUIDLE_DEAD,
399 "cpuidle/powernv:dead", NULL,
400 powernv_cpuidle_cpu_dead);
401 WARN_ON(retval < 0);
Deepthi Dharwar2c2e6ec2014-01-14 16:32:40 +0530402 printk(KERN_DEBUG "powernv_idle_driver registered\n");
403 return 0;
404}
405
406device_initcall(powernv_processor_idle_init);