aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/44x
diff options
context:
space:
mode:
authorJerone Young <jyoung5@us.ibm.com>2008-04-11 15:03:33 -0400
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>2008-04-16 08:32:06 -0400
commite92716f2aa68cdfbf6ec24d6f31f08b072e1a246 (patch)
tree9bd9d9cfa8dd788ca10564845601056c7d3eb2ca /arch/powerpc/platforms/44x
parent478d5dcb620abae146edd542b4e76cea47855bc9 (diff)
[POWERPC] 4xx: Add idle wait support for 44x platforms
This changes the cpu_idle loop for 44x platforms to utilize the Wait Enable feature of the CPU. This helps virtulization solutions know when the guest Linux kernel is in an idle state. A command line option called "idle" is also added to allow people to change the idle loop back to the original variation. This is done by setting "idle=spin" on the kernel command line. Signed-off-by: Jerone Young <jyoung5@us.ibm.com> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Diffstat (limited to 'arch/powerpc/platforms/44x')
-rw-r--r--arch/powerpc/platforms/44x/Makefile2
-rw-r--r--arch/powerpc/platforms/44x/idle.c67
2 files changed, 68 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
index 2320ae5dc8a7..774165f9acdd 100644
--- a/arch/powerpc/platforms/44x/Makefile
+++ b/arch/powerpc/platforms/44x/Makefile
@@ -1,4 +1,4 @@
1obj-$(CONFIG_44x) := misc_44x.o 1obj-$(CONFIG_44x) := misc_44x.o idle.o
2obj-$(CONFIG_EBONY) += ebony.o 2obj-$(CONFIG_EBONY) += ebony.o
3obj-$(CONFIG_TAISHAN) += taishan.o 3obj-$(CONFIG_TAISHAN) += taishan.o
4obj-$(CONFIG_BAMBOO) += bamboo.o 4obj-$(CONFIG_BAMBOO) += bamboo.o
diff --git a/arch/powerpc/platforms/44x/idle.c b/arch/powerpc/platforms/44x/idle.c
new file mode 100644
index 000000000000..7a81f921fef9
--- /dev/null
+++ b/arch/powerpc/platforms/44x/idle.c
@@ -0,0 +1,67 @@
1/*
2 * Copyright 2008 IBM Corp.
3 *
4 * Based on arch/powerpc/platforms/pasemi/idle.c:
5 * Copyright (C) 2006-2007 PA Semi, Inc
6 *
7 * Added by: Jerone Young <jyoung5@us.ibm.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#include <linux/of.h>
25#include <linux/kernel.h>
26#include <asm/machdep.h>
27
28static int mode_spin;
29
30static void ppc44x_idle(void)
31{
32 unsigned long msr_save;
33
34 msr_save = mfmsr();
35 /* set wait state MSR */
36 mtmsr(msr_save|MSR_WE|MSR_EE|MSR_CE|MSR_DE);
37 isync();
38 /* return to initial state */
39 mtmsr(msr_save);
40 isync();
41}
42
43int __init ppc44x_idle_init(void)
44{
45 if (!mode_spin) {
46 /* If we are not setting spin mode
47 then we set to wait mode */
48 ppc_md.power_save = &ppc44x_idle;
49 }
50
51 return 0;
52}
53
54arch_initcall(ppc44x_idle_init);
55
56static int __init idle_param(char *p)
57{
58
59 if (!strcmp("spin", p)) {
60 mode_spin = 1;
61 ppc_md.power_save = NULL;
62 }
63
64 return 0;
65}
66
67early_param("idle", idle_param);