[PATCH]: powerpc: clarify use of twi/isync in io macros

Linas Vepstas linas at austin.ibm.com
Wed Sep 20 05:30:20 EST 2006


Paul, please apply.

Clarify why twi appears in the i/o macros.

Signed-off-by: Linas Vepstas <linas at austin.ibm.com>
Cc: Segher Boessenkool <segher at kernel.crashing.org>

----
 include/asm-powerpc/io.h |   11 +++++++++++
 1 file changed, 11 insertions(+)

Index: linux-2.6.18-rc7-git1/include/asm-powerpc/io.h
===================================================================
--- linux-2.6.18-rc7-git1.orig/include/asm-powerpc/io.h	2006-09-14 13:38:48.000000000 -0500
+++ linux-2.6.18-rc7-git1/include/asm-powerpc/io.h	2006-09-19 14:26:26.000000000 -0500
@@ -278,6 +278,17 @@ static inline void iosync(void)
  * These routines do not perform EEH-related I/O address translation,
  * and should not be used directly by device drivers.  Use inb/readb
  * instead.
+ *
+ * Read operations have additional twi & isync to make sure the read
+ * is actually performed (i.e. the data has come back) before we start
+ * executing any following instructions.
+ *
+ * A data-dependent branch followed by an isync ensures that no
+ * instructions after the isync in program order will be
+ * (speculatively) executed, so the load that the twi depends
+ * on has to complete before anything else is executed; in
+ * particular, it's a barrier to keep MMIO reads ordered before
+ * main-storage accesses.
  */
 static inline int in_8(const volatile unsigned char __iomem *addr)
 {



More information about the Linuxppc-dev mailing list