diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-06-19 01:40:51 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-06-23 04:30:17 -0400 |
commit | 2e046b9487dcc60707cac77fb8f744ec830209cd (patch) | |
tree | 9031ab1f8c1d2037b6be97e9378983a89267fd54 /arch | |
parent | d888a4c76c51092993643f8992bf55b3c28da483 (diff) |
sh: Provide cpu_idle_wait() to fix up cpuidle/SMP build.
Crib the x86 cpu_idle_wait() implementation and shove it in with the
idle code, subsequently enabling ARCH_HAS_CPU_IDLE_WAIT.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/Kconfig | 3 | ||||
-rw-r--r-- | arch/sh/include/asm/system.h | 1 | ||||
-rw-r--r-- | arch/sh/kernel/idle.c | 23 |
3 files changed, 26 insertions, 1 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index ac1c620d1c7d..09c0aef31d03 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -151,6 +151,9 @@ config ARCH_NO_VIRT_TO_BUS | |||
151 | config ARCH_HAS_DEFAULT_IDLE | 151 | config ARCH_HAS_DEFAULT_IDLE |
152 | def_bool y | 152 | def_bool y |
153 | 153 | ||
154 | config ARCH_HAS_CPU_IDLE_WAIT | ||
155 | def_bool y | ||
156 | |||
154 | config IO_TRAPPED | 157 | config IO_TRAPPED |
155 | bool | 158 | bool |
156 | 159 | ||
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h index a88895e6dcb0..ab79e1f4fbe0 100644 --- a/arch/sh/include/asm/system.h +++ b/arch/sh/include/asm/system.h | |||
@@ -154,6 +154,7 @@ extern struct dentry *sh_debugfs_root; | |||
154 | 154 | ||
155 | void per_cpu_trap_init(void); | 155 | void per_cpu_trap_init(void); |
156 | void default_idle(void); | 156 | void default_idle(void); |
157 | void cpu_idle_wait(void); | ||
157 | 158 | ||
158 | asmlinkage void break_point_trap(void); | 159 | asmlinkage void break_point_trap(void); |
159 | 160 | ||
diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c index f35ed0348850..27ff2dc093c7 100644 --- a/arch/sh/kernel/idle.c +++ b/arch/sh/kernel/idle.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * The idle loop for all SuperH platforms. | 2 | * The idle loop for all SuperH platforms. |
3 | * | 3 | * |
4 | * Copyright (C) 2002 - 2008 Paul Mundt | 4 | * Copyright (C) 2002 - 2009 Paul Mundt |
5 | * | 5 | * |
6 | * This file is subject to the terms and conditions of the GNU General Public | 6 | * This file is subject to the terms and conditions of the GNU General Public |
7 | * License. See the file "COPYING" in the main directory of this archive | 7 | * License. See the file "COPYING" in the main directory of this archive |
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/preempt.h> | 15 | #include <linux/preempt.h> |
16 | #include <linux/thread_info.h> | 16 | #include <linux/thread_info.h> |
17 | #include <linux/irqflags.h> | 17 | #include <linux/irqflags.h> |
18 | #include <linux/smp.h> | ||
18 | #include <asm/pgalloc.h> | 19 | #include <asm/pgalloc.h> |
19 | #include <asm/system.h> | 20 | #include <asm/system.h> |
20 | #include <asm/atomic.h> | 21 | #include <asm/atomic.h> |
@@ -79,3 +80,23 @@ void cpu_idle(void) | |||
79 | check_pgt_cache(); | 80 | check_pgt_cache(); |
80 | } | 81 | } |
81 | } | 82 | } |
83 | |||
84 | static void do_nothing(void *unused) | ||
85 | { | ||
86 | } | ||
87 | |||
88 | /* | ||
89 | * cpu_idle_wait - Used to ensure that all the CPUs discard old value of | ||
90 | * pm_idle and update to new pm_idle value. Required while changing pm_idle | ||
91 | * handler on SMP systems. | ||
92 | * | ||
93 | * Caller must have changed pm_idle to the new value before the call. Old | ||
94 | * pm_idle value will not be used by any CPU after the return of this function. | ||
95 | */ | ||
96 | void cpu_idle_wait(void) | ||
97 | { | ||
98 | smp_mb(); | ||
99 | /* kick all the CPUs so that they exit out of pm_idle */ | ||
100 | smp_call_function(do_nothing, NULL, 1); | ||
101 | } | ||
102 | EXPORT_SYMBOL_GPL(cpu_idle_wait); | ||