* [PATCH v2 -next] riscv: mm: fix build errors caused by mk_pmd()
@ 2021-06-17 9:58 Nanyong Sun
2021-06-22 14:03 ` Geert Uytterhoeven
2021-07-06 2:50 ` Palmer Dabbelt
0 siblings, 2 replies; 3+ messages in thread
From: Nanyong Sun @ 2021-06-17 9:58 UTC (permalink / raw)
To: paul.walmsley, palmer, aou
Cc: linux-riscv, linux-kernel, palmerdabbelt, atish.patra,
wangkefeng.wang, sunnanyong
With "riscv: mm: add THP support on 64-bit", mk_pmd() function
introduce build errors,
1.build with CONFIG_ARCH_RV32I=y:
arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
arch/riscv/include/asm/pgtable.h:513:9: error: implicit declaration of function 'pfn_pmd';
did you mean 'pfn_pgd'? [-Werror=implicit-function-declaration]
2.build with CONFIG_SPARSEMEM=y && CONFIG_SPARSEMEM_VMEMMAP=n
arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
include/asm-generic/memory_model.h:64:14: error: implicit declaration of function 'page_to_section';
did you mean 'present_section'? [-Werror=implicit-function-declaration]
Move the definition of mk_pmd to pgtable-64.h to fix the first error.
Use macro definition instead of inline function for mk_pmd
to fix the second problem. It is similar to the mk_pte macro.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
---
Changes in v2:
- Move mk_pmd to pgtable-64.h
---
arch/riscv/include/asm/pgtable-64.h | 2 ++
arch/riscv/include/asm/pgtable.h | 5 -----
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/pgtable-64.h
index 1439017b16f8..228261aa9628 100644
--- a/arch/riscv/include/asm/pgtable-64.h
+++ b/arch/riscv/include/asm/pgtable-64.h
@@ -79,6 +79,8 @@ static inline unsigned long _pmd_pfn(pmd_t pmd)
return pmd_val(pmd) >> _PAGE_PFN_SHIFT;
}
+#define mk_pmd(page, prot) pfn_pmd(page_to_pfn(page), prot)
+
#define pmd_ERROR(e) \
pr_err("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e))
diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 5ae51e6bd5ab..6bc2582f82e9 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -516,11 +516,6 @@ static inline unsigned long pmd_pfn(pmd_t pmd)
return ((__pmd_to_phys(pmd) & PMD_MASK) >> PAGE_SHIFT);
}
-static inline pmd_t mk_pmd(struct page *page, pgprot_t prot)
-{
- return pfn_pmd(page_to_pfn(page), prot);
-}
-
static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
{
return pte_pmd(pte_modify(pmd_pte(pmd), newprot));
--
2.18.0.huawei.25
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 -next] riscv: mm: fix build errors caused by mk_pmd()
2021-06-17 9:58 [PATCH v2 -next] riscv: mm: fix build errors caused by mk_pmd() Nanyong Sun
@ 2021-06-22 14:03 ` Geert Uytterhoeven
2021-07-06 2:50 ` Palmer Dabbelt
1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-06-22 14:03 UTC (permalink / raw)
To: Nanyong Sun
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv,
Linux Kernel Mailing List, Palmer Dabbelt, Atish Patra,
Kefeng Wang
On Thu, Jun 17, 2021 at 11:28 AM Nanyong Sun <sunnanyong@huawei.com> wrote:
> With "riscv: mm: add THP support on 64-bit", mk_pmd() function
> introduce build errors,
> 1.build with CONFIG_ARCH_RV32I=y:
> arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
> arch/riscv/include/asm/pgtable.h:513:9: error: implicit declaration of function 'pfn_pmd';
> did you mean 'pfn_pgd'? [-Werror=implicit-function-declaration]
>
> 2.build with CONFIG_SPARSEMEM=y && CONFIG_SPARSEMEM_VMEMMAP=n
> arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
> include/asm-generic/memory_model.h:64:14: error: implicit declaration of function 'page_to_section';
> did you mean 'present_section'? [-Werror=implicit-function-declaration]
>
> Move the definition of mk_pmd to pgtable-64.h to fix the first error.
> Use macro definition instead of inline function for mk_pmd
> to fix the second problem. It is similar to the mk_pte macro.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
Thanks, this fixes my rv32 build.
Works fine with litex-rebase on VexRiscv.
No regression on BeagleV Starlight-beta.
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 -next] riscv: mm: fix build errors caused by mk_pmd()
2021-06-17 9:58 [PATCH v2 -next] riscv: mm: fix build errors caused by mk_pmd() Nanyong Sun
2021-06-22 14:03 ` Geert Uytterhoeven
@ 2021-07-06 2:50 ` Palmer Dabbelt
1 sibling, 0 replies; 3+ messages in thread
From: Palmer Dabbelt @ 2021-07-06 2:50 UTC (permalink / raw)
To: sunnanyong
Cc: Paul Walmsley, aou, linux-riscv, linux-kernel, Atish Patra,
wangkefeng.wang, sunnanyong
On Thu, 17 Jun 2021 02:58:31 PDT (-0700), sunnanyong@huawei.com wrote:
> With "riscv: mm: add THP support on 64-bit", mk_pmd() function
> introduce build errors,
> 1.build with CONFIG_ARCH_RV32I=y:
> arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
> arch/riscv/include/asm/pgtable.h:513:9: error: implicit declaration of function 'pfn_pmd';
> did you mean 'pfn_pgd'? [-Werror=implicit-function-declaration]
>
> 2.build with CONFIG_SPARSEMEM=y && CONFIG_SPARSEMEM_VMEMMAP=n
> arch/riscv/include/asm/pgtable.h: In function 'mk_pmd':
> include/asm-generic/memory_model.h:64:14: error: implicit declaration of function 'page_to_section';
> did you mean 'present_section'? [-Werror=implicit-function-declaration]
>
> Move the definition of mk_pmd to pgtable-64.h to fix the first error.
> Use macro definition instead of inline function for mk_pmd
> to fix the second problem. It is similar to the mk_pte macro.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
> ---
> Changes in v2:
> - Move mk_pmd to pgtable-64.h
> ---
> arch/riscv/include/asm/pgtable-64.h | 2 ++
> arch/riscv/include/asm/pgtable.h | 5 -----
> 2 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/pgtable-64.h
> index 1439017b16f8..228261aa9628 100644
> --- a/arch/riscv/include/asm/pgtable-64.h
> +++ b/arch/riscv/include/asm/pgtable-64.h
> @@ -79,6 +79,8 @@ static inline unsigned long _pmd_pfn(pmd_t pmd)
> return pmd_val(pmd) >> _PAGE_PFN_SHIFT;
> }
>
> +#define mk_pmd(page, prot) pfn_pmd(page_to_pfn(page), prot)
> +
> #define pmd_ERROR(e) \
> pr_err("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e))
>
> diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
> index 5ae51e6bd5ab..6bc2582f82e9 100644
> --- a/arch/riscv/include/asm/pgtable.h
> +++ b/arch/riscv/include/asm/pgtable.h
> @@ -516,11 +516,6 @@ static inline unsigned long pmd_pfn(pmd_t pmd)
> return ((__pmd_to_phys(pmd) & PMD_MASK) >> PAGE_SHIFT);
> }
>
> -static inline pmd_t mk_pmd(struct page *page, pgprot_t prot)
> -{
> - return pfn_pmd(page_to_pfn(page), prot);
> -}
> -
> static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
> {
> return pte_pmd(pte_modify(pmd_pte(pmd), newprot));
Thanks, this is on for-next.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-06 2:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 9:58 [PATCH v2 -next] riscv: mm: fix build errors caused by mk_pmd() Nanyong Sun
2021-06-22 14:03 ` Geert Uytterhoeven
2021-07-06 2:50 ` 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).