netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [PATCH] s2io ppc64 fix for readq/writeq
@ 2006-11-06 20:33 Ramkrishna Vepa
  2006-11-06 20:46 ` Christoph Hellwig
  0 siblings, 1 reply; 17+ messages in thread
From: Ramkrishna Vepa @ 2006-11-06 20:33 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Jeff Garzik; +Cc: Linus Torvalds, netdev

The 64 bit io operation on the IA64 platform is a 64 bit transaction on
the pci bus and is optimal to leave it as such. I prefer Jeff's
suggestion  - 

guaranteeing that a "good enough for drivers" readq() and writeq() exist
on all platforms even 32-bit platforms where the operation isn't
inherently atomic.

Ram

> -----Original Message-----
> From: netdev-owner@vger.kernel.org
[mailto:netdev-owner@vger.kernel.org]
> On Behalf Of Benjamin Herrenschmidt
> Sent: Monday, November 06, 2006 1:57 AM
> To: Jeff Garzik
> Cc: Linus Torvalds; netdev@vger.kernel.org
> Subject: Re: [PATCH] s2io ppc64 fix for readq/writeq
> 
> On Mon, 2006-11-06 at 04:55 -0500, Jeff Garzik wrote:
> > Benjamin Herrenschmidt wrote:
> > > On Mon, 2006-11-06 at 01:50 -0800, Linus Torvalds wrote:
> > >> On Mon, 6 Nov 2006, Benjamin Herrenschmidt wrote:
> > >>> Anyway, what do you think of Jeff proposal to just implement
them as
> two
> > >>> 32 bits operations ? My arch guy side screams at the idea, but
if,
> > >>> indeed, drivers generally cope fine with it, I suppose that's
ok.
> > >> Last I saw, that's how normal PCI will split the IO anyway, so I
> guess it
> > >> makes sense.
> > >
> > > Hrm.. true indeed. I'll implement them that way for ppc32 then.
> >
> > Bonus points if you want to find-and-kill where individual drivers
did
> >
> > 	#ifndef readq
> > 	implement readq and writeq by hand...
> > 	#endif
> 
> Yes, well, we would have to make sure all archs have them defined
> first though, but I suppose I can have a look later this week, maybe
> tomorrow. Shouldn't be too hard :)
> 
> Ben.
> 
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 17+ messages in thread
* RE: [PATCH] s2io ppc64 fix for readq/writeq
@ 2006-11-07  2:57 Ramkrishna Vepa
  0 siblings, 0 replies; 17+ messages in thread
From: Ramkrishna Vepa @ 2006-11-07  2:57 UTC (permalink / raw)
  To: Roland Dreier, Christoph Hellwig
  Cc: Benjamin Herrenschmidt, Jeff Garzik, Linus Torvalds, netdev,
	rolandd



> -----Original Message-----
> From: Roland Dreier [mailto:rdreier@cisco.com]
> Sent: Monday, November 06, 2006 12:55 PM
> To: Christoph Hellwig
> Cc: Ramkrishna Vepa; Benjamin Herrenschmidt; Jeff Garzik; Linus
Torvalds;
> netdev@vger.kernel.org; rolandd@cisco.com
> Subject: Re: [PATCH] s2io ppc64 fix for readq/writeq
> 
>  > For consistencies sake we really want to have readq() and writeq()
> available
>  > on all platforms.  I remember that some IB cards require it to
actually
>  > be a 64bit transactions, otherwise they have to do funny
workarounds.
>  > I think the best solution is to define ARCH_HAS_ATOMIC_READQ_WRITEQ
>  > and let drivers do their workarounds based on that.
>  >
>  > I've Cc'ed Roland because he should be able to explain the IB issue
in
>  > details.
> 
> The issue I know about is drivers/infiniband/hw/mthca.  The card has
> 64-bit "doorbell registers", and the restriction is that if you write
> the doorbell write two 32-bit writes, you can't write anything else on
> the same register page in between writing the two halves.  Since
> different CPUs might be doing stuff on the same doorbell page at the
> same time, there are two things we can do:
>  - If writeq() exists then use that and assume it will generate only a
>    single bus transaction that can't let anything sneak in the
>    middle.  (That's a fairly safe assumption because the devices being
>    driven are either 64-bit PCI-X or PCIe only)
>  - If writeq() doesn't exist, use a spinlock to protect access to each
>    doorbell page.
> 
> ARCH_HAS_ATOMIC_READQ_WRITEQ would be fine for that, but of course the
> tricky thing is writing down the exact semantics that "HAS_ATOMIC" is
> actually promising.
> 
>  - R.
[Ram] If the writes broken up into 32 bit writes they are posted to the
bridge and need to be flushed with a lock around the whole access. This
is in the domain of the driver and need not be part of the platform
specific code. 

Ram


^ permalink raw reply	[flat|nested] 17+ messages in thread
* [PATCH] s2io ppc64 fix for readq/writeq
@ 2006-11-06  2:28 Benjamin Herrenschmidt
  2006-11-06  7:50 ` Jeff Garzik
  0 siblings, 1 reply; 17+ messages in thread
From: Benjamin Herrenschmidt @ 2006-11-06  2:28 UTC (permalink / raw)
  To: netdev; +Cc: Jeff Garzik

The s2io driver is redefining it's own readq/writeq based on
readl/writel when the platform doesn't provide native ones. However, it
currently does so by testing #ifndef readq. While that works for now, we
are about to change ppc64 to use inline functions rather that macros for
all those IO accessors which will break that test. This fixes it. I
don't have anything less ugly at hand unfortunately.

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

The patch changing ppc64 own definition is scheduled to go in 2.6.20 when
the merge window opens, so it would be nice if this patch could go in a
similar timeframe, provided that you agree with it of course. It can go
earlier as it won't break current ppc64.

Index: linux-cell/drivers/net/s2io.h
===================================================================
--- linux-cell.orig/drivers/net/s2io.h	2006-10-13 17:23:49.000000000 +1000
+++ linux-cell/drivers/net/s2io.h	2006-11-06 13:19:32.000000000 +1100
@@ -862,8 +862,10 @@ struct s2io_nic {
 #define RESET_ERROR 1;
 #define CMD_ERROR   2;
 
-/*  OS related system calls */
-#ifndef readq
+/* OS related system calls. Note that ppc64 has readq defined as
+ * an inline, not a macro
+ */
+#if !defined(CONFIG_PPC64) && !defined(readq)
 static inline u64 readq(void __iomem *addr)
 {
 	u64 ret = 0;
@@ -875,7 +877,7 @@ static inline u64 readq(void __iomem *ad
 }
 #endif
 
-#ifndef writeq
+#if !defined(CONFIG_PPC64) && !defined(writeq)
 static inline void writeq(u64 val, void __iomem *addr)
 {
 	writel((u32) (val), addr);




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

end of thread, other threads:[~2006-11-07  3:00 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-06 20:33 [PATCH] s2io ppc64 fix for readq/writeq Ramkrishna Vepa
2006-11-06 20:46 ` Christoph Hellwig
2006-11-06 20:54   ` Roland Dreier
  -- strict thread matches above, loose matches on Subject: below --
2006-11-07  2:57 Ramkrishna Vepa
2006-11-06  2:28 Benjamin Herrenschmidt
2006-11-06  7:50 ` Jeff Garzik
2006-11-06  8:04   ` Benjamin Herrenschmidt
2006-11-06  8:21     ` Jeff Garzik
2006-11-06  8:52       ` Benjamin Herrenschmidt
2006-11-06  9:34         ` Jeff Garzik
2006-11-07  0:17           ` Benjamin Herrenschmidt
2006-11-06  9:37   ` Linus Torvalds
2006-11-06  9:42     ` Benjamin Herrenschmidt
2006-11-06  9:50       ` Linus Torvalds
2006-11-06  9:51         ` Benjamin Herrenschmidt
2006-11-06  9:55           ` Jeff Garzik
2006-11-06  9:57             ` 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).