[PATCH V11 1/4] MIPS&LoongArch&NIOS2: Adjust prototypes of p?d_init()

Huacai Chen chenhuacai at kernel.org
Tue Oct 18 19:00:22 PDT 2022


Hi, Philippe,

On Tue, Oct 18, 2022 at 9:29 PM Philippe Mathieu-Daudé
<philmd at linaro.org> wrote:
>
> On 17/10/22 04:40, Huacai Chen wrote:
> > From: Feiyang Chen <chenfeiyang at loongson.cn>
> >
> > We are preparing to add sparse vmemmap support to LoongArch. MIPS and
> > LoongArch need to call pgd_init()/pud_init()/pmd_init() when populating
> > page tables, so adjust their prototypes to make generic helpers can call
> > them.
> >
> > NIOS2 declares pmd_init() but doesn't use, just remove it to avoid build
> > errors.
> >
> > Reviewed-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
> > Signed-off-by: Feiyang Chen <chenfeiyang at loongson.cn>
> > Signed-off-by: Huacai Chen <chenhuacai at loongson.cn>
> > ---
> >   arch/loongarch/include/asm/pgalloc.h | 13 ++-----------
> >   arch/loongarch/include/asm/pgtable.h |  8 ++++----
> >   arch/loongarch/kernel/numa.c         |  4 ++--
> >   arch/loongarch/mm/pgtable.c          | 23 +++++++++++++----------
> >   arch/mips/include/asm/pgalloc.h      | 10 +++++-----
> >   arch/mips/include/asm/pgtable-64.h   |  8 ++++----
> >   arch/mips/kvm/mmu.c                  |  3 +--
> >   arch/mips/mm/pgtable-32.c            | 10 +++++-----
> >   arch/mips/mm/pgtable-64.c            | 18 ++++++++++--------
> >   arch/mips/mm/pgtable.c               |  2 +-
> >   arch/nios2/include/asm/pgalloc.h     |  5 -----
> >   11 files changed, 47 insertions(+), 57 deletions(-)
>
> > diff --git a/arch/mips/mm/pgtable-32.c b/arch/mips/mm/pgtable-32.c
> > index 61891af25019..88819a21d97e 100644
> > --- a/arch/mips/mm/pgtable-32.c
> > +++ b/arch/mips/mm/pgtable-32.c
> > @@ -13,9 +13,9 @@
> >   #include <asm/pgalloc.h>
> >   #include <asm/tlbflush.h>
> >
> > -void pgd_init(unsigned long page)
> > +void pgd_init(void *addr)
> >   {
> > -     unsigned long *p = (unsigned long *) page;
> > +     unsigned long *p = (unsigned long *)addr;
> >       int i;
> >
> >       for (i = 0; i < USER_PTRS_PER_PGD; i+=8) {
> > @@ -61,9 +61,9 @@ void __init pagetable_init(void)
> >   #endif
> >
> >       /* Initialize the entire pgd.  */
> > -     pgd_init((unsigned long)swapper_pg_dir);
> > -     pgd_init((unsigned long)swapper_pg_dir
> > -              + sizeof(pgd_t) * USER_PTRS_PER_PGD);
> > +     pgd_init(swapper_pg_dir);
> > +     pgd_init((void *)((unsigned long)swapper_pg_dir
> > +              + sizeof(pgd_t) * USER_PTRS_PER_PGD));
>
> Pre-existing, but why not use:
>
>          pgd_init(&swapper_pg_dir[USER_PTRS_PER_PGD]);
>
> ?
OK, that seems better, thanks.

Huacai
>
> Otherwise:
> Reviewed-by: Philippe Mathieu-Daudé <philmd at linaro.org>
>



More information about the linux-arm-kernel mailing list