[PATCH] riscv: fix the global name pfn_base confliction error

Lee Ken nek.in.cn at gmail.com
Wed Jul 28 00:08:43 PDT 2021


indeed. I'll send a new one.

On Wed, Jul 28, 2021 at 2:55 PM Mike Rapoport <rppt at kernel.org> wrote:
>
> On Wed, Jul 28, 2021 at 02:43:18PM +0800, Kenneth Lee wrote:
> > From: Kenneth Lee <liguozhu at hisilicon.com>
> >
> > RISCV use a global variable pfn_base for page/pfn translation. But this
> > is a common name and will be used elsewhere. In those case,
> > the page-pfn macro which refer this name will refer to the local/input
> > variable of those function (such as in vfio_pin_pages_remote). This make
> > everything wrong.
> >
> > This patch change the name from pfn_base to riscv_global_pfn_base to fix
>
> I think global is excessive, just riscv_pfn_base should be ok for proper
> namespacing.
>
> > this problem
> >
> > Signed-off-by: Kenneth Lee <liguozhu at hisilicon.com>
> > ---
> >  arch/riscv/include/asm/page.h | 4 ++--
> >  arch/riscv/mm/init.c          | 6 +++---
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
> > index cca8764aed83..8711e415f37c 100644
> > --- a/arch/riscv/include/asm/page.h
> > +++ b/arch/riscv/include/asm/page.h
> > @@ -79,8 +79,8 @@ typedef struct page *pgtable_t;
> >  #endif
> >
> >  #ifdef CONFIG_MMU
> > -extern unsigned long pfn_base;
> > -#define ARCH_PFN_OFFSET              (pfn_base)
> > +extern unsigned long riscv_global_pfn_base;
> > +#define ARCH_PFN_OFFSET              (riscv_global_pfn_base)
> >  #else
> >  #define ARCH_PFN_OFFSET              (PAGE_OFFSET >> PAGE_SHIFT)
> >  #endif /* CONFIG_MMU */
> > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> > index a14bf3910eec..2ce4e9a46ca0 100644
> > --- a/arch/riscv/mm/init.c
> > +++ b/arch/riscv/mm/init.c
> > @@ -228,8 +228,8 @@ static struct pt_alloc_ops _pt_ops __initdata;
> >  #define pt_ops _pt_ops
> >  #endif
> >
> > -unsigned long pfn_base __ro_after_init;
> > -EXPORT_SYMBOL(pfn_base);
> > +unsigned long riscv_global_pfn_base __ro_after_init;
> > +EXPORT_SYMBOL(riscv_global_pfn_base);
> >
> >  pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_bss;
> >  pgd_t trampoline_pg_dir[PTRS_PER_PGD] __page_aligned_bss;
> > @@ -572,7 +572,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
> >       kernel_map.va_kernel_pa_offset = kernel_map.virt_addr - kernel_map.phys_addr;
> >  #endif
> >
> > -     pfn_base = PFN_DOWN(kernel_map.phys_addr);
> > +     riscv_global_pfn_base = PFN_DOWN(kernel_map.phys_addr);
> >
> >       /*
> >        * Enforce boot alignment requirements of RV32 and
> > --
> > 2.25.1
> >
>
> --
> Sincerely yours,
> Mike.



More information about the linux-riscv mailing list