netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Grundler <iod00d@hp.com>
To: Leonid Grossman <leonid.grossman@s2io.com>
Cc: "'Andi Kleen'" <ak@suse.de>,
	netdev@oss.sgi.com,
	"'Ragu Vatsavayi'" <raghava.vatsavayi@s2io.com>,
	"'Grant Grundler'" <iod00d@hp.com>
Subject: Re: FW: Submission for S2io 10GbE driver
Date: Wed, 4 Feb 2004 16:49:52 -0800	[thread overview]
Message-ID: <20040205004952.GA27510@cup.hp.com> (raw)
In-Reply-To: <004201c3eb5f$ac4e9f00$740efea9@S2IOtech.com>

On Wed, Feb 04, 2004 at 12:44:21PM -0800, Leonid Grossman wrote:
> 1) We did't find quad word memory operations(writeq and readq) on PCI
> bus for PPC64 architecture.

I would consider that a bug in the PPC64 port. You can submit
a patch to add a readq/writeq implementation using 32-bit ops
if the PCI Host controller doesn't support 64-bit transactions.
This doesn't always work since two 32-bit writes to a 64-bit register
is not the same as one 64-bit write. Your HW needs to be aware
of that if you want to support that platform.


> 2) We did't had a chance to test the driver on other big endian systems
> apart from PPC64. In PPC64 architecture though,
> I write/read a value to/from ioremaped address it swaps the value and
> behaves like a little endian m/c:  
> 
> For ex: if I  do writel(0x12345678, addr) then in it writes 
> addr: 78, (addr+1):56, (addr+2):34, (addr+3):12
...
> On a little endian m/c like IA32 also writel writes same values in a
> similar manner as shown above. 
> So the question is -
> Do all big endian machines with linux OS swap the values and write in
> little endian format?? 

Yes - I believe so.
There are ways to avoid the byte swap but I'm really not keen
on advocating this path. byte swapping is so much cheaper than
the PIO Reads, it just doesn't make sense to obfuscate the
code most of the time.

> 3)In PPC64 architecture dma_addr_t is u32, unlike remaining 64 bit
> architectures where it is defined as u64. Because of this we have
> to deal separately for PP64. 

You shouldn't be using dma_addr_t for layout of data structures
shared with the card. Several architectures *only* use 32-bit
DMA addresses (IOMMU for all DMA). It makes sense on those
architectures to define dma_addr_t as u32.
Try "fgrep dma_addr_t include/asm*/* | fgrep typedef" on linux-2.6 tree.


> So any suggestions will be useful, .i.e. generally how PPC64 developers
> deal with this?

Only use dma_addr_t to map data and not to define data structures
consumed by the card.

Some history from my perspective:
Fri, 9 Feb 2001, I started a discussion on linux-mm@kvack.org mailing
list on exactly this issue for linux-2.4. At the time Dave Miller
"owned" DMA interface and insisted dma_addr_t be u32.
He offered dma64_addr_t would be introduced in linux-2.5.
So far so good.

The only problem was IA64 was already defining dma_addr_t as u64
and mips was using "unsigned long".

Issue came up again on linux-kernel/linux-ia64 Feb 6, 2002.
(Subject: Proper fix for sym53c8xx_2 driver and dma64_addr_t)
It was pretty clear pci_dac_XXX() was the "preferred" interface
to use. But it made it impossible for a driver to support multiple
chips that supported both.

Somewhere along the line, I think with more thrashing about on
pci_set_dma_mask(), it was decided it was ok for dma_addr_t to
be u64 on architectures that supported it.

Last step into this mess was "64 Bits DMA Addresses for Alloc Consistent
Interfaces" thread started by SGI. Altix box needed it in order to
support PCI-X devices in PCI-X mode. (15 May 2003)
This resulted in "pci_set_consistent_dma_mask()" interface
in order to change the dma_mask for pci_alloc_consistent() calls.
AlexW just submitted support for this a week or two ago to 2.6 kernel.

> Say if we have some structure corresponding to memory region of our 
> hardware device which should be of 16 bytes.
...
> Then above definition will not work for PPC64, we need to modify it like
> this:
> struct hw {
> dma_addr_t  phys;
> char            *virt;
> #ifdef  ARCH32 
> u64 dummy;
> #endif
> #ifdef ARCH_PPC64
> u32 dummy;
> #endif
> }

Use "u64 phys" and it will always be correct.

And "char * virt" has the same problem. "char *" will vary
in size depending arch (ILP32 vs LP64 data model) as well.
You did claim this code worked on i386, ia64 and PPC64, right?

hth,
grant

  reply	other threads:[~2004-02-05  0:49 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-23 21:22 FW: Submission for S2io 10GbE driver Leonid Grossman
2004-01-23 21:54 ` Stephen Hemminger
2004-01-23 21:58   ` Leonid Grossman
2004-01-23 22:22 ` FW: " Andi Kleen
2004-01-24  0:21   ` Stephen Hemminger
2004-01-27  5:32     ` Leonid Grossman
2004-01-27  6:08       ` Jeff Garzik
2004-01-27  6:19         ` Leonid Grossman
2004-02-04 20:44   ` FW: " Leonid Grossman
2004-02-05  0:49     ` Grant Grundler [this message]
2004-02-05  1:14       ` Leonid Grossman
2004-02-16 21:16       ` Leonid Grossman
2004-02-16 22:12         ` Jeff Garzik
2004-02-16 23:53           ` Leonid Grossman
2004-02-17  0:11         ` Christoph Hellwig
2004-02-17  0:16           ` Stephen Hemminger
2004-02-28 15:08           ` Submission #3 " Leonid Grossman
2004-02-28 20:21             ` Jeff Garzik
2004-03-12 21:55               ` ravinandan arakali
2004-03-13  2:30                 ` Jeff Garzik
2004-03-20  4:35               ` Submission #4 " Leonid Grossman
2004-03-20  9:56                 ` Jeff Garzik
2004-03-20 10:00                   ` Jeff Garzik
2004-03-22 19:36                     ` ravinandan arakali
2004-03-22 19:43                       ` Jeff Garzik
2004-03-20 10:48                   ` Christoph Hellwig
2004-02-05  1:32     ` FW: Submission " Andi Kleen
2004-02-05  1:51       ` Anton Blanchard
2004-02-05  2:46         ` Leonid Grossman
2004-02-05  3:25           ` Anton Blanchard
2004-02-05  9:27             ` Jeff Garzik
2004-02-05  9:29           ` Jeff Garzik
2004-02-05 22:09             ` Leonid Grossman
2004-02-05 22:34               ` Grant Grundler
2004-02-05 23:23                 ` Jes Sorensen
2004-01-24  0:38 ` Francois Romieu
2004-01-24  3:14 ` jamal
2004-01-24  5:10   ` Leonid Grossman
2004-01-24 14:58     ` Andi Kleen
2004-01-24 17:54       ` jamal
2004-01-24 19:52         ` Leonid Grossman
2004-01-25 19:07           ` jamal
2004-01-25 17:56       ` Leonid Grossman
2004-01-24 18:00     ` jamal
2004-01-24 20:04       ` Leonid Grossman
2004-01-25 19:14         ` jamal

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=20040205004952.GA27510@cup.hp.com \
    --to=iod00d@hp.com \
    --cc=ak@suse.de \
    --cc=leonid.grossman@s2io.com \
    --cc=netdev@oss.sgi.com \
    --cc=raghava.vatsavayi@s2io.com \
    /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).