DMA straight into users read/write buffer?

Rick Richardson (rick@dgii.com)
Sat, 19 Apr 1997 08:40:56 -0500 (CDT)


I may be making this harder than it is. I'll let the kernel
experts decide.

I have a DMA controller on a board on the PCI bus. This DMA controller
can DMA anywhere into/outof PCI space. I'd like to be able to
implement read/write in a device driver that uses this DMA controller
to move the data directly from the board into the users read/write buffer.

It seems to me that in order to do this, I'd have to insure that
the users buffer is paged in and locked into core, since the DMA
controller uses physical addresses. I want the driver to do this
automatically before starting the DMA and then unlock it after
the DMA is complete.

Am I on the right track, and if so, what internal kernel utility
function can I use to lock down the memory? Also, does virt_to_phys()
work for user space addresses?

do_mlock() seems to be the right one, but its a static function.

Maybe there are other issues that would make this scheme fail????

-- 
Rick Richardson        Sr. Principal Engr.    Does anybody remember Western
Digi Intl.             Email: rick@dgii.com   Electric 419A relay test clips?
11001 Bren Rd. East    Fax:   (612) 912-4955  
Minnetonka, MN 55343   Tel:   (612) 912-3212  http://www.dgii.com/people/rick/