summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-16 13:45:37 -0700
committerGabby Lee <galee@nvidia.com>2013-07-07 23:33:01 -0700
commit54b33762eb6f96639c2bb75244db7aca4ec8fbdc (patch)
tree1ed280032034b2be9081c46f05da23cbf519b510 /include
parent94f4a946681270cd7a18bcac9d8ea86ea45acaf6 (diff)
vm: add vm_iomap_memory() helper function
Various drivers end up replicating the code to mmap() their memory buffers into user space, and our core memory remapping function may be very flexible but it is unnecessarily complicated for the common cases to use. Our internal VM uses pfn's ("page frame numbers") which simplifies things for the VM, and allows us to pass physical addresses around in a denser and more efficient format than passing a "phys_addr_t" around, and having to shift it up and down by the page size. But it just means that drivers end up doing that shifting instead at the interface level. It also means that drivers end up mucking around with internal VM things like the vma details (vm_pgoff, vm_start/end) way more than they really need to. So this just exports a function to map a certain physical memory range into user space (using a phys_addr_t based interface that is much more natural for a driver) and hides all the complexity from the driver. Some drivers will still end up tweaking the vm_page_prot details for things like prefetching or cacheability etc, but that's actually relevant to the driver, rather than caring about what the page offset of the mapping is into the particular IO memory region. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit b4cbb197c7e7a68dbad0d491242e3ca67420c13e in upstream v3.9) Change-Id: I203f48975ccd9047a588669d13173385b906ab5b Bug 1316563 Signed-off-by: Jon Mayo <jmayo@nvidia.com> Reviewed-on: http://git-master/r/244439 (cherry picked from commit f1f51c1f1823e4b5254db2b80d08302df95af11e) Signed-off-by: David Yu <davyu@nvidia.com> Change-Id: Ibf65b97e4ff4956a2e6ecb33b7926ec283648c16 Reviewed-on: http://git-master/r/245000 GVS: Gerrit_Virtual_Submit Reviewed-by: Gabby Lee <galee@nvidia.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mm.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 01ebcc59f252..89c47d957419 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1508,6 +1508,8 @@ int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
unsigned long pfn);
int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
unsigned long pfn);
+int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long len);
+
struct page *follow_page(struct vm_area_struct *, unsigned long address,
unsigned int foll_flags);