From 4770f7b46cc0d37f3401d41ebfa3d241b8a045d9 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Thu, 30 Jul 2026 14:16:02 +0200 Subject: [PATCH] mm/pgalloc: support 32 KB and 64 KB page sizes Add CONFIG_MM_PGSIZE == 32768 and 65536 to the page-size switch (and the Kconfig help text). The 64 KB size matches the ESP32-S3 cache-MMU page granularity, so an address-environment port there can use one mm_pgalloc() page per cache-MMU page (naturally 64 KB-aligned by the granule allocator) instead of coalescing several smaller pages. Inert for existing configs: MM_PGSIZE is only used when CONFIG_MM_PGALLOC is enabled (BUILD_KERNEL). Assisted-by: Claude Opus 4.8 (1M context) Signed-off-by: Marco Casaroli --- include/nuttx/pgalloc.h | 6 ++++++ mm/Kconfig | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/nuttx/pgalloc.h b/include/nuttx/pgalloc.h index 33f6a937b45..bec03d9b4e7 100644 --- a/include/nuttx/pgalloc.h +++ b/include/nuttx/pgalloc.h @@ -69,6 +69,12 @@ #elif CONFIG_MM_PGSIZE == 16384 # define MM_PGSIZE 16384 # define MM_PGSHIFT 14 +#elif CONFIG_MM_PGSIZE == 32768 +# define MM_PGSIZE 32768 +# define MM_PGSHIFT 15 +#elif CONFIG_MM_PGSIZE == 65536 +# define MM_PGSIZE 65536 +# define MM_PGSHIFT 16 #else # error CONFIG_MM_PGSIZE not supported #endif diff --git a/mm/Kconfig b/mm/Kconfig index aebba1d0130..e0b8441a6ae 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -301,9 +301,10 @@ config MM_PGSIZE int "Page Size" default 4096 ---help--- - The MMU page size. Must be one of {1024, 2048, 4096, 8192, or - 16384}. This is easily extensible, but only those values are - currently support. + The MMU page size. Must be one of {1024, 2048, 4096, 8192, 16384, + 32768, or 65536}. This is easily extensible, but only those values + are currently support. 64 KB (65536) matches the ESP32-S3 cache-MMU + page size. config DEBUG_PGALLOC bool "Page Allocator Debug"