DMA to User-Space

Sergey Temerkhanov temerkhanov at yandex.ru
Tue Nov 24 04:11:09 EST 2009


On Wednesday 04 November 2009 02:37:38 Jonathan Haws wrote:
> All,
> 
> I have what may be an unconventional question:
> 
> Our application consists of data being captured by an FPGA, processed, and
>  transferred to SDRAM.  I simply give the FPGA an address of where I want
>  it stored in SDRAM and it simply DMAs the data over and interrupts me when
>  finished.  I then take that data and store it to disk.
> 
> I have code in user space that handles all of the writing to disk nicely
>  and fast enough for my application (I am capturing data at about 35-40
>  Mbytes/sec).
> 
> My question is this:  is it possible to give a user-space pointer to the
>  FPGA to DMA to?  It seems like I would have problems with alignment,
>  address manipulation, and a whole slew of other issues.

Well, it's possible: you'll have to use zero-copy I/O. Here's an article on 
this subject: http://lwn.net/Articles/28548/.
Have a look at drivers/scsi/st.c at sgl_get_user_pages() or 
drivers/infiniband/hw/ipath/ipath_user_pages.c for example of how to use that.

Regards, Sergey Temerkhanov.




More information about the Linuxppc-dev mailing list