Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+12
+5
arch/sh/mm/cache-sh4.c
··· 184 184 i++, index += cpu_data->icache.way_incr) 185 185 ctrl_outl(0, index); /* Clear out Valid-bit */ 186 186 back_to_P1(); 187 + wmb(); 187 188 local_irq_restore(flags); 188 189 } 189 190 ··· 224 223 flush_cache_4096(CACHE_OC_ADDRESS_ARRAY | 0x2000, phys); 225 224 flush_cache_4096(CACHE_OC_ADDRESS_ARRAY | 0x3000, phys); 226 225 } 226 + 227 + wmb(); 227 228 } 228 229 229 230 static inline void flush_icache_all(void) ··· 250 247 __flush_dcache_all(); 251 248 else 252 249 __flush_dcache_all_ex(); 250 + wmb(); 253 251 } 254 252 255 253 void flush_cache_all(void) ··· 381 377 struct page *page, unsigned long addr, int len) 382 378 { 383 379 flush_cache_page(vma, addr, page_to_pfn(page)); 380 + mb(); 384 381 } 385 382
+7
include/asm-sh/system.h
··· 84 84 85 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 93 #define mb() __asm__ __volatile__ ("": : :"memory") 88 94 #define rmb() mb() 89 95 #define wmb() __asm__ __volatile__ ("": : :"memory") 90 96 #define read_barrier_depends() do { } while(0) 97 + #endif 91 98 92 99 #ifdef CONFIG_SMP 93 100 #define smp_mb() mb()