162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _TOOLS_LINUX_ASM_MIPS_BARRIER_H
362306a36Sopenharmony_ci#define _TOOLS_LINUX_ASM_MIPS_BARRIER_H
462306a36Sopenharmony_ci/*
562306a36Sopenharmony_ci * FIXME: This came from tools/perf/perf-sys.h, where it was first introduced
662306a36Sopenharmony_ci * in c1e028ef40b8d6943b767028ba17d4f2ba020edb, more work needed to make it
762306a36Sopenharmony_ci * more closely follow the Linux kernel arch/mips/include/asm/barrier.h file.
862306a36Sopenharmony_ci * Probably when we continue work on tools/ Kconfig support to have all the
962306a36Sopenharmony_ci * CONFIG_ needed for properly doing that.
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci#define mb()		asm volatile(					\
1262306a36Sopenharmony_ci				".set	mips2\n\t"			\
1362306a36Sopenharmony_ci				"sync\n\t"				\
1462306a36Sopenharmony_ci				".set	mips0"				\
1562306a36Sopenharmony_ci				: /* no output */			\
1662306a36Sopenharmony_ci				: /* no input */			\
1762306a36Sopenharmony_ci				: "memory")
1862306a36Sopenharmony_ci#define wmb()	mb()
1962306a36Sopenharmony_ci#define rmb()	mb()
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#endif /* _TOOLS_LINUX_ASM_MIPS_BARRIER_H */
22