linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] riscv: fix the global name pfn_base confliction error
@ 2021-07-28  7:15 Kenneth Lee
  2021-08-14  5:00 ` Palmer Dabbelt
  0 siblings, 1 reply; 2+ messages in thread
From: Kenneth Lee @ 2021-07-28  7:15 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Anup Patel, Atish Patra, Kenneth Lee, Kefeng Wang, Vitaly Wool,
	Guo Ren, Jisheng Zhang, Mike Rapoport, Nick Kossifidis,
	linux-riscv, linux-kernel
  Cc: guohanjun, wangzhou1

From: Kenneth Lee <liguozhu@hisilicon.com>

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

Chagne from V1:
	use riscv_pfn_base instead of riscv_global_pfn_base.

Signed-off-by: Kenneth Lee <liguozhu@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..c690e83bde23 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_pfn_base;
+#define ARCH_PFN_OFFSET		(riscv_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..788f12bb586b 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_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;
@@ -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_pfn_base = PFN_DOWN(kernel_map.phys_addr);
 
 	/*
 	 * Enforce boot alignment requirements of RV32 and
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] riscv: fix the global name pfn_base confliction error
  2021-07-28  7:15 [PATCH v2] riscv: fix the global name pfn_base confliction error Kenneth Lee
@ 2021-08-14  5:00 ` Palmer Dabbelt
  0 siblings, 0 replies; 2+ messages in thread
From: Palmer Dabbelt @ 2021-08-14  5:00 UTC (permalink / raw)
  To: nek.in.cn
  Cc: Paul Walmsley, aou, alex, anup, Atish Patra, liguozhu,
	wangkefeng.wang, vitaly.wool, guoren, jszhang, rppt, mick,
	linux-riscv, linux-kernel, guohanjun, wangzhou1

On Wed, 28 Jul 2021 00:15:57 PDT (-0700), nek.in.cn@gmail.com wrote:
> From: Kenneth Lee <liguozhu@hisilicon.com>
>
> 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
>
> Chagne from V1:
> 	use riscv_pfn_base instead of riscv_global_pfn_base.
>
> Signed-off-by: Kenneth Lee <liguozhu@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..c690e83bde23 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_pfn_base;
> +#define ARCH_PFN_OFFSET		(riscv_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..788f12bb586b 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_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;
> @@ -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_pfn_base = PFN_DOWN(kernel_map.phys_addr);
>
>  	/*
>  	 * Enforce boot alignment requirements of RV32 and

Thanks, this is on for-next.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-14  5:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28  7:15 [PATCH v2] riscv: fix the global name pfn_base confliction error Kenneth Lee
2021-08-14  5:00 ` Palmer Dabbelt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).