vm: add no-mmu vm_iomap_memory() stub [Linux 3.9]

This Linux kernel change "vm: add no-mmu vm_iomap_memory() stub" is included in the Linux 3.9 release. This change is authored by Linus Torvalds <torvalds [at] linux-foundation.org> on Sat Apr 27 13:25:38 2013 -0700. The commit for this change in Linux stable tree is 3c0b9de (patch).

vm: add no-mmu vm_iomap_memory() stub

I think we could just move the full vm_iomap_memory() function into
util.h or similar, but I didn't get any reply from anybody actually
using nommu even to this trivial patch, so I'm not going to touch it any
more than required.

Here's the fairly minimal stub to make the nommu case at least
potentially work.  It doesn't seem like anybody cares, though.

Signed-off-by: Linus Torvalds <[email protected]foundation.org>

There are 10 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 mm/nommu.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/mm/nommu.c b/mm/nommu.c
index 2f3ea74..e001768 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1838,6 +1838,16 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
 }
 EXPORT_SYMBOL(remap_pfn_range);

+int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long len)
+{
+   unsigned long pfn = start >> PAGE_SHIFT;
+   unsigned long vm_len = vma->vm_end - vma->vm_start;
+
+   pfn += vma->vm_pgoff;
+   return io_remap_pfn_range(vma, vma->vm_start, pfn, vm_len, vma->vm_page_prot);
+}
+EXPORT_SYMBOL(vm_iomap_memory);
+
 int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
            unsigned long pgoff)
 {

Leave a Reply

Your email address will not be published. Required fields are marked *