@@ -13,6 +13,7 @@ config 32BIT
config RISCV
def_bool y
select ARCH_CLOCKSOURCE_INIT
+ select HAVE_ARCH_HUGE_VMAP
select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
select ARCH_HAS_BINFMT_FLAT
select ARCH_HAS_DEBUG_VM_PGTABLE
@@ -642,6 +642,41 @@ static inline pmd_t pmdp_establish(struct vm_area_struct *vma,
}
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
+static inline int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot)
+{
+ return 0;
+}
+
+static inline int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot)
+{
+ return 0;
+}
+
+static inline int pud_clear_huge(pud_t *pud)
+{
+ return 0;
+}
+
+static inline int pmd_clear_huge(pmd_t *pmd)
+{
+ return 0;
+}
+
+static inline int p4d_free_pud_page(p4d_t *p4d, unsigned long addr)
+{
+ return 0;
+}
+
+static inline int pud_free_pmd_page(pud_t *pud, unsigned long addr)
+{
+ return 0;
+}
+
+static inline int pmd_free_pte_page(pmd_t *pmd, unsigned long addr)
+{
+ return 0;
+}
+
/*
* Encode and decode a swap entry
*
@@ -1,4 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _ASM_RISCV_VMALLOC_H
#define _ASM_RISCV_VMALLOC_H
+#include <asm/pgtable-bits.h>
+
+#define arch_vmap_pte_range_map_size arch_vmap_pte_range_map_size
+static inline unsigned long arch_vmap_pte_range_map_size(unsigned long addr, unsigned long end,
+ u64 pfn, unsigned int max_page_shift)
+{
+ bool is_napot_addr = !(addr & NAPOT_CONT64KB_MASK);
+ bool pfn_align_napot = !(pfn & (NAPOT_64KB_PTE_NUM - 1UL));
+ bool space_enough = ((end - addr) >= NAPOT_CONT64KB_SIZE);
+
+ if (is_napot_addr && pfn_align_napot && space_enough
+ && max_page_shift >= NAPOT_CONT64KB_SHIFT)
+ return NAPOT_CONT64KB_SIZE;
+
+ return PAGE_SIZE;
+}
+
#endif /* _ASM_RISCV_VMALLOC_H */