[rtems-libbsd commit] ck: No hardware barriers in uniprocessor configs

Sebastian Huber sebh at rtems.org
Fri Sep 21 08:38:54 UTC 2018


Module:    rtems-libbsd
Branch:    master
Commit:    1af372a5eeaba3115f139e4efc0204e2cd7208bb
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=1af372a5eeaba3115f139e4efc0204e2cd7208bb

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Sep 14 14:04:09 2018 +0200

ck: No hardware barriers in uniprocessor configs

Update #3472.

---

 freebsd/sys/contrib/ck/include/ck_cc.h         |  3 +++
 freebsd/sys/contrib/ck/include/gcc/arm/ck_pr.h |  9 ++++++++-
 freebsd/sys/contrib/ck/include/gcc/ppc/ck_pr.h | 13 ++++++++++---
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/freebsd/sys/contrib/ck/include/ck_cc.h b/freebsd/sys/contrib/ck/include/ck_cc.h
index 9a152a3..086d12f 100644
--- a/freebsd/sys/contrib/ck/include/ck_cc.h
+++ b/freebsd/sys/contrib/ck/include/ck_cc.h
@@ -28,6 +28,9 @@
 #ifndef CK_CC_H
 #define CK_CC_H
 
+#ifdef __rtems__
+#include <rtems/score/cpuopts.h>
+#endif /* __rtems__ */
 #if defined(__GNUC__) || defined(__SUNPRO_C)
 #include "gcc/ck_cc.h"
 #endif
diff --git a/freebsd/sys/contrib/ck/include/gcc/arm/ck_pr.h b/freebsd/sys/contrib/ck/include/gcc/arm/ck_pr.h
index b1f3699..5633710 100644
--- a/freebsd/sys/contrib/ck/include/gcc/arm/ck_pr.h
+++ b/freebsd/sys/contrib/ck/include/gcc/arm/ck_pr.h
@@ -54,7 +54,8 @@ ck_pr_stall(void)
 	return;
 }
 
-#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)
+#if __ARM_ARCH >= 7 || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)
+#ifdef RTEMS_SMP
 #define CK_ISB __asm __volatile("isb" : : "r" (0) : "memory")
 #define CK_DMB __asm __volatile("dmb" : : "r" (0) : "memory")
 #define CK_DSB __asm __volatile("dsb" : : "r" (0) : "memory")
@@ -64,6 +65,12 @@ ck_pr_stall(void)
 #else
 #define CK_DMB_ST __asm __volatile("dmb st" : : "r" (0) : "memory")
 #endif /* __FreeBSD__ */
+#else /* !RTEMS_SMP */
+#define CK_ISB __asm __volatile("" : : "r" (0) : "memory")
+#define CK_DMB __asm __volatile("" : : "r" (0) : "memory")
+#define CK_DSB __asm __volatile("" : : "r" (0) : "memory")
+#define CK_DMB_ST __asm __volatile("" : : "r" (0) : "memory")
+#endif /* RTEMS_SMP */
 #else
 /* armv6 doesn't have dsb/dmb/isb, and no way to wait only for stores */
 #define CK_ISB \
diff --git a/freebsd/sys/contrib/ck/include/gcc/ppc/ck_pr.h b/freebsd/sys/contrib/ck/include/gcc/ppc/ck_pr.h
index 73f0cb7..c10b209 100644
--- a/freebsd/sys/contrib/ck/include/gcc/ppc/ck_pr.h
+++ b/freebsd/sys/contrib/ck/include/gcc/ppc/ck_pr.h
@@ -67,22 +67,28 @@ ck_pr_stall(void)
 		__asm__ __volatile__(I ::: "memory");   \
 	}
 
+#ifdef RTEMS_SMP
 #ifdef CK_MD_PPC32_LWSYNC
 #define CK_PR_LWSYNCOP "lwsync"
 #else /* CK_MD_PPC32_LWSYNC_DISABLE */
 #define CK_PR_LWSYNCOP "sync"
 #endif
+#define CK_PR_SYNCOP "sync"
+#else /* !RTEMS_SMP */
+#define CK_PR_LWSYNCOP ""
+#define CK_PR_SYNCOP ""
+#endif /* RTEMS_SMP */
 
 CK_PR_FENCE(atomic, CK_PR_LWSYNCOP)
 CK_PR_FENCE(atomic_store, CK_PR_LWSYNCOP)
-CK_PR_FENCE(atomic_load, "sync")
+CK_PR_FENCE(atomic_load, CK_PR_SYNCOP)
 CK_PR_FENCE(store_atomic, CK_PR_LWSYNCOP)
 CK_PR_FENCE(load_atomic, CK_PR_LWSYNCOP)
 CK_PR_FENCE(store, CK_PR_LWSYNCOP)
-CK_PR_FENCE(store_load, "sync")
+CK_PR_FENCE(store_load, CK_PR_SYNCOP)
 CK_PR_FENCE(load, CK_PR_LWSYNCOP)
 CK_PR_FENCE(load_store, CK_PR_LWSYNCOP)
-CK_PR_FENCE(memory, "sync")
+CK_PR_FENCE(memory, CK_PR_SYNCOP)
 CK_PR_FENCE(acquire, CK_PR_LWSYNCOP)
 CK_PR_FENCE(release, CK_PR_LWSYNCOP)
 CK_PR_FENCE(acqrel, CK_PR_LWSYNCOP)
@@ -90,6 +96,7 @@ CK_PR_FENCE(lock, CK_PR_LWSYNCOP)
 CK_PR_FENCE(unlock, CK_PR_LWSYNCOP)
 
 #undef CK_PR_LWSYNCOP
+#undef CK_PR_SYNCOP
 
 #undef CK_PR_FENCE
 




More information about the vc mailing list