diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2008-07-01 11:16:40 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-07-03 02:58:10 -0400 |
commit | 2d1b2027626d5151fff8ef7c06ca8e7876a1a510 (patch) | |
tree | 6ecc861f4f45a5d26309bf12683aa0372358ef7c /include/asm-powerpc/synch.h | |
parent | 5888da18765ca9af7f10015263d8bc8e3057f128 (diff) |
powerpc: Fixup lwsync at runtime
To allow for a single kernel image on e500 v1/v2/mc we need to fixup lwsync
at runtime. On e500v1/v2 lwsync causes an illop so we need to patch up
the code. We default to 'sync' since that is always safe and if the cpu
is capable we will replace 'sync' with 'lwsync'.
We introduce CPU_FTR_LWSYNC as a way to determine at runtime if this is
needed. This flag could be moved elsewhere since we dont really use it
for the normal CPU_FTR purpose.
Finally we only store the relative offset in the fixup section to keep it
as small as possible rather than using a full fixup_entry.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/synch.h')
-rw-r--r-- | include/asm-powerpc/synch.h | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/include/asm-powerpc/synch.h b/include/asm-powerpc/synch.h index 42a1ef590690..45963e80f557 100644 --- a/include/asm-powerpc/synch.h +++ b/include/asm-powerpc/synch.h | |||
@@ -3,34 +3,42 @@ | |||
3 | #ifdef __KERNEL__ | 3 | #ifdef __KERNEL__ |
4 | 4 | ||
5 | #include <linux/stringify.h> | 5 | #include <linux/stringify.h> |
6 | #include <asm/feature-fixups.h> | ||
6 | 7 | ||
7 | #if defined(__powerpc64__) || defined(CONFIG_PPC_E500MC) | 8 | #ifndef __ASSEMBLY__ |
8 | #define __SUBARCH_HAS_LWSYNC | 9 | extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup; |
9 | #endif | 10 | extern void do_lwsync_fixups(unsigned long value, void *fixup_start, |
11 | void *fixup_end); | ||
12 | |||
13 | static inline void eieio(void) | ||
14 | { | ||
15 | __asm__ __volatile__ ("eieio" : : : "memory"); | ||
16 | } | ||
17 | |||
18 | static inline void isync(void) | ||
19 | { | ||
20 | __asm__ __volatile__ ("isync" : : : "memory"); | ||
21 | } | ||
22 | #endif /* __ASSEMBLY__ */ | ||
10 | 23 | ||
11 | #ifdef __SUBARCH_HAS_LWSYNC | 24 | #if defined(__powerpc64__) |
12 | # define LWSYNC lwsync | 25 | # define LWSYNC lwsync |
26 | #elif defined(CONFIG_E500) | ||
27 | # define LWSYNC \ | ||
28 | START_LWSYNC_SECTION(96); \ | ||
29 | sync; \ | ||
30 | MAKE_LWSYNC_SECTION_ENTRY(96, __lwsync_fixup); | ||
13 | #else | 31 | #else |
14 | # define LWSYNC sync | 32 | # define LWSYNC sync |
15 | #endif | 33 | #endif |
16 | 34 | ||
17 | #ifdef CONFIG_SMP | 35 | #ifdef CONFIG_SMP |
18 | #define ISYNC_ON_SMP "\n\tisync\n" | 36 | #define ISYNC_ON_SMP "\n\tisync\n" |
19 | #define LWSYNC_ON_SMP __stringify(LWSYNC) "\n" | 37 | #define LWSYNC_ON_SMP stringify_in_c(LWSYNC) "\n" |
20 | #else | 38 | #else |
21 | #define ISYNC_ON_SMP | 39 | #define ISYNC_ON_SMP |
22 | #define LWSYNC_ON_SMP | 40 | #define LWSYNC_ON_SMP |
23 | #endif | 41 | #endif |
24 | 42 | ||
25 | static inline void eieio(void) | ||
26 | { | ||
27 | __asm__ __volatile__ ("eieio" : : : "memory"); | ||
28 | } | ||
29 | |||
30 | static inline void isync(void) | ||
31 | { | ||
32 | __asm__ __volatile__ ("isync" : : : "memory"); | ||
33 | } | ||
34 | |||
35 | #endif /* __KERNEL__ */ | 43 | #endif /* __KERNEL__ */ |
36 | #endif /* _ASM_POWERPC_SYNCH_H */ | 44 | #endif /* _ASM_POWERPC_SYNCH_H */ |