[RFC PATCH v2 18/21] riscv: Kconfig: Introduce 64K page size

Xu Lu
2024-12-05T10:45:10Z

This patch introduces new config to control whether enabling the 64K
base page feature on RISC-V.

The 64K config will set software page size as 64K and automatically use
svnapot to accelerate basic page mapping.

Signed-off-by: Xu Lu <luxu.kernel@bytedance.com>
---
arch/riscv/Kconfig | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 2c0cb175a92a..592eb5766029 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -167,7 +167,6 @@ config RISCV
select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD
select HAVE_MOVE_PMD
select HAVE_MOVE_PUD
- select HAVE_PAGE_SIZE_4KB
select HAVE_PCI
select HAVE_PERF_EVENTS
select HAVE_PERF_REGS
@@ -885,6 +884,28 @@ 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"
+ select HAVE_PAGE_SIZE_4KB
+ help
+ This feature enables 4KB pages support.
+
+config RISCV_64K_PAGES
+ bool "64KB"
+ depends on RISCV_ISA_SVNAPOT && 64BIT
+ select HAVE_PAGE_SIZE_64KB
+ select RISCV_USE_SW_PAGE
+ help
+ This feature enables 64KB pages support.
+
+endchoice
+
config ARCH_SUPPORTS_KEXEC
def_bool y