Skip to content

Commit

Permalink
riscv: fix the global name pfn_base confliction error
Browse files Browse the repository at this point in the history
[ Upstream commit fb31f0a ]

RISCV uses a global variable pfn_base for page/pfn translation. But this
is a common name and will be used elsewhere. In those cases, the
page-pfn macros which refer to this name will be referred to the
local/input variable instead. (such as in vfio_pin_pages_remote). This
make everything wrong.

This patch changes the name from pfn_base to riscv_pfn_base to fix
this problem.

Signed-off-by: Kenneth Lee <liguozhu@hisilicon.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Kenneth Lee authored and gregkh committed Sep 22, 2021
1 parent f9910fa commit 35f2ecc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions arch/riscv/include/asm/page.h
Expand Up @@ -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_pfn_base;
#define ARCH_PFN_OFFSET (riscv_pfn_base)
#else
#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
#endif /* CONFIG_MMU */
Expand Down
6 changes: 3 additions & 3 deletions arch/riscv/mm/init.c
Expand Up @@ -234,8 +234,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_pfn_base __ro_after_init;
EXPORT_SYMBOL(riscv_pfn_base);

pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_bss;
pgd_t trampoline_pg_dir[PTRS_PER_PGD] __page_aligned_bss;
Expand Down Expand Up @@ -579,7 +579,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_pfn_base = PFN_DOWN(kernel_map.phys_addr);

/*
* Enforce boot alignment requirements of RV32 and
Expand Down

0 comments on commit 35f2ecc

Please sign in to comment.