I'd like to be able to map a single user space address to multiple blocks of low kernel memory. I have a driver where I allocate multiple 4MB blocks using pci_alloc_consistent(). Ideally, I'd like user space process to see 8MB (i.e. 2 4MB blocks) as a single buffer mapped to its virtual address space. Is this possible in mmmap()? Or, is there a way to allocate a chunk of kernel memory greater than 4MB using pci_alloc_consistent() (or other apis as long as memory is dma compatible)?

I'd appreciate any pointers. Thanks.

有帮助吗?

解决方案

Take a look at function vm_insert_page() or remap_pfn_range() in mm/memory.c. You can find an example at: drivers/media/v4l2-core/videobuf2-dma-sg.c, function vb2_dma_sg_mmap()

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top