All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: AW: PowerPC PCI DMA issues (prefetch/coherency?)
@ 2009-09-02 21:22 Adam Zilkie
  2009-09-03  8:05 ` Chris Pringle
  0 siblings, 1 reply; 43+ messages in thread
From: Adam Zilkie @ 2009-09-02 21:22 UTC (permalink / raw)
  To: chris.pringle, linuxppc-dev; +Cc: Tom Burns, Andrea Zypchen

Hi Chris,

I am having a problem similar to what you described in this discussion.
We are using the ppc arch with 2.6.24 with CONFIG_SEQUOIA with compiles
arch/ppc/kernel/head_44x.c (quite different
from /arch/powerpc/kernel/head_32.S). I would like to apply your
backporting patch to this architecture. Any help would be appreciated.

Regards,
Adam 

-- 
Adam Zilkie
Software Designer,
International Datacasting Corp.

This message and the documents attached hereto are intended only for the addressee and may contain privileged or confidential information. Any unauthorized disclosure is strictly prohibited. If you have received this message in error, please notify us immediately so that we may correct our internal records. Please then delete the original message. Thank you.

^ permalink raw reply	[flat|nested] 43+ messages in thread
* PowerPC PCI DMA issues (prefetch/coherency?)
@ 2009-06-16 13:58 Chris Pringle
  2009-06-16 16:21 ` Scott Wood
  0 siblings, 1 reply; 43+ messages in thread
From: Chris Pringle @ 2009-06-16 13:58 UTC (permalink / raw)
  To: linux-kernel

Hello All,

We're developing on a Freescale MPC8272 and are having some nasty 
problems with PCI bus mastering and data corruption.

We have some custom hardware that is bus mastering, reading data from 
the CPUs memory for it's own use. Most of the time, the data is correct, 
however occasionally we are seeing data that appears to be from 
somewhere else in memory (usually memory that has already been read by 
the PCI device). The problem looks like stale data on the PCI bridge 
prefetch buffers or a cache coherency problem, but we've been unable to 
come up with a solution to our problem. It is my understanding that it 
shouldn't be a cache coherency problem as the CPU cache should be 
snooped as the data is read from memory. Even if it were an issue, the 
pci_map_sg* functions should have sorted out any cache coherency issues 
before the DMA operation started.

I've not been able to find anything on the Freescale data sheet that 
provides any way of flushing the prefetch cache on the PCI bridge. We've 
done a bit of experimenting, and found that turning off prefetch appears 
to solve (or possibly mask?) the problem (at the expensive of massive 
performance problems). I've also tried DMA'ing two adjacent userspace 
buffers in memory (from the same page), and see corruption on the second 
buffer. If I populate both buffers, then DMA them both, the data is 
fine. If I populate the first, DMA the first, then populate the second 
and DMA the second, corruption occurs at the start of the second buffer. 
If I add 8-32 bytes of padding between the buffers, the problem goes away.

The PCI spec says that the PCI bridge is supposed to flush any data from 
it's prefetch buffers that are not read by the bus master, so 
technically, this isn't supposed to happen.

I've tried making sure that buffers are cache line (and page) aligned, 
and are multiples of cache lines, but it's made no difference. PIO mode 
works fine, and I've checked the data with the CPU just before, and 
immediately after the DMA and the driver sees no data integrity issues. 
There are memory write barriers just before the DMA start, so all the 
registers should be correct before the DMA starts.

For background info, the device doing the bus mastering is a Xilinx 
Virtex 5 FPGA. We've monitored the data as it comes off the PCI bus 
using ChipScope - so the firmware should not be manipulating the data in 
any way.

We have some hardware/firmware/drivers that has a lot of common code 
that runs on an x86 platform (as opposed to powerpc), and that works 
without any issues whatsoever.

Has anyone got any ideas what this might be? Does anyone of know issues 
with PCI bridges on the PowerPC platform? Is there extra things that 
need to be done from the driver when DMAing on PowerPC (I've looked at 
other drivers and there's nothing obvious). The chip errata doesn't have 
anything on it that looks like it could cause this.

I'm really hoping this is something that we're doing wrong in the driver 
or the firmware, but we've been through both the firmware and drivers 
countless times and are unable to see anything wrong.

Any thoughts/ideas would be much appreciated!

Regards,
Chris

-- 

______________________________
Chris Pringle
Software Engineer

Miranda Technologies Ltd.
Hithercroft Road
Wallingford
Oxfordshire OX10 9DG
UK

Tel. +44 1491 820206
Fax. +44 1491 820001
www.miranda.com

____________________________

Miranda Technologies Limited
Registered in England and Wales CN 02017053
Registered Office: James House, Mere Park, Dedmere Road, Marlow, Bucks, SL7 1FJ

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

end of thread, other threads:[~2009-09-11 16:05 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-02 21:22 AW: PowerPC PCI DMA issues (prefetch/coherency?) Adam Zilkie
2009-09-03  8:05 ` Chris Pringle
2009-09-03  9:57   ` Benjamin Herrenschmidt
2009-09-03 16:04     ` Adam Zilkie
2009-09-03 16:21       ` Josh Boyer
2009-09-03 20:27       ` Prodyut Hazarika
2009-09-08 18:01         ` Adam Zilkie
2009-09-08 18:59           ` Prodyut Hazarika
2009-09-08 19:30             ` Adam Zilkie
2009-09-08 19:56               ` Prodyut Hazarika
2009-09-08 20:00                 ` Adam Zilkie
2009-09-09  1:34                   ` Benjamin Herrenschmidt
2009-09-08 21:34               ` Benjamin Herrenschmidt
2009-09-09 13:28             ` Mikhail Zolotaryov
2009-09-09 13:43               ` Tom Burns
2009-09-09 14:12                 ` Mikhail Zolotaryov
2009-09-09 14:10                   ` Tom Burns
2009-09-09 14:40                     ` Mikhail Zolotaryov
2009-09-11  1:57                       ` Benjamin Herrenschmidt
2009-09-11  7:17                         ` Mikhail Zolotaryov
2009-09-11  7:31                           ` Benjamin Herrenschmidt
2009-09-11  1:57                     ` Benjamin Herrenschmidt
2009-09-10 19:53                   ` Tom Burns
2009-09-10 20:30                     ` Pravin Bathija
2009-09-11  2:44                       ` Benjamin Herrenschmidt
2009-09-11  5:12                         ` Stefan Roese
2009-09-11  5:17                           ` Benjamin Herrenschmidt
2009-09-11  5:25                             ` Stefan Roese
2009-09-11  5:35                               ` Pravin Bathija
2009-09-11  5:40                                 ` Benjamin Herrenschmidt
2009-09-11  9:23                                   ` Pravin Bathija
2009-09-11  1:59                     ` Benjamin Herrenschmidt
2009-09-11 16:05                     ` Prodyut Hazarika
2009-09-11  1:55                 ` Benjamin Herrenschmidt
2009-09-11 13:51                   ` Tom Burns
2009-09-08 21:29           ` Benjamin Herrenschmidt
2009-09-03 12:20   ` Wrobel Heinz-R39252
2009-09-03 12:43     ` Chris Pringle
2009-09-06 21:32     ` Benjamin Herrenschmidt
2009-09-03 15:54   ` Adam Zilkie
  -- strict thread matches above, loose matches on Subject: below --
2009-06-16 13:58 Chris Pringle
2009-06-16 16:21 ` Scott Wood
2009-06-16 16:34   ` Chris Pringle
2009-06-16 16:46     ` Scott Wood
2009-06-16 16:57       ` Chris Pringle
2009-06-16 17:03         ` Scott Wood
2009-06-17  7:58           ` Chris Pringle
2009-06-17 13:18             ` Chris Pringle
2009-06-18 11:24               ` Chris Pringle
2009-06-22 14:31                 ` AW: " Sergej.Stepanov
2009-06-22 14:31                   ` Sergej.Stepanov
2009-06-29  8:11                   ` Chris Pringle

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.