I am using mmap. That's how I can be using a nopage VMA operation.
Since I'm mapping RAM I can't use remap_page_range, so I use the
nopage VMA operation to return the proper page that a process should
use when it legitimately faults. This works fine for buffers allocated by
the kernel (kmalloc). For reserved buffers (these buffers are not allocated
by the kernel, they reside at the top of physical RAM but are ignored by
the kernel due to the "mem=XX" kernel parameter.) the page entries
don't appear to be valid.
Thanks!
Mike DeKoker
sridhar vaidyanathan <sridharv@ufl.edu> wrote:
Quoting Mike DeKoker:
>
> I am developing a module for a PCI device. In order to get large enough
> DMA buffers, I am reserving the upper N megabytes of RAM (via the
> kernel parameter "mem=") and using ioremap to get at the buffer from
> within the kernel. This is all fine and dandy, I can do DMA transfers
> to/from my device just fine. My question is, is it possible to map
> this DMA buffer into user space?
>
> For smaller, kmalloc'd DMA buffers I can map into user space easily by
> manually returning the correct page with VM no_page operation. It
> doesn't look like I can do this using reserved buffers because the
> page structures don't appear to be valid. (Reserved buffer page indices
> >= max_mapnr).
>
> Thanks for your time,
> Mike DeKoker
> Signatec, Inc.
>
I think you will have to implement mmap() for your driver.Check Linux Device
Drivers, Rubini for more information.
-sridhar
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).