netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH] s2io ppc64 fix for readq/writeq
Date: Tue, 07 Nov 2006 11:17:39 +1100	[thread overview]
Message-ID: <1162858659.28571.380.camel@localhost.localdomain> (raw)
In-Reply-To: <454F0189.7050008@pobox.com>


> Generally the kernel code should write the two 32-bit chunks to the 
> memory-mapped region in order (low dword first), and let things take 
> care of themselves from there.
> 
> That's pretty much the implementation that -every- driver copies, when 
> they need readq/writeq to work on a 32-bit platform.

What do you mean by low dword first ? For example, the implementation
in the s2io driver does:

static inline u64 readq(void __iomem *addr)
{
	u64 ret = 0;
	ret = readl(addr + 4);
	ret <<= 32;
	ret |= readl(addr);

	return ret;
}

static inline void writeq(u64 val, void __iomem *addr)
{
	writel((u32) (val), addr);
	writel((u32) (val >> 32), (addr + 4));
}

As you can see, it reads the -second- dword first (high order dword in
little endian), but writes the first dword first (low order dword in
little endian).

If there is any logic here, it's card specific.

Or is this really what PCI does when doing 64 bits accesses on a 32 bits
PCI bus ? I would have expected the later (what write does) but this
driver does it reverse on reads.

I'm tempted to go to the simple

#define readq readq for now until we clear that up.
 
Ben.



  reply	other threads:[~2006-11-07  0:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-06  2:28 [PATCH] s2io ppc64 fix for readq/writeq 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 [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
2006-11-06 20:33 Ramkrishna Vepa
2006-11-06 20:46 ` Christoph Hellwig
2006-11-06 20:54   ` Roland Dreier
2006-11-07  2:57 Ramkrishna Vepa

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=1162858659.28571.380.camel@localhost.localdomain \
    --to=benh@kernel.crashing.org \
    --cc=jgarzik@pobox.com \
    --cc=netdev@vger.kernel.org \
    --cc=torvalds@osdl.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).