* [PATCH 05/34] powerpc: reuse asm-generic/barrier.h
[not found] <1451473761-30019-1-git-send-email-mst@redhat.com>
@ 2015-12-30 13:24 ` Michael S. Tsirkin
2015-12-30 13:25 ` [PATCH 16/34] powerpc: define __smp_XXX Michael S. Tsirkin
1 sibling, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2015-12-30 13:24 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Arnd Bergmann, linux-arch, Andrew Cooper,
virtualization, Stefano Stabellini, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Ingo Molnar, Paul E. McKenney,
Andrey Konovalov, linuxppc-dev
On powerpc read_barrier_depends, smp_read_barrier_depends
smp_store_mb(), smp_mb__before_atomic and smp_mb__after_atomic match the
asm-generic variants exactly. Drop the local definitions and pull in
asm-generic/barrier.h instead.
This is in preparation to refactoring this code area.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
arch/powerpc/include/asm/barrier.h | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/include/asm/barrier.h b/arch/powerpc/include/asm/barrier.h
index 0eca6ef..980ad0c 100644
--- a/arch/powerpc/include/asm/barrier.h
+++ b/arch/powerpc/include/asm/barrier.h
@@ -34,8 +34,6 @@
#define rmb() __asm__ __volatile__ ("sync" : : : "memory")
#define wmb() __asm__ __volatile__ ("sync" : : : "memory")
-#define smp_store_mb(var, value) do { WRITE_ONCE(var, value); mb(); } while (0)
-
#ifdef __SUBARCH_HAS_LWSYNC
# define SMPWMB LWSYNC
#else
@@ -60,9 +58,6 @@
#define smp_wmb() barrier()
#endif /* CONFIG_SMP */
-#define read_barrier_depends() do { } while (0)
-#define smp_read_barrier_depends() do { } while (0)
-
/*
* This is a barrier which prevents following instructions from being
* started until the value of the argument x is known. For example, if
@@ -87,8 +82,8 @@ do { \
___p1; \
})
-#define smp_mb__before_atomic() smp_mb()
-#define smp_mb__after_atomic() smp_mb()
#define smp_mb__before_spinlock() smp_mb()
+#include <asm-generic/barrier.h>
+
#endif /* _ASM_POWERPC_BARRIER_H */
--
MST
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 16/34] powerpc: define __smp_XXX
[not found] <1451473761-30019-1-git-send-email-mst@redhat.com>
2015-12-30 13:24 ` [PATCH 05/34] powerpc: reuse asm-generic/barrier.h Michael S. Tsirkin
@ 2015-12-30 13:25 ` Michael S. Tsirkin
1 sibling, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2015-12-30 13:25 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Arnd Bergmann, linux-arch, Andrew Cooper,
virtualization, Stefano Stabellini, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Ingo Molnar, Paul E. McKenney,
Andrey Konovalov, linuxppc-dev
This defines __smp_XXX barriers for powerpc
for use by virtualization.
smp_XXX barriers are removed as they are
defined correctly by asm-generic/barriers.h
This reduces the amount of arch-specific boiler-plate code.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
arch/powerpc/include/asm/barrier.h | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/arch/powerpc/include/asm/barrier.h b/arch/powerpc/include/asm/barrier.h
index 980ad0c..c0deafc 100644
--- a/arch/powerpc/include/asm/barrier.h
+++ b/arch/powerpc/include/asm/barrier.h
@@ -44,19 +44,11 @@
#define dma_rmb() __lwsync()
#define dma_wmb() __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory")
-#ifdef CONFIG_SMP
-#define smp_lwsync() __lwsync()
+#define __smp_lwsync() __lwsync()
-#define smp_mb() mb()
-#define smp_rmb() __lwsync()
-#define smp_wmb() __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory")
-#else
-#define smp_lwsync() barrier()
-
-#define smp_mb() barrier()
-#define smp_rmb() barrier()
-#define smp_wmb() barrier()
-#endif /* CONFIG_SMP */
+#define __smp_mb() mb()
+#define __smp_rmb() __lwsync()
+#define __smp_wmb() __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory")
/*
* This is a barrier which prevents following instructions from being
@@ -67,18 +59,18 @@
#define data_barrier(x) \
asm volatile("twi 0,%0,0; isync" : : "r" (x) : "memory");
-#define smp_store_release(p, v) \
+#define __smp_store_release(p, v) \
do { \
compiletime_assert_atomic_type(*p); \
- smp_lwsync(); \
+ __smp_lwsync(); \
WRITE_ONCE(*p, v); \
} while (0)
-#define smp_load_acquire(p) \
+#define __smp_load_acquire(p) \
({ \
typeof(*p) ___p1 = READ_ONCE(*p); \
compiletime_assert_atomic_type(*p); \
- smp_lwsync(); \
+ __smp_lwsync(); \
___p1; \
})
--
MST
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-30 13:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1451473761-30019-1-git-send-email-mst@redhat.com>
2015-12-30 13:24 ` [PATCH 05/34] powerpc: reuse asm-generic/barrier.h Michael S. Tsirkin
2015-12-30 13:25 ` [PATCH 16/34] powerpc: define __smp_XXX Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).