linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Fix __raw* accessors
@ 2006-11-21  1:35 Benjamin Herrenschmidt
  2006-11-21 10:29 ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2006-11-21  1:35 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev list, Arnd Bergmann

The new IO accessor code allows to stick a token in the top bit of MMIO
addresses which gets masked out during actual accesses. However, the
__raw_* accessors forgot to mask it out. This fixes it.

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

Index: linux-cell/include/asm-powerpc/io.h
===================================================================
--- linux-cell.orig/include/asm-powerpc/io.h	2006-11-21 11:01:12.000000000 +1100
+++ linux-cell/include/asm-powerpc/io.h	2006-11-21 11:56:14.000000000 +1100
@@ -185,53 +185,6 @@ extern void _memcpy_toio(volatile void _
  * of the accessors.
  */
 
-
-/*
- * Non ordered and non-swapping "raw" accessors
- */
-
-static inline unsigned char __raw_readb(const volatile void __iomem *addr)
-{
-	return *(volatile unsigned char __force *)addr;
-}
-static inline unsigned short __raw_readw(const volatile void __iomem *addr)
-{
-	return *(volatile unsigned short __force *)addr;
-}
-static inline unsigned int __raw_readl(const volatile void __iomem *addr)
-{
-	return *(volatile unsigned int __force *)addr;
-}
-static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)
-{
-	*(volatile unsigned char __force *)addr = v;
-}
-static inline void __raw_writew(unsigned short v, volatile void __iomem *addr)
-{
-	*(volatile unsigned short __force *)addr = v;
-}
-static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
-{
-	*(volatile unsigned int __force *)addr = v;
-}
-
-#ifdef __powerpc64__
-static inline unsigned long __raw_readq(const volatile void __iomem *addr)
-{
-	return *(volatile unsigned long __force *)addr;
-}
-static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
-{
-	*(volatile unsigned long __force *)addr = v;
-}
-#endif /* __powerpc64__ */
-
-/*
- *
- * PCI PIO and MMIO accessors.
- *
- */
-
 /*
  * Include the EEH definitions when EEH is enabled only so they don't get
  * in the way when building for 32 bits
@@ -291,7 +244,52 @@ do {									\
 #define PCI_FIX_ADDR(addr) (addr)
 #endif
 
+
+/*
+ * Non ordered and non-swapping "raw" accessors
+ */
+
+static inline unsigned char __raw_readb(const volatile void __iomem *addr)
+{
+	return *(volatile unsigned char __force *)PCI_FIX_ADDR(addr);
+}
+static inline unsigned short __raw_readw(const volatile void __iomem *addr)
+{
+	return *(volatile unsigned short __force *)PCI_FIX_ADDR(addr);
+}
+static inline unsigned int __raw_readl(const volatile void __iomem *addr)
+{
+	return *(volatile unsigned int __force *)PCI_FIX_ADDR(addr);
+}
+static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)
+{
+	*(volatile unsigned char __force *)PCI_FIX_ADDR(addr) = v;
+}
+static inline void __raw_writew(unsigned short v, volatile void __iomem *addr)
+{
+	*(volatile unsigned short __force *)PCI_FIX_ADDR(addr) = v;
+}
+static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
+{
+	*(volatile unsigned int __force *)PCI_FIX_ADDR(addr) = v;
+}
+
+#ifdef __powerpc64__
+static inline unsigned long __raw_readq(const volatile void __iomem *addr)
+{
+	return *(volatile unsigned long __force *)PCI_FIX_ADDR(addr);
+}
+static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
+{
+	*(volatile unsigned long __force *)PCI_FIX_ADDR(addr) = v;
+}
+#endif /* __powerpc64__ */
+
 /*
+ *
+ * PCI PIO and MMIO accessors.
+ *
+ *
  * On 32 bits, PIO operations have a recovery mechanism in case they trigger
  * machine checks (which they occasionally do when probing non existing
  * IO ports on some platforms, like PowerMac and 8xx).

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

* Re: [PATCH] powerpc: Fix __raw* accessors
  2006-11-21  1:35 [PATCH] powerpc: Fix __raw* accessors Benjamin Herrenschmidt
@ 2006-11-21 10:29 ` Arnd Bergmann
  2006-11-22 13:46   ` Jens Osterkamp
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2006-11-21 10:29 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Jens Osterkamp, Benjamin Herrenschmidt, Paul Mackerras

On Tuesday 21 November 2006 02:35, Benjamin Herrenschmidt wrote:
> The new IO accessor code allows to stick a token in the top bit of MMIO
> addresses which gets masked out during actual accesses. However, the
> __raw_* accessors forgot to mask it out. This fixes it.

Jens, you debugged the problem originally. Does this patch fix it entirely,
or is there something else missing?

	Arnd <><

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

* Re: [PATCH] powerpc: Fix __raw* accessors
  2006-11-21 10:29 ` Arnd Bergmann
@ 2006-11-22 13:46   ` Jens Osterkamp
  2006-11-22 21:18     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Osterkamp @ 2006-11-22 13:46 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Jens Osterkamp, Benjamin Herrenschmidt, Paul Mackerras,
	Arnd Bergmann

On Tuesday 21 November 2006 11:29, Arnd Bergmann wrote:
> On Tuesday 21 November 2006 02:35, Benjamin Herrenschmidt wrote:
> > The new IO accessor code allows to stick a token in the top bit of MMIO
> > addresses which gets masked out during actual accesses. However, the
> > __raw_* accessors forgot to mask it out. This fixes it.
>
> Jens, you debugged the problem originally. Does this patch fix it entirely,
> or is there something else missing?

The driver basically works, but I am seeing strange im_free messages,
probably because this code is not aware of the tokens in the ioremapped 
addresses.

<6>ib_mthca: Mellanox InfiniBand HCA driver v0.08 (February 14, 2006)
<6>ib_mthca: Initializing 0002:00:00.0
<3>Trying to im_free nonexistent area (d002080080930000)
<6>ib_mthca: Initializing 0004:00:00.0
<3>Trying to im_free nonexistent area (d003080082a37000)
<4>ib_mthca 0004:00:00.0: HCA FW version 4.6.0 is old (4.7.600 is current).
<4>ib_mthca 0004:00:00.0: If you have problems, try updating your HCA FW.

Jens

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

* Re: [PATCH] powerpc: Fix __raw* accessors
  2006-11-22 13:46   ` Jens Osterkamp
@ 2006-11-22 21:18     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2006-11-22 21:18 UTC (permalink / raw)
  To: Jens Osterkamp
  Cc: linuxppc-dev, Paul Mackerras, Arnd Bergmann, Jens Osterkamp

On Wed, 2006-11-22 at 14:46 +0100, Jens Osterkamp wrote:
> On Tuesday 21 November 2006 11:29, Arnd Bergmann wrote:
> > On Tuesday 21 November 2006 02:35, Benjamin Herrenschmidt wrote:
> > > The new IO accessor code allows to stick a token in the top bit of MMIO
> > > addresses which gets masked out during actual accesses. However, the
> > > __raw_* accessors forgot to mask it out. This fixes it.
> >
> > Jens, you debugged the problem originally. Does this patch fix it entirely,
> > or is there something else missing?
> 
> The driver basically works, but I am seeing strange im_free messages,
> probably because this code is not aware of the tokens in the ioremapped 
> addresses.

Or becasue ioumap isn't properly masking out the token... I'll check
that.

Ben.

> <6>ib_mthca: Mellanox InfiniBand HCA driver v0.08 (February 14, 2006)
> <6>ib_mthca: Initializing 0002:00:00.0
> <3>Trying to im_free nonexistent area (d002080080930000)
> <6>ib_mthca: Initializing 0004:00:00.0
> <3>Trying to im_free nonexistent area (d003080082a37000)
> <4>ib_mthca 0004:00:00.0: HCA FW version 4.6.0 is old (4.7.600 is current).
> <4>ib_mthca 0004:00:00.0: If you have problems, try updating your HCA FW.
> 
> Jens

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

end of thread, other threads:[~2006-11-22 21:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-21  1:35 [PATCH] powerpc: Fix __raw* accessors Benjamin Herrenschmidt
2006-11-21 10:29 ` Arnd Bergmann
2006-11-22 13:46   ` Jens Osterkamp
2006-11-22 21:18     ` Benjamin Herrenschmidt

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).