Re: Mapping unused physical RAM to user space.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Mike DeKoker <mdekoker@yahoo.com> wrote:
> 
> 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? 

 Normally, the mmap function of a driver validates a few
things and sets flags in the vma. Making the pages accessible
to users is done in the nopage function. 
Instead, you can make your driver's mmap  function update the
process page table also. Since you know the physical address
of the reserved memory, you can create and set the PTEs in the
page table. When the process tries to access this page, it is
alerady there - there is no page fault and the nopage function
will not be called.

 I haven't thought this through fully. You will have to
consider how to keep track of multiple mmap's and what
to do if the user app exits abnormally.

Hope this helps,
Ravi.

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux