1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * Copied from the kernel sources to tools/perf/: 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Generic barrier definitions. 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * It should be possible to use these on really simple architectures, 8*4882a593Smuzhiyun * but it serves more as a starting point for new ports. 9*4882a593Smuzhiyun * 10*4882a593Smuzhiyun * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. 11*4882a593Smuzhiyun * Written by David Howells (dhowells@redhat.com) 12*4882a593Smuzhiyun */ 13*4882a593Smuzhiyun #ifndef __TOOLS_LINUX_ASM_GENERIC_BARRIER_H 14*4882a593Smuzhiyun #define __TOOLS_LINUX_ASM_GENERIC_BARRIER_H 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun #ifndef __ASSEMBLY__ 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun #include <linux/compiler.h> 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun /* 21*4882a593Smuzhiyun * Force strict CPU ordering. And yes, this is required on UP too when we're 22*4882a593Smuzhiyun * talking to devices. 23*4882a593Smuzhiyun * 24*4882a593Smuzhiyun * Fall back to compiler barriers if nothing better is provided. 25*4882a593Smuzhiyun */ 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun #ifndef mb 28*4882a593Smuzhiyun #define mb() barrier() 29*4882a593Smuzhiyun #endif 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun #ifndef rmb 32*4882a593Smuzhiyun #define rmb() mb() 33*4882a593Smuzhiyun #endif 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun #ifndef wmb 36*4882a593Smuzhiyun #define wmb() mb() 37*4882a593Smuzhiyun #endif 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun #endif /* !__ASSEMBLY__ */ 40*4882a593Smuzhiyun #endif /* __TOOLS_LINUX_ASM_GENERIC_BARRIER_H */ 41