[PATCH v3 22/29] xtensa: introduce arch_zone_limits_init()

Mike Rapoport
2026-01-11T08:26:56Z

Move calculations of zone limits to a dedicated arch_zone_limits_init()
function.

Later MM core will use this function as an architecture specific callback
during nodes and zones initialization and thus there won't be a need to
call free_area_init() from every architecture.

Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
arch/xtensa/mm/init.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index cc52733a0649..60299f359a3c 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -116,15 +116,19 @@ static void __init print_vm_layout(void)
(unsigned long)(__bss_stop - __bss_start) >> 10);
}

-void __init zones_init(void)
+void __init arch_zone_limits_init(unsigned long *max_zone_pfns)
{
- /* All pages are DMA-able, so we put them all in the DMA zone. */
- unsigned long max_zone_pfn[MAX_NR_ZONES] = {
- [ZONE_NORMAL] = max_low_pfn,
+ max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
#ifdef CONFIG_HIGHMEM
- [ZONE_HIGHMEM] = max_pfn,
+ max_zone_pfns[ZONE_HIGHMEM] = max_pfn;
#endif
- };
+}
+
+void __init zones_init(void)
+{
+ unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0, };
+
+ arch_zone_limits_init(max_zone_pfn);
free_area_init(max_zone_pfn);
print_vm_layout();
}
--
2.51.0