@@ -398,7 +398,7 @@ static inline struct page *pgd_page(pgd_t pgd)
#define p4d_offset p4d_offset
p4d_t *p4d_offset(pgd_t *pgd, unsigned long address);
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && defined(CONFIG_ARCH_HAS_PTE_DEVMAP)
static inline int pte_devmap(pte_t pte);
static inline pte_t pmd_pte(pmd_t pmd);
@@ -19,7 +19,13 @@
#define _PAGE_SOFT (3 << 8) /* Reserved for software */
#define _PAGE_SPECIAL (1 << 8) /* RSW: 0x1 */
+
+#ifdef CONFIG_ARCH_HAS_PTE_DEVMAP
#define _PAGE_DEVMAP (1 << 9) /* RSW, devmap */
+#else
+#define _PAGE_DEVMAP 0
+#endif /* CONFIG_ARCH_HAS_PTE_DEVMAP */
+
#define _PAGE_TABLE _PAGE_PRESENT
/*
The PTE bit(9) on RISC-V is reserved for software, it is used by devmap now which has to be disabled if we want to use bit(9) for other features, since there's no more free PTE bit on RISC-V now. So to make ARCH_HAS_PTE_DEVMAP selectable, this patch uses it as the build condition of devmap definitions. Signed-off-by: Chunyan Zhang <zhangchunyan@iscas.ac.cn> --- arch/riscv/include/asm/pgtable-64.h | 2 +- arch/riscv/include/asm/pgtable-bits.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)