powerpc: fix implementation of out_8 to match the other out_XX functions
PATCH v2 1/1 powerpc: fix implementation of out_8 to match the other out_XX functions
For some reason, the implementation of out_8() does not match the other output accessors, nor does it match equivalent Linux accessor. This can cause a problem in a situation like this:
__raw_readb(p1); out_8(p2, x);
In this case, there is no barrier between the read and the write. If the out_8() is changed to out_be16(), then there is a barrier.
--- arch/powerpc/include/asm/io.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
arch/powerpc/include/asm/io.h +4 -1
@@ -175,7 +175,10 @@ extern inline int in_8(const volatile unsigned char __iomem *addr)extern inline void out_8 (volatile unsigned char __iomem *addr,int val) { - __asm__ __volatile__("stb%U0%X0 %1,%0; eieio" :"=m" (*addr) :"r" (val)); + __asm__ __volatile__("sync;\n" +"stb%U0%X0 %1,%0;\n" + :"=m" (*addr) + :"r" (val)); }extern inline int in_le16 (const volatile unsigned short __iomem *addr)
Signature · 1 line
1.7.3.4
Wolfgang Denk
AppliedPATCH v2 1/1 powerpc: fix implementation of out_8 to match the other out_XX functions
Dear Timur Tabi,
Quoted 7 lines · In message <[email protected]> you wrote:
For some reason, the implementation of
out_8()does not match the other output accessors, nor does it match equivalent Linux accessor. This can cause a problem in a situation like this:__raw_readb(p1); out_8(p2, x);
Quoted 7 lines
In this case, there is no barrier between the read and the write. If the
out_8()is changed toout_be16(), then there is a barrier.Signed-off-by Timur Tabi <[email protected]>--- arch/powerpc/include/asm/io.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You don't need a weatherman to know which way the wind blows.
- Bob Dylan