aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2013-07-12 12:36:21 -0400
committerMatt Turner <mattst88@gmail.com>2013-11-16 19:33:15 -0500
commit7f3bbb82e0c371d6881129f776c90130ba66f051 (patch)
treee2bb143c17545c720484602fbaa829eae2e66119 /arch/alpha
parentfddd87d6e135924b92499917bace103e46c22d00 (diff)
alpha: Primitive support for CPU power down.
Use WTINT to wait for the next interrupt. Squash the WTINT call if the PALcode doesn't support it (e.g. MILO). No attempt is yet made to skip clock ticks during normal scheduling in order to stay in power down mode longer. Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'arch/alpha')
-rw-r--r--arch/alpha/Kconfig24
-rw-r--r--arch/alpha/include/asm/pal.h1
-rw-r--r--arch/alpha/include/uapi/asm/pal.h1
-rw-r--r--arch/alpha/kernel/process.c17
-rw-r--r--arch/alpha/kernel/traps.c15
5 files changed, 58 insertions, 0 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index a67b971c830a..f9e84da49716 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -586,6 +586,30 @@ config NUMA
586 Access). This option is for configuring high-end multiprocessor 586 Access). This option is for configuring high-end multiprocessor
587 server machines. If in doubt, say N. 587 server machines. If in doubt, say N.
588 588
589config ALPHA_WTINT
590 bool "Use WTINT" if ALPHA_SRM || ALPHA_GENERIC
591 default y if ALPHA_QEMU
592 default n if ALPHA_EV5 || ALPHA_EV56 || (ALPHA_EV4 && !ALPHA_LCA)
593 default n if !ALPHA_SRM && !ALPHA_GENERIC
594 default y if SMP
595 ---help---
596 The Wait for Interrupt (WTINT) PALcall attempts to place the CPU
597 to sleep until the next interrupt. This may reduce the power
598 consumed, and the heat produced by the computer. However, it has
599 the side effect of making the cycle counter unreliable as a timing
600 device across the sleep.
601
602 For emulation under QEMU, definitely say Y here, as we have other
603 mechanisms for measuring time than the cycle counter.
604
605 For EV4 (but not LCA), EV5 and EV56 systems, or for systems running
606 MILO, sleep mode is not supported so you might as well say N here.
607
608 For SMP systems we cannot use the cycle counter for timing anyway,
609 so you might as well say Y here.
610
611 If unsure, say N.
612
589config NODES_SHIFT 613config NODES_SHIFT
590 int 614 int
591 default "7" 615 default "7"
diff --git a/arch/alpha/include/asm/pal.h b/arch/alpha/include/asm/pal.h
index 6fcd2b5b08f0..e78ec9bcc768 100644
--- a/arch/alpha/include/asm/pal.h
+++ b/arch/alpha/include/asm/pal.h
@@ -89,6 +89,7 @@ __CALL_PAL_W1(wrmces, unsigned long);
89__CALL_PAL_RW2(wrperfmon, unsigned long, unsigned long, unsigned long); 89__CALL_PAL_RW2(wrperfmon, unsigned long, unsigned long, unsigned long);
90__CALL_PAL_W1(wrusp, unsigned long); 90__CALL_PAL_W1(wrusp, unsigned long);
91__CALL_PAL_W1(wrvptptr, unsigned long); 91__CALL_PAL_W1(wrvptptr, unsigned long);
92__CALL_PAL_RW1(wtint, unsigned long, unsigned long);
92 93
93/* 94/*
94 * TB routines.. 95 * TB routines..
diff --git a/arch/alpha/include/uapi/asm/pal.h b/arch/alpha/include/uapi/asm/pal.h
index 3c0ce08e5f59..dfc8140b9088 100644
--- a/arch/alpha/include/uapi/asm/pal.h
+++ b/arch/alpha/include/uapi/asm/pal.h
@@ -46,6 +46,7 @@
46#define PAL_rdusp 58 46#define PAL_rdusp 58
47#define PAL_whami 60 47#define PAL_whami 60
48#define PAL_retsys 61 48#define PAL_retsys 61
49#define PAL_wtint 62
49#define PAL_rti 63 50#define PAL_rti 63
50 51
51 52
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index f2360a74e5d5..1941a07b5811 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -46,6 +46,23 @@
46void (*pm_power_off)(void) = machine_power_off; 46void (*pm_power_off)(void) = machine_power_off;
47EXPORT_SYMBOL(pm_power_off); 47EXPORT_SYMBOL(pm_power_off);
48 48
49#ifdef CONFIG_ALPHA_WTINT
50/*
51 * Sleep the CPU.
52 * EV6, LCA45 and QEMU know how to power down, skipping N timer interrupts.
53 */
54void arch_cpu_idle(void)
55{
56 wtint(0);
57 local_irq_enable();
58}
59
60void arch_cpu_idle_dead(void)
61{
62 wtint(INT_MAX);
63}
64#endif /* ALPHA_WTINT */
65
49struct halt_info { 66struct halt_info {
50 int mode; 67 int mode;
51 char *restart_cmd; 68 char *restart_cmd;
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
index bd0665cdc840..9c4c189eb22f 100644
--- a/arch/alpha/kernel/traps.c
+++ b/arch/alpha/kernel/traps.c
@@ -241,6 +241,21 @@ do_entIF(unsigned long type, struct pt_regs *regs)
241 (const char *)(data[1] | (long)data[2] << 32), 241 (const char *)(data[1] | (long)data[2] << 32),
242 data[0]); 242 data[0]);
243 } 243 }
244#ifdef CONFIG_ALPHA_WTINT
245 if (type == 4) {
246 /* If CALL_PAL WTINT is totally unsupported by the
247 PALcode, e.g. MILO, "emulate" it by overwriting
248 the insn. */
249 unsigned int *pinsn
250 = (unsigned int *) regs->pc - 1;
251 if (*pinsn == PAL_wtint) {
252 *pinsn = 0x47e01400; /* mov 0,$0 */
253 imb();
254 regs->r0 = 0;
255 return;
256 }
257 }
258#endif /* ALPHA_WTINT */
244 die_if_kernel((type == 1 ? "Kernel Bug" : "Instruction fault"), 259 die_if_kernel((type == 1 ? "Kernel Bug" : "Instruction fault"),
245 regs, type, NULL); 260 regs, type, NULL);
246 } 261 }