[RFC PATCH V1 11/11] riscv: Introduce 64K page size
From: Xu Lu
Date: Thu Nov 23 2023 - 01:59:07 EST
This patch introduces new config to control whether enabling the 64K
base page feature on RISC-V.
Signed-off-by: Xu Lu <luxu.kernel@xxxxxxxxxxxxx>
---
arch/Kconfig | 1 +
arch/riscv/Kconfig | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/arch/Kconfig b/arch/Kconfig
index f4b210ab0612..66f64450d409 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -1087,6 +1087,7 @@ config HAVE_ARCH_COMPAT_MMAP_BASES
config PAGE_SIZE_LESS_THAN_64KB
def_bool y
+ depends on !RISCV_64K_PAGES
depends on !ARM64_64K_PAGES
depends on !PAGE_SIZE_64KB
depends on !PARISC_PAGE_SIZE_64KB
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 105cbb3ca797..d561f9f7f9b4 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -227,6 +227,7 @@ config RISCV_HW_PAGE_SHIFT
config RISCV_PAGE_SHIFT
int
+ default 16 if RISCV_64K_PAGES
default 12
config KASAN_SHADOW_OFFSET
@@ -692,6 +693,25 @@ config RISCV_BOOT_SPINWAIT
If unsure what to do here, say N.
+choice
+ prompt "Page size"
+ default RISCV_4K_PAGES
+ help
+ Page size (translation granule) configuration.
+
+config RISCV_4K_PAGES
+ bool "4KB"
+ help
+ This feature enables 4KB pages support.
+
+config RISCV_64K_PAGES
+ bool "64KB"
+ depends on ARCH_HAS_STRICT_KERNEL_RWX && 64BIT
+ help
+ This feature enables 64KB pages support (4KB by default)
+
+endchoice
+
config ARCH_SUPPORTS_KEXEC
def_bool MMU
--
2.20.1