This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, api-next has been updated via 506bf9dcf0e071cd8b168806b1d279124551af86 (commit) via 41472f5887d172234aaa89af0775b9e32f2209e9 (commit) via 8f63377237e1f783f77c2baf94922f07bcb24a55 (commit) via 52cfe7ba6d2541cf5ee464e46e91b2da5efe1497 (commit) from 75cfc6f70d5b21d6f04082e1d03a7e677a895280 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 506bf9dcf0e071cd8b168806b1d279124551af86 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Oct 4 21:15:33 2017 +0300
linux-gen: more unification of arch-specific code
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index f830d69f..05456681 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -278,6 +278,7 @@ arch_odp_headers = $(srcdir)/arch/arm/odp/api/cpu_arch.h noinst_HEADERS += ${srcdir}/arch/arm/odp_atomic.h \ ${srcdir}/arch/arm/odp_cpu.h \ ${srcdir}/arch/arm/odp_cpu_idling.h \ + ${srcdir}/arch/default/odp_cpu_idling.h \ ${srcdir}/arch/arm/odp_llsc.h endif if ARCH_IS_AARCH64 @@ -289,6 +290,7 @@ arch_odp_headers = $(srcdir)/arch/aarch64/odp/api/cpu_arch.h noinst_HEADERS += ${srcdir}/arch/aarch64/odp_atomic.h \ ${srcdir}/arch/aarch64/odp_cpu.h \ ${srcdir}/arch/aarch64/odp_cpu_idling.h \ + ${srcdir}/arch/default/odp_cpu_idling.h \ ${srcdir}/arch/aarch64/odp_llsc.h endif if ARCH_IS_MIPS64 @@ -297,7 +299,8 @@ __LIB__libodp_linux_la_SOURCES += arch/mips64/odp_cpu_arch.c \ arch/default/odp_global_time.c \ arch/mips64/odp_sysinfo_parse.c arch_odp_headers = $(srcdir)/arch/mips64/odp/api/cpu_arch.h -noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h +noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h \ + ${srcdir}/arch/default/odp_cpu_idling.h endif if ARCH_IS_POWERPC __LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \ @@ -305,7 +308,8 @@ __LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \ arch/default/odp_global_time.c \ arch/powerpc/odp_sysinfo_parse.c arch_odp_headers = $(srcdir)/arch/powerpc/odp/api/cpu_arch.h -noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h +noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h \ + ${srcdir}/arch/default/odp_cpu_idling.h endif if ARCH_IS_X86 __LIB__libodp_linux_la_SOURCES += arch/x86/cpu_flags.c \ @@ -315,7 +319,8 @@ __LIB__libodp_linux_la_SOURCES += arch/x86/cpu_flags.c \ arch/x86/odp_sysinfo_parse.c arch_odp_headers = $(srcdir)/arch/x86/odp/api/cpu_arch.h noinst_HEADERS += $(srcdir)/arch/x86/cpu_flags.h -noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h +noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h \ + ${srcdir}/arch/default/odp_cpu_idling.h endif
noinst_HEADERS += $(srcdir)/arch/default/odp/api/cpu_arch.h diff --git a/platform/linux-generic/arch/aarch64/odp_cpu_idling.h b/platform/linux-generic/arch/aarch64/odp_cpu_idling.h index ab29455b..e7dec7d9 100644 --- a/platform/linux-generic/arch/aarch64/odp_cpu_idling.h +++ b/platform/linux-generic/arch/aarch64/odp_cpu_idling.h @@ -13,39 +13,33 @@ #error This file should not be included directly, please include odp_cpu.h #endif
+#ifndef CONFIG_WFE + +#include "../default/odp_cpu_idling.h" + +#else /* CONFIG_WFE */ + static inline void sevl(void) { -#ifdef CONFIG_WFE __asm__ volatile("sevl" : : : ); -#endif }
static inline int wfe(void) { -#ifdef CONFIG_WFE __asm__ volatile("wfe" : : : "memory"); -#endif return 1; }
static inline void doze(void) { -#ifndef CONFIG_WFE /* When using WFE do not stall the pipeline using other means */ odp_cpu_pause(); -#endif }
-#ifdef CONFIG_WFE #define monitor128(addr, mo) lld((addr), (mo)) #define monitor64(addr, mo) ll64((addr), (mo)) #define monitor32(addr, mo) ll32((addr), (mo)) #define monitor8(addr, mo) ll8((addr), (mo)) -#else -#define monitor128(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor64(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor32(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor8(addr, mo) __atomic_load_n((addr), (mo)) -#endif +#endif /* CONFIG_WFE */
#endif /* PLATFORM_LINUXGENERIC_ARCH_ARM_CPU_IDLING_H */ diff --git a/platform/linux-generic/arch/arm/odp_cpu_idling.h b/platform/linux-generic/arch/arm/odp_cpu_idling.h index ab29455b..e7dec7d9 100644 --- a/platform/linux-generic/arch/arm/odp_cpu_idling.h +++ b/platform/linux-generic/arch/arm/odp_cpu_idling.h @@ -13,39 +13,33 @@ #error This file should not be included directly, please include odp_cpu.h #endif
+#ifndef CONFIG_WFE + +#include "../default/odp_cpu_idling.h" + +#else /* CONFIG_WFE */ + static inline void sevl(void) { -#ifdef CONFIG_WFE __asm__ volatile("sevl" : : : ); -#endif }
static inline int wfe(void) { -#ifdef CONFIG_WFE __asm__ volatile("wfe" : : : "memory"); -#endif return 1; }
static inline void doze(void) { -#ifndef CONFIG_WFE /* When using WFE do not stall the pipeline using other means */ odp_cpu_pause(); -#endif }
-#ifdef CONFIG_WFE #define monitor128(addr, mo) lld((addr), (mo)) #define monitor64(addr, mo) ll64((addr), (mo)) #define monitor32(addr, mo) ll32((addr), (mo)) #define monitor8(addr, mo) ll8((addr), (mo)) -#else -#define monitor128(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor64(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor32(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor8(addr, mo) __atomic_load_n((addr), (mo)) -#endif +#endif /* CONFIG_WFE */
#endif /* PLATFORM_LINUXGENERIC_ARCH_ARM_CPU_IDLING_H */ diff --git a/platform/linux-generic/arch/default/odp_cpu.h b/platform/linux-generic/arch/default/odp_cpu.h index 12a44b93..2df6f65c 100644 --- a/platform/linux-generic/arch/default/odp_cpu.h +++ b/platform/linux-generic/arch/default/odp_cpu.h @@ -16,28 +16,6 @@ #define atomic_store_release(loc, val, ro) \ __atomic_store_n(loc, val, __ATOMIC_RELEASE)
-/****************************************************************************** - * Idle mgmt - *****************************************************************************/ - -static inline void sevl(void) -{ - /* empty */ -} - -static inline int wfe(void) -{ - return 1; -} - -#define monitor128(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor64(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor32(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor8(addr, mo) __atomic_load_n((addr), (mo)) - -static inline void doze(void) -{ - odp_cpu_pause(); -} +#include "odp_cpu_idling.h"
#endif diff --git a/platform/linux-generic/arch/default/odp_cpu.h b/platform/linux-generic/arch/default/odp_cpu_idling.h similarity index 69% copy from platform/linux-generic/arch/default/odp_cpu.h copy to platform/linux-generic/arch/default/odp_cpu_idling.h index 12a44b93..db1eebd1 100644 --- a/platform/linux-generic/arch/default/odp_cpu.h +++ b/platform/linux-generic/arch/default/odp_cpu_idling.h @@ -6,15 +6,8 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#ifndef ODP_DEFAULT_CPU_H_ -#define ODP_DEFAULT_CPU_H_ - -/****************************************************************************** - * Atomics - *****************************************************************************/ - -#define atomic_store_release(loc, val, ro) \ - __atomic_store_n(loc, val, __ATOMIC_RELEASE) +#ifndef ODP_DEFAULT_CPU_IDLING_H_ +#define ODP_DEFAULT_CPU_IDLING_H_
/****************************************************************************** * Idle mgmt
commit 41472f5887d172234aaa89af0775b9e32f2209e9 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Oct 4 21:07:02 2017 +0300
linux-gen: update api-next to follow merged changes
There were changes in master branch on the way architecture files are treated. Update api-next after merging in master to follow those changes.
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 8f6c6570..f830d69f 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -9,6 +9,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ AM_CPPFLAGS += -I$(top_builddir)/include AM_CPPFLAGS += -Iinclude AM_CPPFLAGS += -I$(top_srcdir)/platform/$(with_platform)/arch/$(ARCH_DIR) +AM_CPPFLAGS += -I$(top_srcdir)/platform/$(with_platform)/arch/default AM_CPPFLAGS += -Iinclude AM_CPPFLAGS += -DSYSCONFDIR="@sysconfdir@"
@@ -195,22 +196,6 @@ noinst_HEADERS = \ ${srcdir}/include/protocols/thash.h \ ${srcdir}/include/protocols/udp.h
-if ARCH_IS_ARM -noinst_HEADERS += ${srcdir}/arch/arm/odp_atomic.h \ - ${srcdir}/arch/arm/odp_cpu.h \ - ${srcdir}/arch/arm/odp_cpu_idling.h \ - ${srcdir}/arch/arm/odp_llsc.h -endif -if ARCH_IS_MIPS64 -noinst_HEADERS += ${srcdir}/arch/mips64/odp_cpu.h -endif -if ARCH_IS_POWERPC -noinst_HEADERS += ${srcdir}/arch/powerpc/odp_cpu.h -endif -if ARCH_IS_X86 -noinst_HEADERS += ${srcdir}/arch/x86/odp_cpu.h -endif - __LIB__libodp_linux_la_SOURCES = \ _fdserver.c \ _ishm.c \ @@ -290,6 +275,10 @@ __LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \ arch/default/odp_global_time.c \ arch/default/odp_sysinfo_parse.c arch_odp_headers = $(srcdir)/arch/arm/odp/api/cpu_arch.h +noinst_HEADERS += ${srcdir}/arch/arm/odp_atomic.h \ + ${srcdir}/arch/arm/odp_cpu.h \ + ${srcdir}/arch/arm/odp_cpu_idling.h \ + ${srcdir}/arch/arm/odp_llsc.h endif if ARCH_IS_AARCH64 __LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \ @@ -297,6 +286,10 @@ __LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \ arch/aarch64/odp_global_time.c \ arch/default/odp_sysinfo_parse.c arch_odp_headers = $(srcdir)/arch/aarch64/odp/api/cpu_arch.h +noinst_HEADERS += ${srcdir}/arch/aarch64/odp_atomic.h \ + ${srcdir}/arch/aarch64/odp_cpu.h \ + ${srcdir}/arch/aarch64/odp_cpu_idling.h \ + ${srcdir}/arch/aarch64/odp_llsc.h endif if ARCH_IS_MIPS64 __LIB__libodp_linux_la_SOURCES += arch/mips64/odp_cpu_arch.c \ @@ -304,6 +297,7 @@ __LIB__libodp_linux_la_SOURCES += arch/mips64/odp_cpu_arch.c \ arch/default/odp_global_time.c \ arch/mips64/odp_sysinfo_parse.c arch_odp_headers = $(srcdir)/arch/mips64/odp/api/cpu_arch.h +noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h endif if ARCH_IS_POWERPC __LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \ @@ -311,6 +305,7 @@ __LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \ arch/default/odp_global_time.c \ arch/powerpc/odp_sysinfo_parse.c arch_odp_headers = $(srcdir)/arch/powerpc/odp/api/cpu_arch.h +noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h endif if ARCH_IS_X86 __LIB__libodp_linux_la_SOURCES += arch/x86/cpu_flags.c \ @@ -320,6 +315,7 @@ __LIB__libodp_linux_la_SOURCES += arch/x86/cpu_flags.c \ arch/x86/odp_sysinfo_parse.c arch_odp_headers = $(srcdir)/arch/x86/odp/api/cpu_arch.h noinst_HEADERS += $(srcdir)/arch/x86/cpu_flags.h +noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h endif
noinst_HEADERS += $(srcdir)/arch/default/odp/api/cpu_arch.h diff --git a/platform/linux-generic/arch/arm/odp_atomic.h b/platform/linux-generic/arch/aarch64/odp_atomic.h similarity index 99% copy from platform/linux-generic/arch/arm/odp_atomic.h copy to platform/linux-generic/arch/aarch64/odp_atomic.h index 3a21a47b..23bf96c7 100644 --- a/platform/linux-generic/arch/arm/odp_atomic.h +++ b/platform/linux-generic/arch/aarch64/odp_atomic.h @@ -28,8 +28,6 @@ do { \
#endif /* CONFIG_DMBSTR */
-#ifdef __aarch64__ - #define HAS_ACQ(mo) ((mo) != __ATOMIC_RELAXED && (mo) != __ATOMIC_RELEASE) #define HAS_RLS(mo) ((mo) == __ATOMIC_RELEASE || (mo) == __ATOMIC_ACQ_REL || \ (mo) == __ATOMIC_SEQ_CST) @@ -207,6 +205,4 @@ static inline __int128 __lockfree_load_16(__int128 *var, int mo) return old; }
-#endif /* __aarch64__ */ - #endif /* PLATFORM_LINUXGENERIC_ARCH_ARM_ODP_ATOMIC_H */ diff --git a/platform/linux-generic/arch/arm/odp_cpu.h b/platform/linux-generic/arch/aarch64/odp_cpu.h similarity index 85% copy from platform/linux-generic/arch/arm/odp_cpu.h copy to platform/linux-generic/arch/aarch64/odp_cpu.h index 72c81020..fc35a462 100644 --- a/platform/linux-generic/arch/arm/odp_cpu.h +++ b/platform/linux-generic/arch/aarch64/odp_cpu.h @@ -9,8 +9,8 @@ #ifndef PLATFORM_LINUXGENERIC_ARCH_ARM_ODP_CPU_H #define PLATFORM_LINUXGENERIC_ARCH_ARM_ODP_CPU_H
-#if !defined(__arm__) && !defined(__aarch64__) -#error Use this file only when compiling for ARM architecture +#if !defined(__aarch64__) +#error Use this file only when compiling for ARMv8 architecture #endif
#include <odp_debug_internal.h> @@ -38,17 +38,13 @@ * more scalable) and enables the CPU to enter a sleep state (lower power * consumption). */ -#ifdef __aarch64__ #define CONFIG_WFE -#endif
static inline void dmb(void) { __asm__ volatile("dmb" : : : "memory"); }
-#ifdef __aarch64__ - /* Only ARMv8 supports DMB ISHLD */ /* A load only barrier is much cheaper than full barrier */ #define _odp_release_barrier(ro) \ @@ -59,13 +55,6 @@ do { \ __asm__ volatile("dmb ish" ::: "memory"); \ } while (0)
-#else - -#define _odp_release_barrier(ro) \ - __atomic_thread_fence(__ATOMIC_RELEASE) - -#endif /* __aarch64__ */ - #include "odp_llsc.h" #include "odp_atomic.h" #include "odp_cpu_idling.h" diff --git a/platform/linux-generic/arch/aarch64/odp_cpu_idling.h b/platform/linux-generic/arch/aarch64/odp_cpu_idling.h new file mode 100644 index 00000000..ab29455b --- /dev/null +++ b/platform/linux-generic/arch/aarch64/odp_cpu_idling.h @@ -0,0 +1,51 @@ +/* Copyright (c) 2017, ARM Limited. All rights reserved. + * + * Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef PLATFORM_LINUXGENERIC_ARCH_ARM_CPU_IDLING_H +#define PLATFORM_LINUXGENERIC_ARCH_ARM_CPU_IDLING_H + +#ifndef PLATFORM_LINUXGENERIC_ARCH_ARM_ODP_CPU_H +#error This file should not be included directly, please include odp_cpu.h +#endif + +static inline void sevl(void) +{ +#ifdef CONFIG_WFE + __asm__ volatile("sevl" : : : ); +#endif +} + +static inline int wfe(void) +{ +#ifdef CONFIG_WFE + __asm__ volatile("wfe" : : : "memory"); +#endif + return 1; +} + +static inline void doze(void) +{ +#ifndef CONFIG_WFE + /* When using WFE do not stall the pipeline using other means */ + odp_cpu_pause(); +#endif +} + +#ifdef CONFIG_WFE +#define monitor128(addr, mo) lld((addr), (mo)) +#define monitor64(addr, mo) ll64((addr), (mo)) +#define monitor32(addr, mo) ll32((addr), (mo)) +#define monitor8(addr, mo) ll8((addr), (mo)) +#else +#define monitor128(addr, mo) __atomic_load_n((addr), (mo)) +#define monitor64(addr, mo) __atomic_load_n((addr), (mo)) +#define monitor32(addr, mo) __atomic_load_n((addr), (mo)) +#define monitor8(addr, mo) __atomic_load_n((addr), (mo)) +#endif + +#endif /* PLATFORM_LINUXGENERIC_ARCH_ARM_CPU_IDLING_H */ diff --git a/platform/linux-generic/arch/arm/odp_llsc.h b/platform/linux-generic/arch/aarch64/odp_llsc.h similarity index 68% copy from platform/linux-generic/arch/arm/odp_llsc.h copy to platform/linux-generic/arch/aarch64/odp_llsc.h index 73c4d7b1..f5679293 100644 --- a/platform/linux-generic/arch/arm/odp_llsc.h +++ b/platform/linux-generic/arch/aarch64/odp_llsc.h @@ -13,92 +13,6 @@ #error This file should not be included directly, please include odp_cpu.h #endif
-#ifdef __arm__ - -static inline uint32_t ll8(uint8_t *var, int mm) -{ - uint8_t old; - - __asm__ volatile("ldrexb %0, [%1]" - : "=&r" (old) - : "r" (var) - : ); - /* Barrier after an acquiring load */ - if (mm == __ATOMIC_ACQUIRE) - dmb(); - return old; -} - -static inline uint32_t ll(uint32_t *var, int mm) -{ - uint32_t old; - - __asm__ volatile("ldrex %0, [%1]" - : "=&r" (old) - : "r" (var) - : ); - /* Barrier after an acquiring load */ - if (mm == __ATOMIC_ACQUIRE) - dmb(); - return old; -} - -#define ll32(a, b) ll((a), (b)) - -/* Return 0 on success, 1 on failure */ -static inline uint32_t sc(uint32_t *var, uint32_t neu, int mm) -{ - uint32_t ret; - - /* Barrier before a releasing store */ - if (mm == __ATOMIC_RELEASE) - dmb(); - __asm__ volatile("strex %0, %1, [%2]" - : "=&r" (ret) - : "r" (neu), "r" (var) - : ); - return ret; -} - -#define sc32(a, b, c) sc((a), (b), (c)) - -static inline uint64_t lld(uint64_t *var, int mm) -{ - uint64_t old; - - __asm__ volatile("ldrexd %0, %H0, [%1]" - : "=&r" (old) - : "r" (var) - : ); - /* Barrier after an acquiring load */ - if (mm == __ATOMIC_ACQUIRE) - dmb(); - return old; -} - -#define ll64(a, b) lld((a), (b)) - -/* Return 0 on success, 1 on failure */ -static inline uint32_t scd(uint64_t *var, uint64_t neu, int mm) -{ - uint32_t ret; - - /* Barrier before a releasing store */ - if (mm == __ATOMIC_RELEASE) - dmb(); - __asm__ volatile("strexd %0, %1, %H1, [%2]" - : "=&r" (ret) - : "r" (neu), "r" (var) - : ); - return ret; -} - -#define sc64(a, b, c) scd((a), (b), (c)) - -#endif /* __arm__ */ - -#ifdef __aarch64__ - static inline uint16_t ll8(uint8_t *var, int mm) { uint16_t old; @@ -248,6 +162,4 @@ static inline uint32_t scd(__int128 *var, __int128 neu, int mm) return ret; }
-#endif /* __aarch64__ */ - #endif /* PLATFORM_LINUXGENERIC_ARCH_ARM_LLSC_H */ diff --git a/platform/linux-generic/arch/arm/odp_atomic.h b/platform/linux-generic/arch/arm/odp_atomic.h index 3a21a47b..590bdf4a 100644 --- a/platform/linux-generic/arch/arm/odp_atomic.h +++ b/platform/linux-generic/arch/arm/odp_atomic.h @@ -28,185 +28,4 @@ do { \
#endif /* CONFIG_DMBSTR */
-#ifdef __aarch64__ - -#define HAS_ACQ(mo) ((mo) != __ATOMIC_RELAXED && (mo) != __ATOMIC_RELEASE) -#define HAS_RLS(mo) ((mo) == __ATOMIC_RELEASE || (mo) == __ATOMIC_ACQ_REL || \ - (mo) == __ATOMIC_SEQ_CST) - -#define LL_MO(mo) (HAS_ACQ((mo)) ? __ATOMIC_ACQUIRE : __ATOMIC_RELAXED) -#define SC_MO(mo) (HAS_RLS((mo)) ? __ATOMIC_RELEASE : __ATOMIC_RELAXED) - -#ifndef __ARM_FEATURE_QRDMX /* Feature only available in v8.1a and beyond */ -static inline bool -__lockfree_compare_exchange_16(register __int128 *var, __int128 *exp, - register __int128 neu, bool weak, int mo_success, - int mo_failure) -{ - (void)weak; /* Always do strong CAS or we can't perform atomic read */ - /* Ignore memory ordering for failure, memory order for - * success must be stronger or equal. */ - (void)mo_failure; - register __int128 old; - register __int128 expected; - int ll_mo = LL_MO(mo_success); - int sc_mo = SC_MO(mo_success); - - expected = *exp; - __asm__ volatile("" ::: "memory"); - do { - /* Atomicity of LLD is not guaranteed */ - old = lld(var, ll_mo); - /* Must write back neu or old to verify atomicity of LLD */ - } while (odp_unlikely(scd(var, old == expected ? neu : old, sc_mo))); - *exp = old; /* Always update, atomically read value */ - return old == expected; -} - -static inline __int128 __lockfree_exchange_16(__int128 *var, __int128 neu, - int mo) -{ - register __int128 old; - int ll_mo = LL_MO(mo); - int sc_mo = SC_MO(mo); - - do { - /* Atomicity of LLD is not guaranteed */ - old = lld(var, ll_mo); - /* Must successfully write back to verify atomicity of LLD */ - } while (odp_unlikely(scd(var, neu, sc_mo))); - return old; -} - -static inline __int128 __lockfree_fetch_and_16(__int128 *var, __int128 mask, - int mo) -{ - register __int128 old; - int ll_mo = LL_MO(mo); - int sc_mo = SC_MO(mo); - - do { - /* Atomicity of LLD is not guaranteed */ - old = lld(var, ll_mo); - /* Must successfully write back to verify atomicity of LLD */ - } while (odp_unlikely(scd(var, old & mask, sc_mo))); - return old; -} - -static inline __int128 __lockfree_fetch_or_16(__int128 *var, __int128 mask, - int mo) -{ - register __int128 old; - int ll_mo = LL_MO(mo); - int sc_mo = SC_MO(mo); - - do { - /* Atomicity of LLD is not guaranteed */ - old = lld(var, ll_mo); - /* Must successfully write back to verify atomicity of LLD */ - } while (odp_unlikely(scd(var, old | mask, sc_mo))); - return old; -} - -#else - -static inline __int128 casp(__int128 *var, __int128 old, __int128 neu, int mo) -{ - if (mo == __ATOMIC_RELAXED) { - __asm__ volatile("casp %0, %H0, %1, %H1, [%2]" - : "+r" (old) - : "r" (neu), "r" (var) - : "memory"); - } else if (mo == __ATOMIC_ACQUIRE) { - __asm__ volatile("caspa %0, %H0, %1, %H1, [%2]" - : "+r" (old) - : "r" (neu), "r" (var) - : "memory"); - } else if (mo == __ATOMIC_ACQ_REL) { - __asm__ volatile("caspal %0, %H0, %1, %H1, [%2]" - : "+r" (old) - : "r" (neu), "r" (var) - : "memory"); - } else if (mo == __ATOMIC_RELEASE) { - __asm__ volatile("caspl %0, %H0, %1, %H1, [%2]" - : "+r" (old) - : "r" (neu), "r" (var) - : "memory"); - } else { - abort(); - } - return old; -} - -static inline bool -__lockfree_compare_exchange_16(register __int128 *var, __int128 *exp, - register __int128 neu, bool weak, int mo_success, - int mo_failure) -{ - (void)weak; - (void)mo_failure; - __int128 old; - __int128 expected; - - expected = *exp; - old = casp(var, expected, neu, mo_success); - *exp = old; /* Always update, atomically read value */ - return old == expected; -} - -static inline __int128 __lockfree_exchange_16(__int128 *var, __int128 neu, - int mo) -{ - __int128 old; - __int128 expected; - - do { - expected = *var; - old = casp(var, expected, neu, mo); - } while (old != expected); - return old; -} - -static inline __int128 __lockfree_fetch_and_16(__int128 *var, __int128 mask, - int mo) -{ - __int128 old; - __int128 expected; - - do { - expected = *var; - old = casp(var, expected, expected & mask, mo); - } while (old != expected); - return old; -} - -static inline __int128 __lockfree_fetch_or_16(__int128 *var, __int128 mask, - int mo) -{ - __int128 old; - __int128 expected; - - do { - expected = *var; - old = casp(var, expected, expected | mask, mo); - } while (old != expected); - return old; -} - -#endif /* __ARM_FEATURE_QRDMX */ - -static inline __int128 __lockfree_load_16(__int128 *var, int mo) -{ - __int128 old = *var; /* Possibly torn read */ - - /* Do CAS to ensure atomicity - * Either CAS succeeds (writing back the same value) - * Or CAS fails and returns the old value (atomic read) - */ - (void)__lockfree_compare_exchange_16(var, &old, old, false, mo, mo); - return old; -} - -#endif /* __aarch64__ */ - #endif /* PLATFORM_LINUXGENERIC_ARCH_ARM_ODP_ATOMIC_H */ diff --git a/platform/linux-generic/arch/arm/odp_cpu.h b/platform/linux-generic/arch/arm/odp_cpu.h index 72c81020..d77c8521 100644 --- a/platform/linux-generic/arch/arm/odp_cpu.h +++ b/platform/linux-generic/arch/arm/odp_cpu.h @@ -9,7 +9,7 @@ #ifndef PLATFORM_LINUXGENERIC_ARCH_ARM_ODP_CPU_H #define PLATFORM_LINUXGENERIC_ARCH_ARM_ODP_CPU_H
-#if !defined(__arm__) && !defined(__aarch64__) +#if !defined(__arm__) #error Use this file only when compiling for ARM architecture #endif
@@ -38,34 +38,16 @@ * more scalable) and enables the CPU to enter a sleep state (lower power * consumption). */ -#ifdef __aarch64__ -#define CONFIG_WFE -#endif +/* #define CONFIG_WFE */
static inline void dmb(void) { __asm__ volatile("dmb" : : : "memory"); }
-#ifdef __aarch64__ - -/* Only ARMv8 supports DMB ISHLD */ -/* A load only barrier is much cheaper than full barrier */ -#define _odp_release_barrier(ro) \ -do { \ - if (ro) \ - __asm__ volatile("dmb ishld" ::: "memory"); \ - else \ - __asm__ volatile("dmb ish" ::: "memory"); \ -} while (0) - -#else - #define _odp_release_barrier(ro) \ __atomic_thread_fence(__ATOMIC_RELEASE)
-#endif /* __aarch64__ */ - #include "odp_llsc.h" #include "odp_atomic.h" #include "odp_cpu_idling.h" diff --git a/platform/linux-generic/arch/arm/odp_llsc.h b/platform/linux-generic/arch/arm/odp_llsc.h index 73c4d7b1..b53cedc2 100644 --- a/platform/linux-generic/arch/arm/odp_llsc.h +++ b/platform/linux-generic/arch/arm/odp_llsc.h @@ -13,8 +13,6 @@ #error This file should not be included directly, please include odp_cpu.h #endif
-#ifdef __arm__ - static inline uint32_t ll8(uint8_t *var, int mm) { uint8_t old; @@ -95,159 +93,4 @@ static inline uint32_t scd(uint64_t *var, uint64_t neu, int mm)
#define sc64(a, b, c) scd((a), (b), (c))
-#endif /* __arm__ */ - -#ifdef __aarch64__ - -static inline uint16_t ll8(uint8_t *var, int mm) -{ - uint16_t old; - - if (mm == __ATOMIC_ACQUIRE) - __asm__ volatile("ldaxrb %w0, [%1]" - : "=&r" (old) - : "r" (var) - : "memory"); - else if (mm == __ATOMIC_RELAXED) - __asm__ volatile("ldxrb %w0, [%1]" - : "=&r" (old) - : "r" (var) - : ); - else - ODP_ABORT(); - return old; -} - -static inline uint32_t ll32(uint32_t *var, int mm) -{ - uint32_t old; - - if (mm == __ATOMIC_ACQUIRE) - __asm__ volatile("ldaxr %w0, [%1]" - : "=&r" (old) - : "r" (var) - : "memory"); - else if (mm == __ATOMIC_RELAXED) - __asm__ volatile("ldxr %w0, [%1]" - : "=&r" (old) - : "r" (var) - : ); - else - ODP_ABORT(); - return old; -} - -/* Return 0 on success, 1 on failure */ -static inline uint32_t sc32(uint32_t *var, uint32_t neu, int mm) -{ - uint32_t ret; - - if (mm == __ATOMIC_RELEASE) - __asm__ volatile("stlxr %w0, %w1, [%2]" - : "=&r" (ret) - : "r" (neu), "r" (var) - : "memory"); - else if (mm == __ATOMIC_RELAXED) - __asm__ volatile("stxr %w0, %w1, [%2]" - : "=&r" (ret) - : "r" (neu), "r" (var) - : ); - else - ODP_ABORT(); - return ret; -} - -static inline uint64_t ll(uint64_t *var, int mm) -{ - uint64_t old; - - if (mm == __ATOMIC_ACQUIRE) - __asm__ volatile("ldaxr %0, [%1]" - : "=&r" (old) - : "r" (var) - : "memory"); - else if (mm == __ATOMIC_RELAXED) - __asm__ volatile("ldxr %0, [%1]" - : "=&r" (old) - : "r" (var) - : ); - else - ODP_ABORT(); - return old; -} - -#define ll64(a, b) ll((a), (b)) - -/* Return 0 on success, 1 on failure */ -static inline uint32_t sc(uint64_t *var, uint64_t neu, int mm) -{ - uint32_t ret; - - if (mm == __ATOMIC_RELEASE) - __asm__ volatile("stlxr %w0, %1, [%2]" - : "=&r" (ret) - : "r" (neu), "r" (var) - : "memory"); - else if (mm == __ATOMIC_RELAXED) - __asm__ volatile("stxr %w0, %1, [%2]" - : "=&r" (ret) - : "r" (neu), "r" (var) - : ); - else - ODP_ABORT(); - return ret; -} - -#define sc64(a, b, c) sc((a), (b), (c)) - -union i128 { - __int128 i128; - int64_t i64[2]; -}; - -static inline __int128 lld(__int128 *var, int mm) -{ - union i128 old; - - if (mm == __ATOMIC_ACQUIRE) - __asm__ volatile("ldaxp %0, %1, [%2]" - : "=&r" (old.i64[0]), "=&r" (old.i64[1]) - : "r" (var) - : "memory"); - else if (mm == __ATOMIC_RELAXED) - __asm__ volatile("ldxp %0, %1, [%2]" - : "=&r" (old.i64[0]), "=&r" (old.i64[1]) - : "r" (var) - : ); - else - ODP_ABORT(); - return old.i128; -} - -/* Return 0 on success, 1 on failure */ -static inline uint32_t scd(__int128 *var, __int128 neu, int mm) -{ - uint32_t ret; - - if (mm == __ATOMIC_RELEASE) - __asm__ volatile("stlxp %w0, %1, %2, [%3]" - : "=&r" (ret) - : "r" (((union i128)neu).i64[0]), - "r" (((union i128)neu).i64[1]), - "r" (var) - : "memory"); - else if (mm == __ATOMIC_RELAXED) - __asm__ volatile("stxp %w0, %1, %2, [%3]" - : "=&r" (ret) - : "r" (((union i128)neu).i64[0]), - "r" (((union i128)neu).i64[1]), - "r" (var) - : ); - else - ODP_ABORT(); - return ret; -} - -#endif /* __aarch64__ */ - #endif /* PLATFORM_LINUXGENERIC_ARCH_ARM_LLSC_H */ diff --git a/platform/linux-generic/arch/mips64/odp_cpu.h b/platform/linux-generic/arch/mips64/odp_cpu.h deleted file mode 100644 index 1097f7bc..00000000 --- a/platform/linux-generic/arch/mips64/odp_cpu.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2017, ARM Limited. All rights reserved. - * - * Copyright (c) 2017, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef ODP_MIPS64_CPU_H_ -#define ODP_MIPS64_CPU_H_ - -/****************************************************************************** - * Atomics - *****************************************************************************/ - -#define atomic_store_release(loc, val, ro) \ - __atomic_store_n(loc, val, __ATOMIC_RELEASE) - -/****************************************************************************** - * Idle mgmt - *****************************************************************************/ - -static inline void sevl(void) -{ - /* empty */ -} - -static inline int wfe(void) -{ - return 1; -} - -#define monitor128(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor64(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor32(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor8(addr, mo) __atomic_load_n((addr), (mo)) - -static inline void doze(void) -{ - odp_cpu_pause(); -} - -#endif diff --git a/platform/linux-generic/arch/powerpc/odp_cpu.h b/platform/linux-generic/arch/powerpc/odp_cpu.h deleted file mode 100644 index cd27fe24..00000000 --- a/platform/linux-generic/arch/powerpc/odp_cpu.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2017, ARM Limited. All rights reserved. - * - * Copyright (c) 2017, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef ODP_POWERPC_CPU_H_ -#define ODP_POWERPC_CPU_H_ - -/****************************************************************************** - * Atomics - *****************************************************************************/ - -#define atomic_store_release(loc, val, ro) \ - __atomic_store_n(loc, val, __ATOMIC_RELEASE) - -/****************************************************************************** - * Idle mgmt - *****************************************************************************/ - -static inline void sevl(void) -{ - /* empty */ -} - -static inline int wfe(void) -{ - return 1; -} - -#define monitor128(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor64(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor32(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor8(addr, mo) __atomic_load_n((addr), (mo)) - -static inline void doze(void) -{ - odp_cpu_pause(); -} - -#endif diff --git a/platform/linux-generic/arch/x86/odp_cpu.h b/platform/linux-generic/arch/x86/odp_cpu.h deleted file mode 100644 index b5c89409..00000000 --- a/platform/linux-generic/arch/x86/odp_cpu.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2017, ARM Limited. All rights reserved. - * - * Copyright (c) 2017, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef ODP_X86_CPU_H_ -#define ODP_X86_CPU_H_ - -/****************************************************************************** - * Atomics - *****************************************************************************/ - -#define atomic_store_release(loc, val, ro) \ - __atomic_store_n(loc, val, __ATOMIC_RELEASE) - -/****************************************************************************** - * Idle mgmt - *****************************************************************************/ - -static inline void sevl(void) -{ - /* empty */ -} - -static inline int wfe(void) -{ - return 1; -} - -#define monitor128(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor64(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor32(addr, mo) __atomic_load_n((addr), (mo)) -#define monitor8(addr, mo) __atomic_load_n((addr), (mo)) - -static inline void doze(void) -{ - odp_cpu_pause(); -} - -#endif
commit 8f63377237e1f783f77c2baf94922f07bcb24a55 Merge: 75cfc6f7 52cfe7ba Author: Maxim Uvarov maxim.uvarov@linaro.org Date: Thu Oct 5 09:36:38 2017 +0300
Merge branch 'master' into api-next
-----------------------------------------------------------------------
Summary of changes: .travis.yml | 2 +- platform/linux-generic/Makefile.am | 33 ++-- .../arch/{arm => aarch64}/odp_atomic.h | 4 - .../linux-generic/arch/{arm => aarch64}/odp_cpu.h | 15 +- .../arch/{arm => aarch64}/odp_cpu_idling.h | 20 +-- .../linux-generic/arch/{arm => aarch64}/odp_llsc.h | 88 ---------- platform/linux-generic/arch/arm/odp_atomic.h | 181 --------------------- platform/linux-generic/arch/arm/odp_cpu.h | 22 +-- platform/linux-generic/arch/arm/odp_cpu_idling.h | 20 +-- platform/linux-generic/arch/arm/odp_llsc.h | 157 ------------------ platform/linux-generic/arch/default/odp_cpu.h | 24 +-- .../{x86/odp_cpu.h => default/odp_cpu_idling.h} | 11 +- platform/linux-generic/arch/mips64/odp_cpu.h | 43 ----- platform/linux-generic/arch/powerpc/odp_cpu.h | 43 ----- 14 files changed, 39 insertions(+), 624 deletions(-) copy platform/linux-generic/arch/{arm => aarch64}/odp_atomic.h (99%) copy platform/linux-generic/arch/{arm => aarch64}/odp_cpu.h (85%) copy platform/linux-generic/arch/{arm => aarch64}/odp_cpu_idling.h (74%) copy platform/linux-generic/arch/{arm => aarch64}/odp_llsc.h (68%) rename platform/linux-generic/arch/{x86/odp_cpu.h => default/odp_cpu_idling.h} (70%) delete mode 100644 platform/linux-generic/arch/mips64/odp_cpu.h delete mode 100644 platform/linux-generic/arch/powerpc/odp_cpu.h
hooks/post-receive