I am trying to write a kernel driver to manage some memory blocks of physically contiguous and DMAable memory (I use kmalloc() , since these are only DMA threads). To enable some functionality in user space, this memory must be mmap() ed with its own implementation of mmap() . I use Linux device drivers and bad examples that appear on Google as the main source of information.
My mmap() (calling it my_mmap() now) should be registered in the kernel. This is the only valid way to do this using struct file_operations , but this requires creating a personal device and a physical location for it. I do not want to do this. I just want to create a virtual address for a user application to access memory buffers and not create files for mapping memory buffers. Is it possible?
I found that frame buffers also have an equivalent structure with mmap() implementation, but that would be too heavy. This adds more unknowns.
As I understand it, my_mmap() can do the hard work and use remap_pfn_range() while I'm fine with lost flexibility. Otherwise, I would have to implement local nopages() and register it with struct vm_operations_struct . Is it correct?
source share