Mmap and munmap physical address to user space
Hi,
We have an ARM based platform running kernel v2.6.18.For a particular driver, a physical space of around 2MB is required which would be shared by the device, driver and the application. The memory requirement
changes from application to application, so a memory manager manages the physical memory allocation on this shared area.
The device has MMU so, it doesn't require contiguous physical memory. The only condition is that the user space address must be contigous.
In the implementation we have used mmap to get a range of user virtual address, but have delayed the association of user virtual address with kernel virtual address till the our memory manager gives us the physical pages. Which means that remap_pfn_range is not called will memory is allocated by the manager.
We are able to associate a non-contiguous physical memory with contiguous user space address. The problem is that, we want to dissociate the user space address and the physical memory when the memory manager frees the space.
We tried using zap_page_range which doesn't work. Also unmap_range was used which gave kernel panic.
Could anybody let us know what is the way to unmap in such cases, or else an alternate way to achieve the same.
Regards
-Vijay S. Iyer
|