nommu: reimplement remap_pfn_range() to simply return 0
Subsystems (3)
PATCH 1/1 nommu: reimplement remap_pfn_range() to simply return 0
Function 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.
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 which is meanless on nommu arch, so this patch just make it simply return 0.
--- include/linux/mm.h | 10 ++++++++++ mm/nommu.c | 8 -------- 2 files changed, 10 insertions(+), 8 deletions(-)
include/linux/mm.h +10 -0
@@ -1526,8 +1526,18 @@ static inline pgprot_t vm_get_page_prot(unsigned long vm_flags)#endif struct vm_area_struct *find_extend_vma (struct mm_struct *,unsigned long addr); + +#ifdef CONFIG_MMU int remap_pfn_range (struct vm_area_struct *,unsigned long addr,unsigned long pfn,unsigned long size,pgprot_t ); +#else +static inline int remap_pfn_range (struct vm_area_struct *vma,unsigned long addr, +unsigned long pfn,unsigned long size,pgprot_t prot) +{ +return 0 ; +} +#endif +int vm_insert_page (struct vm_area_struct *,unsigned long addr,struct page *);int vm_insert_pfn (struct vm_area_struct *vma,unsigned long addr,unsigned long pfn);
mm/nommu.c +0 -8
@@ -1813,14 +1813,6 @@ 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) -{ - vma->vm_start = vma->vm_pgoff <<PAGE_SHIFT ; -return 0 ; -} -EXPORT_SYMBOL (remap_pfn_range); -int remap_vmalloc_range (struct vm_area_struct *vma,void *addr,unsigned long pgoff) {
Signature · 9 lines
1.6.3.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/1 nommu: reimplement remap_pfn_range() to simply return 0
Quoted 11 lines · Bob Liu
Function
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_SHIFTwhich is wrong acroding the original meaning of this function.Some driver developer using
remap_pfn_range()with correct parameter will get unexpected result becausevm_startis changed.It should be implementd just like addr = pfn <<
PAGE_SHIFTwhich is meanless on nommu arch, so this patch just make it simply return 0.
I'd return -EINVAL if addr != pfn << PAGE_SHIFT.
And I can imagine architectures wanting to do something with the prot flags.
Daniel
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 7 lines · Daniel Glöckner
Quoted 6 lines · Bob Liu
Function
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_SHIFTwhich is wrong acroding the original meaning of this function.
Quoted 7 lines
Quoted 5 lines
Some driver developer using
remap_pfn_range()with correct parameter will get unexpected result becausevm_startis changed.It should be implementd just like addr = pfn <<
PAGE_SHIFTwhich is meanless on nommu arch, so this patch just make it simply return 0.I'd return
-EINVALif addr != pfn <<PAGE_SHIFT.
okay.
Quoted 2 lines
And I can imagine architectures wanting to do something with the prot flags.
Actually it's just a fake function on nommu arch, so in my opinion we'd better keep it simple
as current.
Signature · 9 lines
Regards, --Bob -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 1 line · Daniel Glöckner
And I can imagine architectures wanting to do something with the prot flags.
this func is implemented in common mmu code with no arch callbacks, so there isnt anything different here. when bob said "nommu arch", he wasnt referring to an actual architecture, but to nommu vs mmu memory management cores.
-mike
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>