Subject: DMA mapping file mappings
To: None <tech-kern@netbsd.org>
From: Damien Bergamini <damien.bergamini@free.fr>
List: tech-kern
Date: 09/14/2004 20:21:49
The title says it all ;-)
I want to map the content of a file into DMA memory. The file
is mapped into user memory via mmap(2) by a userland tool which
then send the resulting pointer to a kernel driver via a special
ioctl. The driver then map the region into DMA using the
bus_dmamap_load(9) function passing a pointer to the process that
does the ioctl.
Is it safe to do this? Do I need to call mlock(2) on the file
mapping or to call mmap(2) with the MAP_WIRED flag before passing
the pointer to the driver?
Should I copyin(9) everything into kernel memory first?
Thanks for any tip! Tell me if you need more precisions.
Damien Bergamini
damien.bergamini [at] free.fr