linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 09/34] arm: 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:24 ` [PATCH 10/34] arm64: " Michael S. Tsirkin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2015-12-30 13:24 UTC (permalink / raw)
  To: linux-arm-kernel

On arm smp_store_mb, read_barrier_depends, smp_read_barrier_depends,
smp_store_release, smp_load_acquire, 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/arm/include/asm/barrier.h | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/arch/arm/include/asm/barrier.h b/arch/arm/include/asm/barrier.h
index 3ff5642..31152e8 100644
--- a/arch/arm/include/asm/barrier.h
+++ b/arch/arm/include/asm/barrier.h
@@ -70,28 +70,7 @@ extern void arm_heavy_mb(void);
 #define smp_wmb()	dmb(ishst)
 #endif
 
-#define smp_store_release(p, v)						\
-do {									\
-	compiletime_assert_atomic_type(*p);				\
-	smp_mb();							\
-	WRITE_ONCE(*p, v);						\
-} while (0)
-
-#define smp_load_acquire(p)						\
-({									\
-	typeof(*p) ___p1 = READ_ONCE(*p);				\
-	compiletime_assert_atomic_type(*p);				\
-	smp_mb();							\
-	___p1;								\
-})
-
-#define read_barrier_depends()		do { } while(0)
-#define smp_read_barrier_depends()	do { } while(0)
-
-#define smp_store_mb(var, value)	do { WRITE_ONCE(var, value); smp_mb(); } while (0)
-
-#define smp_mb__before_atomic()	smp_mb()
-#define smp_mb__after_atomic()	smp_mb()
+#include <asm-generic/barrier.h>
 
 #endif /* !__ASSEMBLY__ */
 #endif /* __ASM_BARRIER_H */
-- 
MST

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 10/34] arm64: reuse asm-generic/barrier.h
       [not found] <1451473761-30019-1-git-send-email-mst@redhat.com>
  2015-12-30 13:24 ` [PATCH 09/34] arm: reuse asm-generic/barrier.h Michael S. Tsirkin
@ 2015-12-30 13:24 ` Michael S. Tsirkin
  2015-12-30 13:25 ` [PATCH 17/34] arm64: define __smp_XXX Michael S. Tsirkin
  2015-12-30 13:25 ` [PATCH 18/34] arm: " Michael S. Tsirkin
  3 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2015-12-30 13:24 UTC (permalink / raw)
  To: linux-arm-kernel

On arm64 nop, 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/arm64/include/asm/barrier.h | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h
index 9622eb4..91a43f4 100644
--- a/arch/arm64/include/asm/barrier.h
+++ b/arch/arm64/include/asm/barrier.h
@@ -91,14 +91,7 @@ do {									\
 	__u.__val;							\
 })
 
-#define read_barrier_depends()		do { } while(0)
-#define smp_read_barrier_depends()	do { } while(0)
-
-#define smp_store_mb(var, value)	do { WRITE_ONCE(var, value); smp_mb(); } while (0)
-#define nop()		asm volatile("nop");
-
-#define smp_mb__before_atomic()	smp_mb()
-#define smp_mb__after_atomic()	smp_mb()
+#include <asm-generic/barrier.h>
 
 #endif	/* __ASSEMBLY__ */
 
-- 
MST

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 17/34] arm64: define __smp_XXX
       [not found] <1451473761-30019-1-git-send-email-mst@redhat.com>
  2015-12-30 13:24 ` [PATCH 09/34] arm: reuse asm-generic/barrier.h Michael S. Tsirkin
  2015-12-30 13:24 ` [PATCH 10/34] arm64: " Michael S. Tsirkin
@ 2015-12-30 13:25 ` Michael S. Tsirkin
  2015-12-30 13:25 ` [PATCH 18/34] arm: " Michael S. Tsirkin
  3 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2015-12-30 13:25 UTC (permalink / raw)
  To: linux-arm-kernel

This defines __smp_XXX barriers for arm64,
for use by virtualization.

smp_XXX barriers are removed as they are
defined correctly by asm-generic/barriers.h

Note: arm64 does not support !SMP config,
so smp_XXX and __smp_XXX are always equivalent.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/arm64/include/asm/barrier.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h
index 91a43f4..dae5c49 100644
--- a/arch/arm64/include/asm/barrier.h
+++ b/arch/arm64/include/asm/barrier.h
@@ -35,11 +35,11 @@
 #define dma_rmb()	dmb(oshld)
 #define dma_wmb()	dmb(oshst)
 
-#define smp_mb()	dmb(ish)
-#define smp_rmb()	dmb(ishld)
-#define smp_wmb()	dmb(ishst)
+#define __smp_mb()	dmb(ish)
+#define __smp_rmb()	dmb(ishld)
+#define __smp_wmb()	dmb(ishst)
 
-#define smp_store_release(p, v)						\
+#define __smp_store_release(p, v)						\
 do {									\
 	compiletime_assert_atomic_type(*p);				\
 	switch (sizeof(*p)) {						\
@@ -62,7 +62,7 @@ do {									\
 	}								\
 } while (0)
 
-#define smp_load_acquire(p)						\
+#define __smp_load_acquire(p)						\
 ({									\
 	union { typeof(*p) __val; char __c[1]; } __u;			\
 	compiletime_assert_atomic_type(*p);				\
-- 
MST

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 18/34] arm: define __smp_XXX
       [not found] <1451473761-30019-1-git-send-email-mst@redhat.com>
                   ` (2 preceding siblings ...)
  2015-12-30 13:25 ` [PATCH 17/34] arm64: define __smp_XXX Michael S. Tsirkin
@ 2015-12-30 13:25 ` Michael S. Tsirkin
  3 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2015-12-30 13:25 UTC (permalink / raw)
  To: linux-arm-kernel

This defines __smp_XXX barriers for arm,
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/arm/include/asm/barrier.h | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/arm/include/asm/barrier.h b/arch/arm/include/asm/barrier.h
index 31152e8..112cc1a 100644
--- a/arch/arm/include/asm/barrier.h
+++ b/arch/arm/include/asm/barrier.h
@@ -60,15 +60,9 @@ extern void arm_heavy_mb(void);
 #define dma_wmb()	barrier()
 #endif
 
-#ifndef CONFIG_SMP
-#define smp_mb()	barrier()
-#define smp_rmb()	barrier()
-#define smp_wmb()	barrier()
-#else
-#define smp_mb()	dmb(ish)
-#define smp_rmb()	smp_mb()
-#define smp_wmb()	dmb(ishst)
-#endif
+#define __smp_mb()	dmb(ish)
+#define __smp_rmb()	__smp_mb()
+#define __smp_wmb()	dmb(ishst)
 
 #include <asm-generic/barrier.h>
 
-- 
MST

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-30 13:25 UTC | newest]

Thread overview: 4+ 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 09/34] arm: reuse asm-generic/barrier.h Michael S. Tsirkin
2015-12-30 13:24 ` [PATCH 10/34] arm64: " Michael S. Tsirkin
2015-12-30 13:25 ` [PATCH 17/34] arm64: define __smp_XXX Michael S. Tsirkin
2015-12-30 13:25 ` [PATCH 18/34] arm: " 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).