~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/um/asm/barrier.h

Version: ~ [ linux-5.16 ] ~ [ linux-5.15.13 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.90 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.170 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.224 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.261 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.296 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.298 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _ASM_UM_BARRIER_H_
  2 #define _ASM_UM_BARRIER_H_
  3 
  4 #include <asm/asm.h>
  5 #include <asm/segment.h>
  6 #include <asm/cpufeature.h>
  7 #include <asm/cmpxchg.h>
  8 #include <asm/nops.h>
  9 
 10 #include <linux/kernel.h>
 11 #include <linux/irqflags.h>
 12 
 13 /*
 14  * Force strict CPU ordering.
 15  * And yes, this is required on UP too when we're talking
 16  * to devices.
 17  */
 18 #ifdef CONFIG_X86_32
 19 
 20 #define mb()    alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2)
 21 #define rmb()   alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2)
 22 #define wmb()   alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM)
 23 
 24 #else /* CONFIG_X86_32 */
 25 
 26 #define mb()    asm volatile("mfence" : : : "memory")
 27 #define rmb()   asm volatile("lfence" : : : "memory")
 28 #define wmb()   asm volatile("sfence" : : : "memory")
 29 
 30 #endif /* CONFIG_X86_32 */
 31 
 32 #define read_barrier_depends()  do { } while (0)
 33 
 34 #ifdef CONFIG_SMP
 35 
 36 #define smp_mb()        mb()
 37 #ifdef CONFIG_X86_PPRO_FENCE
 38 #define smp_rmb()       rmb()
 39 #else /* CONFIG_X86_PPRO_FENCE */
 40 #define smp_rmb()       barrier()
 41 #endif /* CONFIG_X86_PPRO_FENCE */
 42 
 43 #define smp_wmb()       barrier()
 44 
 45 #define smp_read_barrier_depends()      read_barrier_depends()
 46 #define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
 47 
 48 #else /* CONFIG_SMP */
 49 
 50 #define smp_mb()        barrier()
 51 #define smp_rmb()       barrier()
 52 #define smp_wmb()       barrier()
 53 #define smp_read_barrier_depends()      do { } while (0)
 54 #define set_mb(var, value) do { var = value; barrier(); } while (0)
 55 
 56 #endif /* CONFIG_SMP */
 57 
 58 /*
 59  * Stop RDTSC speculation. This is needed when you need to use RDTSC
 60  * (or get_cycles or vread that possibly accesses the TSC) in a defined
 61  * code region.
 62  *
 63  * (Could use an alternative three way for this if there was one.)
 64  */
 65 static inline void rdtsc_barrier(void)
 66 {
 67         alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
 68         alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
 69 }
 70 
 71 #endif
 72 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp