]> git.baikalelectronics.ru Git - kernel.git/commitdiff
MIPS: vdso: Utilize __pa() for gic_pfn
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 7 Jul 2022 20:27:58 +0000 (13:27 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:24:06 +0000 (14:24 +0200)
[ Upstream commit a911ad58a1d56086a06cc4a178e35ccd3a49d4cb ]

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.

Reported-by: Greg Ungerer <gerg@kernel.org>
Suggested-by: Serge Semin <fancer.lancer@gmail.com>
Fixes: f6c79b8d8bc7 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Greg Ungerer <gerg@kernel.org>
Tested-by: Greg Ungerer <gerg@kernel.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/mips/kernel/vdso.c

index 3d0cf471f2fe1eeaace55057e138b6b8dcddf033..b2cc2c2dd4bfc44493dd11526b1eebe3b23ef2d2 100644 (file)
@@ -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));