public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ppc64: Fix __raw_* IO accessors
@ 2004-09-21  9:23 Benjamin Herrenschmidt
  2004-09-21 10:05 ` Alan Cox
  0 siblings, 1 reply; 21+ messages in thread
From: Benjamin Herrenschmidt @ 2004-09-21  9:23 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, Linux Kernel list, Petr Vandrovec

Hi !

Linus, I don't know if you did that on purpose, but you removed the
"volatile" statement from the definition of the __raw_* IO accessors
on ppc64, which cause some real bad optisations to happen in some
fbdev's like matroxfb to happen (just imagine that matroxfb loops
reading an IO register waiting for a bit to change).

(Note: matroxfb has other potential problems due to the fact that
__raw_* do not do any barrier (Petr, we probably need to fix that
some way, unfortunatley, I don't think we have a good abstraction
for providing the missing barrier to a driver using __raw... can't
you just switch back to little endian registers and use normal
readX/writeX ?)

Anyway, here's the fix for asm-ppc64/io.h

Signed-off-by: Benjamin Herrenschmidt <benh@kenrel.crashing.org>

===== include/asm/io.h 1.21 vs edited =====
--- 1.21/include/asm-ppc64/io.h	2004-09-14 04:31:52 +10:00
+++ edited/include/asm/io.h	2004-09-21 19:14:10 +10:00
@@ -71,35 +71,35 @@
 
 static inline unsigned char __raw_readb(const volatile void __iomem *addr)
 {
-	return *(unsigned char __force *)addr;
+	return *(volatile unsigned char __force *)addr;
 }
 static inline unsigned short __raw_readw(const volatile void __iomem *addr)
 {
-	return *(unsigned short __force *)addr;
+	return *(volatile unsigned short __force *)addr;
 }
 static inline unsigned int __raw_readl(const volatile void __iomem *addr)
 {
-	return *(unsigned int __force *)addr;
+	return *(volatile unsigned int __force *)addr;
 }
 static inline unsigned long __raw_readq(const volatile void __iomem *addr)
 {
-	return *(unsigned long __force *)addr;
+	return *(volatile unsigned long __force *)addr;
 }
 static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)
 {
-	*(unsigned char __force *)addr = v;
+	*(volatile unsigned char __force *)addr = v;
 }
 static inline void __raw_writew(unsigned short v, volatile void __iomem *addr)
 {
-	*(unsigned short __force *)addr = v;
+	*(volatile unsigned short __force *)addr = v;
 }
 static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
 {
-	*(unsigned int __force *)addr = v;
+	*(volatile unsigned int __force *)addr = v;
 }
 static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
 {
-	*(unsigned long __force *)addr = v;
+	*(volatile unsigned long __force *)addr = v;
 }
 #define readb(addr)		eeh_readb(addr)
 #define readw(addr)		eeh_readw(addr)




^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2004-09-25  1:43 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-21  9:23 [PATCH] ppc64: Fix __raw_* IO accessors Benjamin Herrenschmidt
2004-09-21 10:05 ` Alan Cox
2004-09-21 11:41   ` Benjamin Herrenschmidt
2004-09-21 19:30     ` Roland Dreier
2004-09-21 19:41       ` Linus Torvalds
2004-09-21 20:55         ` Geert Uytterhoeven
2004-09-21 22:05         ` Roland Dreier
2004-09-21 22:16           ` Linus Torvalds
2004-09-22  1:34             ` Benjamin Herrenschmidt
2004-09-22 18:58               ` Petr Vandrovec
2004-09-23  0:49                 ` Benjamin Herrenschmidt
2004-09-23 15:25                   ` Petr Vandrovec
2004-09-23 20:26                     ` [PATCH] matroxfb big-endian update (was Re: [PATCH] ppc64: Fix __raw_* IO accessors) Petr Vandrovec
2004-09-24  6:25                       ` Benjamin Herrenschmidt
2004-09-24  9:53                         ` Petr Vandrovec
2004-09-24 16:16                           ` Kostas Georgiou
2004-09-25  1:40                           ` Benjamin Herrenschmidt
2004-09-23 22:23                     ` [PATCH] ppc64: Fix __raw_* IO accessors Benjamin Herrenschmidt
2004-09-22  2:15             ` Paul Mackerras
2004-09-22  7:36               ` Roland Dreier
2004-09-22  1:31           ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox