Skip to content

Commit 9eb4fcf

Browse files
sunnanyongpalmer-dabbelt
authored andcommitted
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. Reported-by: kernel test robot <[email protected]> Signed-off-by: Nanyong Sun <[email protected]> Tested-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 658e2c5 commit 9eb4fcf

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

arch/riscv/include/asm/pgtable-64.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ static inline unsigned long _pmd_pfn(pmd_t pmd)
7979
return pmd_val(pmd) >> _PAGE_PFN_SHIFT;
8080
}
8181

82+
#define mk_pmd(page, prot) pfn_pmd(page_to_pfn(page), prot)
83+
8284
#define pmd_ERROR(e) \
8385
pr_err("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e))
8486

arch/riscv/include/asm/pgtable.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,6 @@ static inline unsigned long pmd_pfn(pmd_t pmd)
516516
return ((__pmd_to_phys(pmd) & PMD_MASK) >> PAGE_SHIFT);
517517
}
518518

519-
static inline pmd_t mk_pmd(struct page *page, pgprot_t prot)
520-
{
521-
return pfn_pmd(page_to_pfn(page), prot);
522-
}
523-
524519
static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
525520
{
526521
return pte_pmd(pte_modify(pmd_pte(pmd), newprot));

0 commit comments

Comments
 (0)