Question

http://lxr.free-electrons.com/source/include/linux/vmalloc.h?v=3.4;a=arm#L11

There are bunch of flags for vm_struct in vmalloc.c. I can understand VM_ALLOC, which means the vm_struct is constructed by the vmalloc() call.

But what do the other flags mean? Particularly the VM_IOREMAP. It is used in Android binder driver.

http://lxr.free-electrons.com/source/drivers/staging/android/binder.c?v=3.4;a=arm#L2819

Was it helpful?

Solution

define VM_IOREMAP 0x00000001 /* ioremap() and friends */

VM_IOREMAP means this virtual memory region is created by ioremap(), * ususally * ( but * not limited to *) to map a I/O memory region ( featured by its physical address ) of a hardware device ( like a PCI device) into kernel virtual address range, so we can access the I/O memory by simple read / write.

Not go into driver detail much, But in Android binder driver you mentioned, it seems the driver is using it to implement mmap() system call, which is to share a set of RAM pages ( not device I/O memory region) between driver and user-space code. So after user-space code mmap() the driver char device file, it could direct access those RAM pages directly from user-level without do a kernel-user-level transition. The common usage of this coding trick (as far as I remember for other driver cases ) is, driver produce data content into those RAM pages in kernel-level, user-level code read data content of those RAM pages directly from user-level.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top