diff options
author | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 01:05:52 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 01:05:52 -0400 |
commit | fdfc74f9fcebdda14609159d5010b758a9409acf (patch) | |
tree | 191532cb703383768cc198a41503e412578921bb | |
parent | 36efc35447154317f9ffc5163a1793b5f7ff3de1 (diff) |
sh: Support for SH-4A memory barriers.
SH-4A supports 'synco' as a barrier, sprinkle it around
the cache ops as necessary..
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/mm/cache-sh4.c | 5 | ||||
-rw-r--r-- | include/asm-sh/system.h | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c index 94c05d09c3f7..846b63d6f5e8 100644 --- a/arch/sh/mm/cache-sh4.c +++ b/arch/sh/mm/cache-sh4.c | |||
@@ -184,6 +184,7 @@ void flush_cache_sigtramp(unsigned long addr) | |||
184 | i++, index += cpu_data->icache.way_incr) | 184 | i++, index += cpu_data->icache.way_incr) |
185 | ctrl_outl(0, index); /* Clear out Valid-bit */ | 185 | ctrl_outl(0, index); /* Clear out Valid-bit */ |
186 | back_to_P1(); | 186 | back_to_P1(); |
187 | wmb(); | ||
187 | local_irq_restore(flags); | 188 | local_irq_restore(flags); |
188 | } | 189 | } |
189 | 190 | ||
@@ -223,6 +224,8 @@ void flush_dcache_page(struct page *page) | |||
223 | flush_cache_4096(CACHE_OC_ADDRESS_ARRAY | 0x2000, phys); | 224 | flush_cache_4096(CACHE_OC_ADDRESS_ARRAY | 0x2000, phys); |
224 | flush_cache_4096(CACHE_OC_ADDRESS_ARRAY | 0x3000, phys); | 225 | flush_cache_4096(CACHE_OC_ADDRESS_ARRAY | 0x3000, phys); |
225 | } | 226 | } |
227 | |||
228 | wmb(); | ||
226 | } | 229 | } |
227 | 230 | ||
228 | static inline void flush_icache_all(void) | 231 | static inline void flush_icache_all(void) |
@@ -247,6 +250,7 @@ void flush_dcache_all(void) | |||
247 | __flush_dcache_all(); | 250 | __flush_dcache_all(); |
248 | else | 251 | else |
249 | __flush_dcache_all_ex(); | 252 | __flush_dcache_all_ex(); |
253 | wmb(); | ||
250 | } | 254 | } |
251 | 255 | ||
252 | void flush_cache_all(void) | 256 | void flush_cache_all(void) |
@@ -377,5 +381,6 @@ void flush_icache_user_range(struct vm_area_struct *vma, | |||
377 | struct page *page, unsigned long addr, int len) | 381 | struct page *page, unsigned long addr, int len) |
378 | { | 382 | { |
379 | flush_cache_page(vma, addr, page_to_pfn(page)); | 383 | flush_cache_page(vma, addr, page_to_pfn(page)); |
384 | mb(); | ||
380 | } | 385 | } |
381 | 386 | ||
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h index e89728d405d8..eb4902ed920a 100644 --- a/include/asm-sh/system.h +++ b/include/asm-sh/system.h | |||
@@ -84,10 +84,17 @@ static __inline__ unsigned long tas(volatile int *m) | |||
84 | 84 | ||
85 | extern void __xchg_called_with_bad_pointer(void); | 85 | extern void __xchg_called_with_bad_pointer(void); |
86 | 86 | ||
87 | #ifdef CONFIG_CPU_SH4A | ||
88 | #define mb() __asm__ __volatile__ ("synco": : :"memory") | ||
89 | #define rmb() mb() | ||
90 | #define wmb() __asm__ __volatile__ ("synco": : :"memory") | ||
91 | #define read_barrier_depends() do { } while(0) | ||
92 | #else | ||
87 | #define mb() __asm__ __volatile__ ("": : :"memory") | 93 | #define mb() __asm__ __volatile__ ("": : :"memory") |
88 | #define rmb() mb() | 94 | #define rmb() mb() |
89 | #define wmb() __asm__ __volatile__ ("": : :"memory") | 95 | #define wmb() __asm__ __volatile__ ("": : :"memory") |
90 | #define read_barrier_depends() do { } while(0) | 96 | #define read_barrier_depends() do { } while(0) |
97 | #endif | ||
91 | 98 | ||
92 | #ifdef CONFIG_SMP | 99 | #ifdef CONFIG_SMP |
93 | #define smp_mb() mb() | 100 | #define smp_mb() mb() |