riscv: mm: fix build errors caused by mk_pmd()
PATCH v2 1/1 riscv: mm: fix build errors caused by mk_pmd()
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.
---
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(-)
arch/riscv/include/asm/pgtable-64.h +2 -0
@@ -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))
arch/riscv/include/asm/pgtable.h +0 -5
@@ -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));
Signature · 1 line
2.18.0.huawei.25
Quoted 12 lines · Nanyong Sun
With "riscv: mm: add THP support on 64-bit",
mk_pmd()function
introduce build errors,
1.build withCONFIG_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=narch/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]
Quoted 6 lines
Move the definition of
mk_pmdtopgtable-64.hto fix the first error. Use macro definition instead of inline function formk_pmdto fix the second problem. It is similar to themk_ptemacro.Reported-by kernel test robot <[email protected]>Signed-off-by Nanyong Sun <[email protected]>
Thanks, this fixes my rv32 build.
Works fine with litex-rebase on VexRiscv.
No regression on BeagleV Starlight-beta.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Palmer Dabbelt
maintainerQuoted 45 lines · On Thu, 17 Jun 2021 02:58:31 PDT (-0700), [email protected] wrote:
With "riscv: mm: add THP support on 64-bit",
mk_pmd()function
introduce build errors,
1.build withCONFIG_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=narch/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_pmdtopgtable-64.hto fix the first error. Use macro definition instead of inline function formk_pmdto fix the second problem. It is similar to themk_ptemacro.Reported-by kernel test robot <[email protected]>Signed-off-by Nanyong Sun <[email protected]>---
Changes in v2:
- Movemk_pmdtopgtable-64.h--- arch/riscv/include/asm/pgtable-64.h | 2 ++ arch/riscv/include/asm/pgtable.h | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-)arch/riscv/include/asm/pgtable-64.h +2
-0@@ -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))arch/riscv/include/asm/pgtable.h +0
-0@@ -516,11 +516,6 @@ static inline unsigned long pmd_pfn(pmd_t pmd)return ((__pmd_to_phys (pmd) &PMD_MASK ) >>PAGE_SHIFT );
arch/riscv/include/asm/pgtable.h static inline unsigned long pmd_pfn(pmd_t pmd) · line 521
Quoted 10 lines
arch/riscv/include/asm/pgtable.h +0
-5} -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.