18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _TOOLS_LINUX_ASM_MIPS_BARRIER_H
38c2ecf20Sopenharmony_ci#define _TOOLS_LINUX_ASM_MIPS_BARRIER_H
48c2ecf20Sopenharmony_ci/*
58c2ecf20Sopenharmony_ci * FIXME: This came from tools/perf/perf-sys.h, where it was first introduced
68c2ecf20Sopenharmony_ci * in c1e028ef40b8d6943b767028ba17d4f2ba020edb, more work needed to make it
78c2ecf20Sopenharmony_ci * more closely follow the Linux kernel arch/mips/include/asm/barrier.h file.
88c2ecf20Sopenharmony_ci * Probably when we continue work on tools/ Kconfig support to have all the
98c2ecf20Sopenharmony_ci * CONFIG_ needed for properly doing that.
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci#define mb()		asm volatile(					\
128c2ecf20Sopenharmony_ci				".set	mips2\n\t"			\
138c2ecf20Sopenharmony_ci				"sync\n\t"				\
148c2ecf20Sopenharmony_ci				".set	mips0"				\
158c2ecf20Sopenharmony_ci				: /* no output */			\
168c2ecf20Sopenharmony_ci				: /* no input */			\
178c2ecf20Sopenharmony_ci				: "memory")
188c2ecf20Sopenharmony_ci#define wmb()	mb()
198c2ecf20Sopenharmony_ci#define rmb()	mb()
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#endif /* _TOOLS_LINUX_ASM_MIPS_BARRIER_H */
22