From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [POWERPC] Add "memory" clobber to MMIO accessors
Date: Wed, 28 May 2008 10:18:17 +1000 [thread overview]
Message-ID: <20080528002031.5D365DDF96@ozlabs.org> (raw)
gcc might re-order MMIO accessors vs. surrounding consistent
memory accesses, which is a "bad thing".
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
include/asm-powerpc/io.h | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
--- linux-work.orig/include/asm-powerpc/io.h 2008-05-28 09:39:11.000000000 +1000
+++ linux-work/include/asm-powerpc/io.h 2008-05-28 09:40:28.000000000 +1000
@@ -100,7 +100,7 @@ static inline type name(const volatile t
{ \
type ret; \
__asm__ __volatile__("sync;" insn ";twi 0,%0,0;isync" \
- : "=r" (ret) : "r" (addr), "m" (*addr)); \
+ : "=r" (ret) : "r" (addr), "m" (*addr) : "memory"); \
return ret; \
}
@@ -108,8 +108,8 @@ static inline type name(const volatile t
static inline void name(volatile type __iomem *addr, type val) \
{ \
__asm__ __volatile__("sync;" insn \
- : "=m" (*addr) : "r" (val), "r" (addr)); \
- IO_SET_SYNC_FLAG(); \
+ : "=m" (*addr) : "r" (val), "r" (addr) : "memory"); \
+ IO_SET_SYNC_FLAG(); \
}
@@ -333,7 +333,8 @@ static inline unsigned int name(unsigned
" .long 3b,5b\n" \
".previous" \
: "=&r" (x) \
- : "r" (port + _IO_BASE)); \
+ : "r" (port + _IO_BASE) \
+ : "memory");
return x; \
}
@@ -350,7 +351,8 @@ static inline void name(unsigned int val
" .long 0b,2b\n" \
" .long 1b,2b\n" \
".previous" \
- : : "r" (val), "r" (port + _IO_BASE)); \
+ : : "r" (val), "r" (port + _IO_BASE) \
+ : "memory");
}
__do_in_asm(_rec_inb, "lbzx")
reply other threads:[~2008-05-28 0:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20080528002031.5D365DDF96@ozlabs.org \
--to=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).