[Skiboot] [PATCH 3/6] io: Add io_complete() helper

Benjamin Herrenschmidt benh at kernel.crashing.org
Thu Dec 7 04:39:25 AEDT 2017


This uses the standard form twi/isync pair to ensure a load
is consumed by the core before continuing.

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 include/io.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/io.h b/include/io.h
index 45a385ed..93a65e70 100644
--- a/include/io.h
+++ b/include/io.h
@@ -170,6 +170,12 @@ static inline void out_le64(volatile uint64_t *addr, uint64_t val)
 #define in_le8	in_8
 #define out_le8	out_8
 
+/* Ensure completion of a load */
+static inline void in_complete(uint64_t data)
+{
+	asm volatile("twi 0,%0,0;isync" : : "r" (data) : "memory");
+}
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __IO_H */
-- 
2.14.3



More information about the Skiboot mailing list