mirror of
https://github.com/torvalds/linux.git
synced 2026-11-27 00:43:12 +00:00
We're going to be adding a few new barrier primitives, and in order to avoid endless duplication make more agressive use of asm-generic/barrier.h. Change the asm-generic/barrier.h such that it allows partial barrier definitions and fills out the rest with defaults. There are a few architectures (m32r, m68k) that could probably do away with their barrier.h file entirely but are kept for now due to their unconventional nop() implementation. Suggested-by: Geert Uytterhoeven <[email protected]> Reviewed-by: "Paul E. McKenney" <[email protected]> Reviewed-by: Mathieu Desnoyers <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michael Neuling <[email protected]> Cc: Russell King <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: Victor Kaplansky <[email protected]> Cc: Tony Luck <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Frederic Weisbecker <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
40 lines
1.2 KiB
C
40 lines
1.2 KiB
C
/*
|
|
* Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima
|
|
* Copyright (C) 2002 Paul Mundt
|
|
*/
|
|
#ifndef __ASM_SH_BARRIER_H
|
|
#define __ASM_SH_BARRIER_H
|
|
|
|
#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5)
|
|
#include <asm/cache_insns.h>
|
|
#endif
|
|
|
|
/*
|
|
* A brief note on ctrl_barrier(), the control register write barrier.
|
|
*
|
|
* Legacy SH cores typically require a sequence of 8 nops after
|
|
* modification of a control register in order for the changes to take
|
|
* effect. On newer cores (like the sh4a and sh5) this is accomplished
|
|
* with icbi.
|
|
*
|
|
* Also note that on sh4a in the icbi case we can forego a synco for the
|
|
* write barrier, as it's not necessary for control registers.
|
|
*
|
|
* Historically we have only done this type of barrier for the MMUCR, but
|
|
* it's also necessary for the CCR, so we make it generic here instead.
|
|
*/
|
|
#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5)
|
|
#define mb() __asm__ __volatile__ ("synco": : :"memory")
|
|
#define rmb() mb()
|
|
#define wmb() mb()
|
|
#define ctrl_barrier() __icbi(PAGE_OFFSET)
|
|
#else
|
|
#define ctrl_barrier() __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop")
|
|
#endif
|
|
|
|
#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
|
|
|
|
#include <asm-generic/barrier.h>
|
|
|
|
#endif /* __ASM_SH_BARRIER_H */
|