From: Grant Grundler <grundler@puffin.external.hp.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: parisc-linux@lists.parisc-linux.org
Subject: Re: [parisc-linux] memcpy_fromio() seems partially broken [with patch]
Date: Sun, 10 Jun 2001 18:03:26 -0600 [thread overview]
Message-ID: <200106110003.SAA11489@puffin.external.hp.com> (raw)
In-Reply-To: Your message of "Sat, 09 Jun 2001 02:39:17 BST." <20010609023917.C28264@parcelfarce.linux.theplanet.co.uk>
Matthew Wilcox wrote:
> This is very bizarre. Following the codepaths, the current code does:
...
> bytecopy:
...
> and i don't see how that can possibly do byteswapping. unless byteswapping
> is necessary and this code is failing to do that?
That's what it sounds like.
> Your code is doing:
>
> if (((unsigned long)dest & 3) != (src & 3))
> goto wordcopy;
>
> wordcopy:
> if (src & 3)
> goto bytecopy;
> wordcopy_loop:
...
> which is doing a byteswap on the value returned from readl!
Exactly.
> This seems
> pretty grotesque to me.
It looks grotesque but the compiler should be able to
do pretty well with that.
> I want to hear from someone (eg grant) who can
> say what's actually going on here..
The problem seems that the data needs to be swapped and I don't know why.
Perhaps the card is swapping the data?
acenic (and tulip?) has such a mode.
PARISC pci host bus adapters has a "byte is byte" approach to data.
I've heard the term "address invariance" used but not sure if
that's exactly the same thing. The idea here is data DMA'd into memory
is a byte stream and the CPU reading the data from memory byte at a time
from low address to higher address would see the same data.
Normally we expect the consumer of data (eg device driver) from IO space
to perform the swap and not the accessor functions (eg readl).
I need to do more homework to be certain about the following:
I *think* CPU reading IO space directly needs to be swapped to
provide the same illusion that DMA provides. The problem (I think)
is the data is *little* endian across the PCI bus and presented as
such to the CPU which then stores it *big* endian in memory.
Dino ERS has a nice chapter on this mess. Elroy follows the same rules.
I'll have to read that again.
grant
Grant Grundler
parisc-linux {PCI|IOMMU|SMP} hacker
+1.408.447.7253
prev parent reply other threads:[~2001-06-11 0:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-08 21:37 [parisc-linux] memcpy_fromio() seems partially broken [with patch] Helge Deller
2001-06-09 1:39 ` Matthew Wilcox
2001-06-11 0:03 ` Grant Grundler [this message]
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=200106110003.SAA11489@puffin.external.hp.com \
--to=grundler@puffin.external.hp.com \
--cc=matthew@wil.cx \
--cc=parisc-linux@lists.parisc-linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.