From: Marc Leeman <marc.leeman@barco.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev list <linuxppc-dev@lists.linuxppc.org>
Subject: Re: PCI Memory mapping
Date: Wed, 24 Mar 2004 13:26:52 +0100 [thread overview]
Message-ID: <20040324122652.GA22171@smtp.barco.com> (raw)
In-Reply-To: <1080086640.23208.164.camel@gaston>
I just added a [1]
flush_cache_all();
after copying the buffer from user space, no change.
The same for
__asm__ __volatile__("sync\n");
However, more and more things seem to point to either the DSP or 'the
hardware':
For testing purposes, I allocate a 4k buffer and pass the address of the
buffer +0x400 to the DSP (the corrupted data always occur in the firsts
28 words: from word 5 to word 28).
In userspace, I fill the 0x400 bytes with 0xFF and only use the last
0xC00 bytes with 'userful' data. The 4k buffer is passed to kernel space
where it is mapped on the PCI.
PPC user
+-------+
| 0x400 |
+-------+
| |
| 0xC00 |
| |
+-------+
|| copy_from_user
\/
PPC kern DSP
+-------+
| 0x400 |
+-------+ +-------+
| | PCI | |
| 0xC00 | ===> | 0xC00 |
| | | |
+-------+ +-------+
The DSP only reads the last 3k bytes but still, it gets the corrupted
data from word 5 to word 32 when no (excessive) delays are used.
Next to this, consistent_alloc() already uses _PAGE_NO_CACHE to avoid
caching of the buffer (called by pci_consistent_alloc()) in cachemap.c
(yes, the 8245 kernel configuration does not enable
CONFIG_NOT_COHERENT_CACHE normally [2], but I added it but the behaviour
is still identical).
Filling the user buffer with 0xCA after copy_from_user and re-copying it
into the kernel buffer (without interrupting the DSP this time) still
has no effect: the 'corrupted' data is still old data from the last
PCI transferred data on the DSP side (after a subsequent copy_from_user
with useful data and DSP interrupt).
However the first PCI transferred buffer is ALWAYS correct.
On the other hand, this DSP-type did read via PCI master read
operations and a PCI plugin card memory from w32 on an x86 arch (instead
of our internal PCI bus) a couple of yrs ago I'm told.
[1] hmmmmm, this is helpful code for ppc :)
/*
* No cache flushing is required when address mappings are
* changed, because the caches on PowerPCs are physically
* addressed. -- paulus
* Also, when SMP we use the coherency (M) bit of the
* BATs and PTEs. -- Cort
*/
#define flush_cache_all() do { } while (0)
[2]
6xx/7xx/74xx/8260 CONFIG_6xx
instead of
CONFIG_8xx
as Processor Type.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
next prev parent reply other threads:[~2004-03-24 12:26 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-16 11:40 PCI Memory mapping Marc Leeman
2004-03-16 16:39 ` Jeff Angielski
2004-03-22 7:48 ` Marc Leeman
2004-03-22 11:02 ` Marc Leeman
2004-03-23 11:17 ` Marc Leeman
2004-03-23 16:01 ` Marc Leeman
2004-03-24 2:04 ` Michael R. Zucca
2004-03-24 0:04 ` Benjamin Herrenschmidt
2004-03-24 12:26 ` Marc Leeman [this message]
2004-03-24 14:25 ` Marc Leeman
2004-03-24 17:08 ` linas
2004-03-25 15:48 ` Marc Leeman
2004-03-25 16:34 ` linas
2004-03-25 16:45 ` linas
2004-03-26 8:00 ` Marc Leeman
2004-03-30 19:49 ` Jeff Angielski
2004-03-31 15:56 ` Marc Leeman
2004-03-31 16:02 ` Marc Leeman
2004-04-01 12:33 ` Marc Leeman
2004-04-04 22:53 ` Benjamin Herrenschmidt
2004-04-05 8:46 ` Adrian Cox
[not found] ` <20040402140130.GG22365@smtp.barco.com>
[not found] ` <1081175362.20952.30.camel@localhost.localdomain>
2004-04-06 6:21 ` Marc Leeman
-- strict thread matches above, loose matches on Subject: below --
2004-04-07 7:15 Marc Leeman
2011-04-15 5:44 koteswararaom
2011-04-15 6:32 ` David Hawkins
2011-04-15 6:48 ` Michael Neuling
2025-04-07 14:55 PCI memory mapping Renaud Barbier
2025-04-08 9:54 ` Lucas Stach
2025-04-09 10:00 ` Renaud Barbier
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=20040324122652.GA22171@smtp.barco.com \
--to=marc.leeman@barco.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.linuxppc.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.