PCI DMA to user mem on mpc83xx
Ira W. Snyder
iws at ovro.caltech.edu
Tue May 24 03:27:27 EST 2011
On Mon, May 23, 2011 at 11:12:41AM +0200, Andre Schwarz wrote:
> Ira,
>
> we have a pretty old PCI device driver here that needs some basic rework
> running on 2.6.27 on several MPC83xx.
> It's a simple char-device with "give me some data" implemented using
> read() resulting in zero-copy DMA to user mem.
>
> There's get_user_pages() working under the hood along with
> SetPageDirty() and page_cache_release().
>
> Main goal is to prepare a sg-list that gets fed into a DMA controller.
>
> I wonder if there's a more up-to-date/efficient and future proof scheme
> of creating the mapping.
>
>
> Could you provide some pointers or would you stick to the current scheme ?
>
This scheme is the best you'll come up with for zero-copy IO. I used
get_user_pages_fast(), but otherwise my implementation was the same.
These interfaces should be fairly future proof.
In the end, I realized that most of my transfers were 4 bytes in length,
and zero copy IO was a waste of effort. I decided to use mmap instead.
Ira
More information about the Linuxppc-dev
mailing list