mapping user space buffer
Matthew Dillon
dillon at apollo.backplane.com
Tue Aug 8 13:34:52 PDT 2006
:
:I have a driver that supports DMA of user space buffers and had a
:couple of questions. The ultimate question (I think) is how to
:lock/map/unmap/unlock user space virtual addresses. A quick perusal of
:some drivers turned up two approaches: vmapbuf() and the
:bus_dmamap_load*() routines. The source for each makes them look
:similar, but are they equivalent? Is one preferable? In both cases, it
:appears that the driver must first call vslock() on the user virtual
:address (and then vsunlock after the transfer completes). Are there
:other necessary steps? Is there a good driver that I can use to answer
:some of these questions? As usual, TIA.
:
:---chuck
You will probably have to use both. vmapbuf() assumes the data to be
in user memory and basically maps it into kernel memory and prevents
it from being ripped out from under the device. BUSDMA expects
the data to be in kernel memory and handles any bounce-buffer
requirements (if the device's DMA cannot reach the physical memory
locations in question).
-Matt
Matthew Dillon
<dillon at xxxxxxxxxxxxx>
More information about the Kernel
mailing list