Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/common/include/linux Define smp_store_mb, s...



details:   https://anonhg.NetBSD.org/src/rev/22193cc5dad8
branches:  trunk
changeset: 1027980:22193cc5dad8
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 01:24:36 2021 +0000

description:
Define smp_store_mb, smp_store_release.

diffstat:

 sys/external/bsd/common/include/linux/compiler.h |  15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diffs (34 lines):

diff -r fcbd179ece8d -r 22193cc5dad8 sys/external/bsd/common/include/linux/compiler.h
--- a/sys/external/bsd/common/include/linux/compiler.h  Sun Dec 19 01:24:25 2021 +0000
+++ b/sys/external/bsd/common/include/linux/compiler.h  Sun Dec 19 01:24:36 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compiler.h,v 1.2 2021/12/19 00:48:23 riastradh Exp $   */
+/*     $NetBSD: compiler.h,v 1.3 2021/12/19 01:24:36 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,6 +34,8 @@
 
 #include <sys/atomic.h>
 
+#include <asm/barrier.h>
+
 #define        READ_ONCE(X)    ({                                                    \
        typeof(X) __read_once_tmp = (X);                                      \
        membar_datadep_consumer();                                            \
@@ -46,4 +48,15 @@
        __write_once_tmp;                                                     \
 })
 
+#define        smp_store_mb(X, V)      do {                                          \
+       WRITE_ONCE(X, V);                                                     \
+       smp_mb();                                                             \
+} while (0)
+
+#define        smp_store_release(X, V) do {                                          \
+       typeof(X) __smp_store_release_tmp = (V);                              \
+       membar_exit();                                                        \
+       (X) = __write_once_tmp;                                               \
+} while (0)
+
 #endif /* _LINUX_COMPILER_H_ */



Home | Main Index | Thread Index | Old Index