[PATCH 1/2] m68k: sun3: register RAM with memblock and set the low pfn limits
From: Daniel Palmer
Date: Thu Sep 24 2026 - 07:22:01 EST
The sun3 memory init never talked to memblock, so paging_init() and the
first slab allocation found no memory at all:
* register physical RAM with memblock_add() and reserve the kernel
image (and embedded initramfs) below memory_start. The generic
m68k_setup_node() no longer does this, and sun3's paging_init()
allocates its page tables straight out of memblock, so without it
memblock is empty and paging_init() panics;
* memblock_set_bottom_up(true): paging_init() runs while only the low
RAM the PROM handed us is mapped, so its page-table allocations must
come from just above the kernel rather than the unmapped top of RAM;
* set min_low_pfn/max_low_pfn: memblock_free_all() clamps the pages it
releases into the buddy allocator to [min_low_pfn, max_low_pfn); with
them left 0 the whole of RAM stayed reserved and the first slab
allocation BUG'd.
Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Daniel Palmer <daniel@xxxxxxxx>
---
arch/m68k/sun3/config.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
index cd8af809e0ca..cb4e19b95a1b 100644
--- a/arch/m68k/sun3/config.c
+++ b/arch/m68k/sun3/config.c
@@ -118,6 +118,30 @@ static void __init sun3_bootmem_alloc(unsigned long memory_start,
high_memory = (void *)memory_end;
availmem = memory_start;
+ /*
+ * memblock_free_all() clamps the pages it releases into the buddy
+ * allocator to [min_low_pfn, max_low_pfn); without these set the
+ * whole of RAM stays reserved and the first slab allocation fails.
+ */
+ min_low_pfn = __pa(memory_start) >> PAGE_SHIFT;
+ max_low_pfn = max_pfn;
+
+ /*
+ * Register physical RAM with memblock and reserve the kernel image
+ * (and the embedded initramfs) below memory_start. The generic
+ * m68k_setup_node() no longer does this, and sun3's paging_init()
+ * allocates its page tables straight out of memblock, so without
+ * this memblock is empty and paging_init() panics.
+ */
+ memblock_add(0, __pa(memory_end));
+ memblock_reserve(0, __pa(memory_start));
+ /*
+ * paging_init() runs while only the low RAM the PROM handed us is
+ * mapped, so its page-table allocations must come from just above
+ * the kernel (bottom-up) rather than the unmapped top of RAM.
+ */
+ memblock_set_bottom_up(true);
+
m68k_setup_node(0);
}
--
2.55.0