From: Daniel Palmer <daniel@0x0f.com>
To: sammy@sammy.net, geert@linux-m68k.org, linux-m68k@lists.linux-m68k.org
Cc: linux-kernel@vger.kernel.org, Daniel Palmer <daniel@0x0f.com>
Subject: [PATCH 1/2] m68k: sun3: register RAM with memblock and set the low pfn limits
Date: Thu, 24 Sep 2026 20:18:50 +0900 [thread overview]
Message-ID: <20260924111851.3501100-2-daniel@0x0f.com> (raw)
In-Reply-To: <20260924111851.3501100-1-daniel@0x0f.com>
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@0x0f.com>
---
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
next prev parent reply other threads:[~2026-09-24 11:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 11:18 [PATCH 0/2] Make sun3 work again Daniel Palmer
2026-09-24 11:18 ` Daniel Palmer [this message]
2026-09-24 11:18 ` [PATCH 2/2] m68k: sun3: add an early boot console over the PROM Daniel Palmer
2026-09-24 11:32 ` [PATCH 0/2] Make sun3 work again John Paul Adrian Glaubitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260924111851.3501100-2-daniel@0x0f.com \
--to=daniel@0x0f.com \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=sammy@sammy.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®