All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/5] io: define several IO & PIO barrier types for the asm-generic version
@ 2018-04-04 23:58 ` Sinan Kaya
  0 siblings, 0 replies; 17+ messages in thread
From: Sinan Kaya @ 2018-04-04 23:58 UTC (permalink / raw)
  To: arnd, timur, sulrich
  Cc: linux-arm-msm, linux-arm-kernel, Sinan Kaya, linux-arch, linux-kernel

Getting ready to harden readX()/writeX() and inX()/outX() semantics for the
generic implementation.

Defining two set of macros as __io_br() and __io_ar() to indicate actions
to be taken before and after MMIO read.

Defining two set of macros as __io_bw() and __io_aw() to indicate actions
to be taken before and after MMIO write.

Defining two set of macros as __io_pbw() and __io_paw() to indicate actions
to be taken before and after Port IO write.

Defining two set of macros as __io_pbr() and __io_par() to indicate actions
to be taken before and after Port IO read.

If rmb() is available for the architecture, prefer rmb() as the default
implementation of __io_ar()/__io_par().

If wmb() is available for the architecture, prefer wmb() as the default
implementation of __io_bw()/__io_pbw().

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 include/asm-generic/io.h | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index b4531e3..a3d349e 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -25,6 +25,49 @@
 #define mmiowb() do {} while (0)
 #endif
 
+#ifndef __io_br
+#define __io_br()      barrier()
+#endif
+
+#ifndef __io_ar
+#ifdef rmb
+/* prefer rmb() as the default implementation of __io_ar() if supported */
+#define __io_ar()      rmb()
+#else
+#define __io_ar()      barrier()
+#endif
+#endif
+
+#ifndef __io_bw
+#ifdef wmb
+/* prefer wmb() as the default implementation of __io_bw() if supported */
+#define __io_bw()      wmb()
+#else
+#define __io_bw()      barrier()
+#endif
+#endif
+
+#ifndef __io_aw
+#define __io_aw()      barrier()
+#endif
+
+#ifndef __io_pbw
+#define __io_pbw()     __io_bw()
+#endif
+
+#ifndef __io_paw
+#define __io_paw()     __io_aw()
+#endif
+
+#ifndef __io_pbr
+#define __io_pbr()     __io_br()
+#endif
+
+#ifndef __io_par
+#define __io_par()     __io_ar()
+#endif
+
+
 /*
  * __raw_{read,write}{b,w,l,q}() access memory in native endianness.
  *
-- 
2.7.4

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

end of thread, other threads:[~2018-04-05 11:58 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04 23:58 [PATCH v3 1/5] io: define several IO & PIO barrier types for the asm-generic version Sinan Kaya
2018-04-04 23:58 ` Sinan Kaya
2018-04-04 23:58 ` [PATCH v3 2/5] io: define stronger ordering for the default readX() implementation Sinan Kaya
2018-04-04 23:58   ` Sinan Kaya
2018-04-04 23:58   ` Sinan Kaya
2018-04-04 23:58 ` [PATCH v3 3/5] io: define stronger ordering for the default writeX() implementation Sinan Kaya
2018-04-04 23:58   ` Sinan Kaya
2018-04-04 23:58 ` [PATCH v3 4/5] io: change outX() to have their own IO barrier overrides Sinan Kaya
2018-04-04 23:58   ` Sinan Kaya
2018-04-04 23:58 ` [PATCH v3 5/5] io: change inX() " Sinan Kaya
2018-04-04 23:58   ` Sinan Kaya
2018-04-05  7:00 ` [PATCH v3 1/5] io: define several IO & PIO barrier types for the asm-generic version Arnd Bergmann
2018-04-05  7:00   ` Arnd Bergmann
2018-04-05 11:48   ` okaya
2018-04-05 11:48     ` okaya at codeaurora.org
2018-04-05 11:58     ` Arnd Bergmann
2018-04-05 11:58       ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.