public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: linas@austin•ibm.com (Linas Vepstas)
To: Segher Boessenkool <segher@kernel•crashing.org>
Cc: Stephen Rothwell <sfr@canb•auug.org.au>,
	paulus@samba•org, ppc-dev <linuxppc-dev@ozlabs•org>
Subject: Re: [PATCH]: powerpc: clarify use of twi/isync in io macros
Date: Tue, 19 Sep 2006 15:10:53 -0500	[thread overview]
Message-ID: <20060919201053.GP29167@austin.ibm.com> (raw)
In-Reply-To: <72674737-8325-48FA-B04F-C4ADCA2E2BF9@kernel.crashing.org>

On Tue, Sep 19, 2006 at 09:57:11PM +0200, Segher Boessenkool wrote:
> ..."before the isync has completed, and it won't complete until
> the branch is resolved;"...

New improved patch attched.

> You shouldn't post my test and put your signed-off on it, esp.
> if I forgot to type half a sentence :-)  Here, have one though:

My moral fiber did twinge before I hit the send button,
but I confused it with a muscle spasm.

> Signed-off-by: Segher Boessenkool <segher@kernel•crashing.org>

--------

Clarify why twi appears in the i/o macros.

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

----
 include/asm-powerpc/io.h |   12 ++++++++++++
 1 file changed, 12 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 15:04:30.000000000 -0500
@@ -278,6 +278,18 @@ 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 before the isync has completed, and
+ * the isync won't complete until the branch is resolved. The
+ * 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)
 {

  reply	other threads:[~2006-09-19 20:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-19 19:30 [PATCH]: powerpc: clarify use of twi/isync in io macros Linas Vepstas
2006-09-19 19:57 ` Segher Boessenkool
2006-09-19 20:10   ` Linas Vepstas [this message]
2006-09-19 20:30     ` Segher Boessenkool
2006-09-21 12:41 ` Paul Mackerras
2006-09-21 15:06   ` Segher Boessenkool

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060919201053.GP29167@austin.ibm.com \
    --to=linas@austin$(echo .)ibm.com \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=paulus@samba$(echo .)org \
    --cc=segher@kernel$(echo .)crashing.org \
    --cc=sfr@canb$(echo .)auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox