MIPS: vdso: Utilize __pa() for gic_pfn
PATCH 1/1 MIPS: vdso: Utilize __pa() for gic_pfn
The GIC user offset is mapped into every process' virtual address and is therefore part of the hot-path of arch_setup_additional_pages(). Utilize __pa() such that we are more optimal even when CONFIG_DEBUG_VIRTUAL is enabled, and while at it utilize PFN_DOWN() instead of open-coding the right shift by PAGE_SHIFT.
--- arch/mips/kernel/vdso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kernel/vdso.c +1 -1
@@ -159,7 +159,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)/* Map GIC user page. */ if (gic_size) { gic_base = (unsigned long )mips_gic_base +MIPS_GIC_USER_OFS ; - gic_pfn =virt_to_phys ((void *)gic_base) >>PAGE_SHIFT ; + gic_pfn =PFN_DOWN (__pa (gic_base)); ret =io_remap_pfn_range (vma, base, gic_pfn, gic_size,pgprot_noncached (vma->vm_page_prot));
Signature · 1 line
2.25.1
Quoted 10 lines · Florian Fainelli
The GIC user offset is mapped into every process' virtual address and is therefore part of the hot-path of
arch_setup_additional_pages(). Utilize__pa()such that we are more optimal even whenCONFIG_DEBUG_VIRTUALis enabled, and while at it utilizePFN_DOWN()instead of open-coding the right shift byPAGE_SHIFT.Reported-by Greg Ungerer <[email protected]>Suggested-by Serge Semin <[email protected]>Fixes dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL")Signed-off-by Florian Fainelli <[email protected]>
Fixes the issue of warnings on every process start with CONFIG_DEBUG_VIRTUAL enabled for me. Thanks. So if you want:
Regards
Greg
Quoted 17 lines
--- arch/mips/kernel/vdso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/mips/kernel/vdso.c +1
-1@@ -159,7 +159,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)/* Map GIC user page. */ if (gic_size) { gic_base = (unsigned long )mips_gic_base +MIPS_GIC_USER_OFS ; - gic_pfn =virt_to_phys ((void *)gic_base) >>PAGE_SHIFT ; + gic_pfn =PFN_DOWN (__pa (gic_base)); ret =io_remap_pfn_range (vma, base, gic_pfn, gic_size,pgprot_noncached (vma->vm_page_prot));
Quoted 29 lines · Florian Fainelli
The GIC user offset is mapped into every process' virtual address and is therefore part of the hot-path of
arch_setup_additional_pages(). Utilize__pa()such that we are more optimal even whenCONFIG_DEBUG_VIRTUALis enabled, and while at it utilizePFN_DOWN()instead of open-coding the right shift byPAGE_SHIFT.Reported-by Greg Ungerer <[email protected]>Suggested-by Serge Semin <[email protected]>Fixes dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL")Signed-off-by Florian Fainelli <[email protected]>--- arch/mips/kernel/vdso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/mips/kernel/vdso.c +1
-1@@ -159,7 +159,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)/* Map GIC user page. */ if (gic_size) { gic_base = (unsigned long )mips_gic_base +MIPS_GIC_USER_OFS ; - gic_pfn =virt_to_phys ((void *)gic_base) >>PAGE_SHIFT ; + gic_pfn =PFN_DOWN (__pa (gic_base)); ret =io_remap_pfn_range (vma, base, gic_pfn, gic_size,pgprot_noncached (vma->vm_page_prot));Signature · 1 line
2.25.1
applied to mips-next.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]