aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/include/asm/processor.h2
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig9
-rw-r--r--arch/powerpc/platforms/pseries/Makefile1
-rw-r--r--drivers/cpuidle/Kconfig5
-rw-r--r--drivers/cpuidle/Kconfig.powerpc11
-rw-r--r--drivers/cpuidle/Makefile4
-rw-r--r--drivers/cpuidle/cpuidle-pseries.c (renamed from arch/powerpc/platforms/pseries/processor_idle.c)61
7 files changed, 78 insertions, 15 deletions
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 8ca20ac28dc2..c2c0f4478be3 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -451,7 +451,7 @@ enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF};
451extern int powersave_nap; /* set if nap mode can be used in idle loop */ 451extern int powersave_nap; /* set if nap mode can be used in idle loop */
452extern void power7_nap(void); 452extern void power7_nap(void);
453 453
454#ifdef CONFIG_PSERIES_IDLE 454#ifdef CONFIG_PSERIES_CPUIDLE
455extern void update_smt_snooze_delay(int cpu, int residency); 455extern void update_smt_snooze_delay(int cpu, int residency);
456#else 456#else
457static inline void update_smt_snooze_delay(int cpu, int residency) {} 457static inline void update_smt_snooze_delay(int cpu, int residency) {}
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index e66643250fee..37300f6ee244 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -119,12 +119,3 @@ config DTL
119 which are accessible through a debugfs file. 119 which are accessible through a debugfs file.
120 120
121 Say N if you are unsure. 121 Say N if you are unsure.
122
123config PSERIES_IDLE
124 bool "Cpuidle driver for pSeries platforms"
125 depends on CPU_IDLE
126 depends on PPC_PSERIES
127 default y
128 help
129 Select this option to enable processor idle state management
130 through cpuidle subsystem.
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index fbccac9cd2dc..03480796af9a 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -21,7 +21,6 @@ obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
21obj-$(CONFIG_CMM) += cmm.o 21obj-$(CONFIG_CMM) += cmm.o
22obj-$(CONFIG_DTL) += dtl.o 22obj-$(CONFIG_DTL) += dtl.o
23obj-$(CONFIG_IO_EVENT_IRQ) += io_event_irq.o 23obj-$(CONFIG_IO_EVENT_IRQ) += io_event_irq.o
24obj-$(CONFIG_PSERIES_IDLE) += processor_idle.o
25obj-$(CONFIG_LPARCFG) += lparcfg.o 24obj-$(CONFIG_LPARCFG) += lparcfg.o
26 25
27ifeq ($(CONFIG_PPC_PSERIES),y) 26ifeq ($(CONFIG_PPC_PSERIES),y)
diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
index b3fb81d7cf04..f04e25f6c98d 100644
--- a/drivers/cpuidle/Kconfig
+++ b/drivers/cpuidle/Kconfig
@@ -35,6 +35,11 @@ depends on ARM
35source "drivers/cpuidle/Kconfig.arm" 35source "drivers/cpuidle/Kconfig.arm"
36endmenu 36endmenu
37 37
38menu "POWERPC CPU Idle Drivers"
39depends on PPC
40source "drivers/cpuidle/Kconfig.powerpc"
41endmenu
42
38endif 43endif
39 44
40config ARCH_NEEDS_CPU_IDLE_COUPLED 45config ARCH_NEEDS_CPU_IDLE_COUPLED
diff --git a/drivers/cpuidle/Kconfig.powerpc b/drivers/cpuidle/Kconfig.powerpc
new file mode 100644
index 000000000000..8147de522a96
--- /dev/null
+++ b/drivers/cpuidle/Kconfig.powerpc
@@ -0,0 +1,11 @@
1#
2# POWERPC CPU Idle Drivers
3#
4config PSERIES_CPUIDLE
5 bool "Cpuidle driver for pSeries platforms"
6 depends on CPU_IDLE
7 depends on PPC_PSERIES
8 default y
9 help
10 Select this option to enable processor idle state management
11 through cpuidle subsystem.
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 527be28e5c1e..a6331ad32738 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -13,3 +13,7 @@ obj-$(CONFIG_ARM_KIRKWOOD_CPUIDLE) += cpuidle-kirkwood.o
13obj-$(CONFIG_ARM_ZYNQ_CPUIDLE) += cpuidle-zynq.o 13obj-$(CONFIG_ARM_ZYNQ_CPUIDLE) += cpuidle-zynq.o
14obj-$(CONFIG_ARM_U8500_CPUIDLE) += cpuidle-ux500.o 14obj-$(CONFIG_ARM_U8500_CPUIDLE) += cpuidle-ux500.o
15obj-$(CONFIG_ARM_AT91_CPUIDLE) += cpuidle-at91.o 15obj-$(CONFIG_ARM_AT91_CPUIDLE) += cpuidle-at91.o
16
17###############################################################################
18# POWERPC drivers
19obj-$(CONFIG_PSERIES_CPUIDLE) += cpuidle-pseries.o
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/drivers/cpuidle/cpuidle-pseries.c
index 002d5b4112f2..21154782402a 100644
--- a/arch/powerpc/platforms/pseries/processor_idle.c
+++ b/drivers/cpuidle/cpuidle-pseries.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * processor_idle - idle state cpuidle driver. 2 * cpuidle-pseries - idle state cpuidle driver.
3 * Adapted from drivers/idle/intel_idle.c and 3 * Adapted from drivers/idle/intel_idle.c and
4 * drivers/acpi/processor_idle.c 4 * drivers/acpi/processor_idle.c
5 * 5 *
@@ -27,6 +27,7 @@ struct cpuidle_driver pseries_idle_driver = {
27#define MAX_IDLE_STATE_COUNT 2 27#define MAX_IDLE_STATE_COUNT 2
28 28
29static int max_idle_state = MAX_IDLE_STATE_COUNT - 1; 29static int max_idle_state = MAX_IDLE_STATE_COUNT - 1;
30static struct cpuidle_device __percpu *pseries_cpuidle_devices;
30static struct cpuidle_state *cpuidle_state_table; 31static struct cpuidle_state *cpuidle_state_table;
31 32
32static inline void idle_loop_prolog(unsigned long *in_purr) 33static inline void idle_loop_prolog(unsigned long *in_purr)
@@ -187,7 +188,7 @@ static int pseries_cpuidle_add_cpu_notifier(struct notifier_block *n,
187{ 188{
188 int hotcpu = (unsigned long)hcpu; 189 int hotcpu = (unsigned long)hcpu;
189 struct cpuidle_device *dev = 190 struct cpuidle_device *dev =
190 per_cpu_ptr(cpuidle_devices, hotcpu); 191 per_cpu_ptr(pseries_cpuidle_devices, hotcpu);
191 192
192 if (dev && cpuidle_get_driver()) { 193 if (dev && cpuidle_get_driver()) {
193 switch (action) { 194 switch (action) {
@@ -244,6 +245,50 @@ static int pseries_cpuidle_driver_init(void)
244 return 0; 245 return 0;
245} 246}
246 247
248/* pseries_idle_devices_uninit(void)
249 * unregister cpuidle devices and de-allocate memory
250 */
251static void pseries_idle_devices_uninit(void)
252{
253 int i;
254 struct cpuidle_device *dev;
255
256 for_each_possible_cpu(i) {
257 dev = per_cpu_ptr(pseries_cpuidle_devices, i);
258 cpuidle_unregister_device(dev);
259 }
260
261 free_percpu(pseries_cpuidle_devices);
262 return;
263}
264
265/* pseries_idle_devices_init()
266 * allocate, initialize and register cpuidle device
267 */
268static int pseries_idle_devices_init(void)
269{
270 int i;
271 struct cpuidle_driver *drv = &pseries_idle_driver;
272 struct cpuidle_device *dev;
273
274 pseries_cpuidle_devices = alloc_percpu(struct cpuidle_device);
275 if (pseries_cpuidle_devices == NULL)
276 return -ENOMEM;
277
278 for_each_possible_cpu(i) {
279 dev = per_cpu_ptr(pseries_cpuidle_devices, i);
280 dev->state_count = drv->state_count;
281 dev->cpu = i;
282 if (cpuidle_register_device(dev)) {
283 printk(KERN_DEBUG \
284 "cpuidle_register_device %d failed!\n", i);
285 return -EIO;
286 }
287 }
288
289 return 0;
290}
291
247/* 292/*
248 * pseries_idle_probe() 293 * pseries_idle_probe()
249 * Choose state table for shared versus dedicated partition 294 * Choose state table for shared versus dedicated partition
@@ -279,12 +324,19 @@ static int __init pseries_processor_idle_init(void)
279 return retval; 324 return retval;
280 325
281 pseries_cpuidle_driver_init(); 326 pseries_cpuidle_driver_init();
282 retval = cpuidle_register(&pseries_idle_driver, NULL); 327 retval = cpuidle_register_driver(&pseries_idle_driver);
283 if (retval) { 328 if (retval) {
284 printk(KERN_DEBUG "Registration of pseries driver failed.\n"); 329 printk(KERN_DEBUG "Registration of pseries driver failed.\n");
285 return retval; 330 return retval;
286 } 331 }
287 332
333 retval = pseries_idle_devices_init();
334 if (retval) {
335 pseries_idle_devices_uninit();
336 cpuidle_unregister_driver(&pseries_idle_driver);
337 return retval;
338 }
339
288 register_cpu_notifier(&setup_hotplug_notifier); 340 register_cpu_notifier(&setup_hotplug_notifier);
289 printk(KERN_DEBUG "pseries_idle_driver registered\n"); 341 printk(KERN_DEBUG "pseries_idle_driver registered\n");
290 342
@@ -295,7 +347,8 @@ static void __exit pseries_processor_idle_exit(void)
295{ 347{
296 348
297 unregister_cpu_notifier(&setup_hotplug_notifier); 349 unregister_cpu_notifier(&setup_hotplug_notifier);
298 cpuidle_unregister(&pseries_idle_driver); 350 pseries_idle_devices_uninit();
351 cpuidle_unregister_driver(&pseries_idle_driver);
299 352
300 return; 353 return;
301} 354}