diff options
author | Govindarajan Mohandoss <govindarajan.mohandoss@arm.com> | 2020-12-11 22:49:20 +0000 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2021-02-23 12:17:46 +0200 |
commit | 418e577a470f773035880a30d7fe5f6cec1b42ba (patch) | |
tree | fbbe44ffeb874deb9b7121fa936615f8be31a264 /platform/linux-generic/include-abi | |
parent | a232ac2e2960ee0517db23d5f75a12afd2a0c215 (diff) |
linux-gen: atomic: add 128 bit atomic apis
Add 128 bit atomic compare-and-swap operations.
Signed-off-by: Govindarajan Mohandoss <govindarajan.mohandoss@arm.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Tested-by: Malvika Gupta <Malvika.Gupta@arm.com>
Diffstat (limited to 'platform/linux-generic/include-abi')
-rw-r--r-- | platform/linux-generic/include-abi/odp/api/abi/atomic.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/platform/linux-generic/include-abi/odp/api/abi/atomic.h b/platform/linux-generic/include-abi/odp/api/abi/atomic.h index 955b99370..13c12a79f 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/atomic.h +++ b/platform/linux-generic/include-abi/odp/api/abi/atomic.h @@ -55,6 +55,31 @@ typedef struct ODP_ALIGNED(sizeof(uint64_t)) odp_atomic_u64_s { #endif +#ifdef _ODP_LOCK_FREE_128BIT_ATOMICS + +/** + * @internal + * Atomic 128-bit unsigned integer + */ +typedef struct ODP_ALIGNED(sizeof(odp_u128_t)) odp_atomic_u128_s { + odp_u128_t v; /**< Actual storage for the atomic variable */ +} odp_atomic_u128_t; + +#else + +/** + * @internal + * Atomic 128-bit unsigned integer + */ +typedef struct ODP_ALIGNED(sizeof(odp_u128_t)) odp_atomic_u128_s { + odp_u128_t v; /**< Actual storage for the atomic variable */ + /* Some architectures do not support lock-free operations on 128-bit + * data types. We use a spin lock to ensure atomicity. */ + char lock; /**< Spin lock (if needed) used to ensure atomic access */ +} odp_atomic_u128_t; + +#endif + /** @ingroup odp_atomic * @{ */ |