Commit bc9ebdb3 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by Tim Gardner

asm-generic: guard smp_store_release/load_acquire

BugLink: http://bugs.launchpad.net/bugs/1616677

Allow architectures to override smp_store_release
and smp_load_acquire by guarding the defines
in asm-generic/barrier.h with ifndef directives.

This is in preparation to reusing asm-generic/barrier.h
on architectures which have their own definition
of these macros.
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
(cherry picked from commit 57f7c037)
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
Acked-by: default avatarBrad Figg <brad.figg@canonical.com>
Acked-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 65191e24
...@@ -104,13 +104,16 @@ ...@@ -104,13 +104,16 @@
#define smp_mb__after_atomic() smp_mb() #define smp_mb__after_atomic() smp_mb()
#endif #endif
#ifndef smp_store_release
#define smp_store_release(p, v) \ #define smp_store_release(p, v) \
do { \ do { \
compiletime_assert_atomic_type(*p); \ compiletime_assert_atomic_type(*p); \
smp_mb(); \ smp_mb(); \
WRITE_ONCE(*p, v); \ WRITE_ONCE(*p, v); \
} while (0) } while (0)
#endif
#ifndef smp_load_acquire
#define smp_load_acquire(p) \ #define smp_load_acquire(p) \
({ \ ({ \
typeof(*p) ___p1 = READ_ONCE(*p); \ typeof(*p) ___p1 = READ_ONCE(*p); \
...@@ -118,6 +121,7 @@ do { \ ...@@ -118,6 +121,7 @@ do { \
smp_mb(); \ smp_mb(); \
___p1; \ ___p1; \
}) })
#endif
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
#endif /* __ASM_GENERIC_BARRIER_H */ #endif /* __ASM_GENERIC_BARRIER_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment