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

TOMOYO Linux Cross Reference
Linux/arch/parisc/include/asm/barrier.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef __ASM_BARRIER_H
  3 #define __ASM_BARRIER_H
  4 
  5 #include <asm/alternative.h>
  6 
  7 #ifndef __ASSEMBLY__
  8 
  9 /* The synchronize caches instruction executes as a nop on systems in
 10    which all memory references are performed in order. */
 11 #define synchronize_caches() asm volatile("sync" \
 12         ALTERNATIVE(ALT_COND_NO_SMP, INSN_NOP) \
 13         : : : "memory")
 14 
 15 #if defined(CONFIG_SMP)
 16 #define mb()            do { synchronize_caches(); } while (0)
 17 #define rmb()           mb()
 18 #define wmb()           mb()
 19 #define dma_rmb()       mb()
 20 #define dma_wmb()       mb()
 21 #else
 22 #define mb()            barrier()
 23 #define rmb()           barrier()
 24 #define wmb()           barrier()
 25 #define dma_rmb()       barrier()
 26 #define dma_wmb()       barrier()
 27 #endif
 28 
 29 #define __smp_mb()      mb()
 30 #define __smp_rmb()     mb()
 31 #define __smp_wmb()     mb()
 32 
 33 #define __smp_store_release(p, v)                                       \
 34 do {                                                                    \
 35         typeof(p) __p = (p);                                            \
 36         union { typeof(*p) __val; char __c[1]; } __u =                  \
 37                 { .__val = (__force typeof(*p)) (v) };                  \
 38         compiletime_assert_atomic_type(*p);                             \
 39         switch (sizeof(*p)) {                                           \
 40         case 1:                                                         \
 41                 asm volatile("stb,ma %0,0(%1)"                          \
 42                                 : : "r"(*(__u8 *)__u.__c), "r"(__p)     \
 43                                 : "memory");                            \
 44                 break;                                                  \
 45         case 2:                                                         \
 46                 asm volatile("sth,ma %0,0(%1)"                          \
 47                                 : : "r"(*(__u16 *)__u.__c), "r"(__p)    \
 48                                 : "memory");                            \
 49                 break;                                                  \
 50         case 4:                                                         \
 51                 asm volatile("stw,ma %0,0(%1)"                          \
 52                                 : : "r"(*(__u32 *)__u.__c), "r"(__p)    \
 53                                 : "memory");                            \
 54                 break;                                                  \
 55         case 8:                                                         \
 56                 if (IS_ENABLED(CONFIG_64BIT))                           \
 57                         asm volatile("std,ma %0,0(%1)"                  \
 58                                 : : "r"(*(__u64 *)__u.__c), "r"(__p)    \
 59                                 : "memory");                            \
 60                 break;                                                  \
 61         }                                                               \
 62 } while (0)
 63 
 64 #define __smp_load_acquire(p)                                           \
 65 ({                                                                      \
 66         union { typeof(*p) __val; char __c[1]; } __u;                   \
 67         typeof(p) __p = (p);                                            \
 68         compiletime_assert_atomic_type(*p);                             \
 69         switch (sizeof(*p)) {                                           \
 70         case 1:                                                         \
 71                 asm volatile("ldb,ma 0(%1),%0"                          \
 72                                 : "=r"(*(__u8 *)__u.__c) : "r"(__p)     \
 73                                 : "memory");                            \
 74                 break;                                                  \
 75         case 2:                                                         \
 76                 asm volatile("ldh,ma 0(%1),%0"                          \
 77                                 : "=r"(*(__u16 *)__u.__c) : "r"(__p)    \
 78                                 : "memory");                            \
 79                 break;                                                  \
 80         case 4:                                                         \
 81                 asm volatile("ldw,ma 0(%1),%0"                          \
 82                                 : "=r"(*(__u32 *)__u.__c) : "r"(__p)    \
 83                                 : "memory");                            \
 84                 break;                                                  \
 85         case 8:                                                         \
 86                 if (IS_ENABLED(CONFIG_64BIT))                           \
 87                         asm volatile("ldd,ma 0(%1),%0"                  \
 88                                 : "=r"(*(__u64 *)__u.__c) : "r"(__p)    \
 89                                 : "memory");                            \
 90                 break;                                                  \
 91         }                                                               \
 92         __u.__val;                                                      \
 93 })
 94 #include <asm-generic/barrier.h>
 95 
 96 #endif /* !__ASSEMBLY__ */
 97 #endif /* __ASM_BARRIER_H */
 98 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php