mmap
I am doing the following:
malloc some memory is user space
pass its pointer to some kernel module
in the kernel module...do a pci_alloc_consistent so that i get a memory region for PCI DMA operations
now the problem is that i want to remap the address range pointed by the user space pointer to the memory region allocated by the 'pci_alloc_consistent' inside the module. I think this is possible..need some hints....
thanks,
Daljeet Maini
IBM Global Services Ltd. - Bangalore
Ph. No. - 5267117 Extn 2954
Quoted 6 lines · [email protected] wrote:
I am doing the following:
malloc some memory is user space
pass its pointer to some kernel module
in the kernel module...do apci_alloc_consistentso that i get a memory region for PCI DMA operations
Wrong approach, you can use kiobufs if you want DMA to the malloc()ed userspace memory:
* lock down the user memory using map_user_kiobuf() + lock_kiovec() (see linux/iobuf.h).
* translate the iobuf->maplist into a scatterlist [1]
* feed pci_map_sg() with the scatterlist to get DMA addresses. you can pass to the hardware.
And the reverse to free everything when you are done of course.
Gerd
[1] IMHO it would be more useful if iobufs would use a scatterlist instead of an struct page* array.
Signature · 1 line
Gerd Knorr <[email protected]> -- SuSE Labs, Außenstelle Berlin
Quoted 4 lines
now the problem is that i want to remap the address range pointed by the user space pointer to the memory region allocated by the '
pci_alloc_consistent' inside the module. I think this is possible..need some hints....
Wrong way around. Ask the device to create its mapping and reply with the size mmap the object