commit: http://blackfin.uclinux.org/git/?p=linux-kernel;a=commitdiff;h=ef407f80bdfe1bd71bfa8bc3a7cb8e942bd7d3d0 branch: http://blackfin.uclinux.org/git/?p=linux-kernel;a=shortlog;h=refs/heads/trunk
remap_pfn_range() means map physical address pfn<<PAGE_SHIFT to user addr. For nommu arch it's implemented by vma->vm_start = pfn << PAGE_SHIFT which is wrong acroding the original meaning of this function. And some driver developer using remap_pfn_range() with correct parameter will get unexpected result because vm_start is changed. It should be implementd just like addr = pfn << PAGE_SHIFT but which is meanless on nommu arch, this patch just make it simply return. Parameter name and setting of vma->vm_flags also be fixed. Reported-by: Scott Jiang <[email protected]> Signed-off-by: Bob Liu <[email protected]> --- mm/nommu.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mm/nommu.c b/mm/nommu.c index 1eb381a..1258176 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1839,10 +1839,20 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address, return NULL; } -int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, - unsigned long to, unsigned long size, pgprot_t prot) +int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, + unsigned long pfn, unsigned long size, pgprot_t prot) { - vma->vm_start = vma->vm_pgoff << PAGE_SHIFT; + unsigned long end = addr + PAGE_ALIGN(size); + + if (addr != (pfn << PAGE_SHIFT)) + return -EINVAL; + + if (addr == vma->vm_start && end == vma->vm_end) { + vma->vm_pgoff = pfn; + vma->vm_flags |= VM_PFN_AT_MMAP; + } + + vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; return 0; } EXPORT_SYMBOL(remap_pfn_range);
_______________________________________________ Linux-kernel-commits mailing list [email protected] https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits
