From: Magnus Lindholm <linmag7@gmail.com>
To: sparclinux@vger.kernel.org
Cc: davem@davemloft.net, andreas@gaisler.com,
linux-kernel@vger.kernel.org, sam@ravnborg.org,
glaubitz@physik.fu-berlin.de, Magnus Lindholm <linmag7@gmail.com>
Subject: [PATCH v2 3/6] sparc32: populate memblock from the PROM memory map
Date: Sun, 30 Aug 2026 14:06:42 +0200 [thread overview]
Message-ID: <20260830120742.20950-4-linmag7@gmail.com> (raw)
In-Reply-To: <20260830120742.20950-1-linmag7@gmail.com>
Add each available PROM memory range to memblock as it is discovered.
Keep populating sp_banks temporarily so the remaining users continue to
work while they are converted in the following patches.
Since the complete PROM map is now present before bootmem_init(), enforce
the mem= limit after the legacy bank processing. Adding a smaller
overlapping range would otherwise leave memory beyond the requested limit
in memblock during this intermediate commit.
Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
---
arch/sparc/mm/init_32.c | 3 +++
arch/sparc/prom/memory.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index e0e66f91ceeb..75050dfbc2ea 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -165,6 +165,9 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
memblock_add(sp_banks[i].base_addr, sp_banks[i].num_bytes);
}
+ if (cmdline_memory_size)
+ memblock_enforce_memory_limit(cmdline_memory_size);
+
/* Start with page aligned address of last symbol in kernel
* image.
*/
diff --git a/arch/sparc/prom/memory.c b/arch/sparc/prom/memory.c
index 269d6ab5ef5e..59962bc0bc82 100644
--- a/arch/sparc/prom/memory.c
+++ b/arch/sparc/prom/memory.c
@@ -7,6 +7,7 @@
*/
#include <linux/kernel.h>
+#include <linux/memblock.h>
#include <linux/sort.h>
#include <linux/init.h>
@@ -23,6 +24,7 @@ static int __init prom_meminit_v0(void)
for (p = *(romvec->pv_v0mem.v0_available); p; p = p->theres_more) {
sp_banks[index].base_addr = (unsigned long) p->start_adr;
sp_banks[index].num_bytes = p->num_bytes;
+ memblock_add(p->start_adr, p->num_bytes & PAGE_MASK);
index++;
}
@@ -42,6 +44,7 @@ static int __init prom_meminit_v2(void)
for (i = 0; i < num_ents; i++) {
sp_banks[i].base_addr = reg[i].phys_addr;
sp_banks[i].num_bytes = reg[i].reg_size;
+ memblock_add(reg[i].phys_addr, reg[i].reg_size & PAGE_MASK);
}
return num_ents;
--
2.43.0
next prev parent reply other threads:[~2026-08-30 12:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 12:06 [PATCH v2 0/6] sparc32: replace sp_banks with memblock Magnus Lindholm
2026-08-30 12:06 ` [PATCH v2 1/6] sparc32: use memblock when mapping the kernel Magnus Lindholm
2026-08-30 12:06 ` [PATCH v2 2/6] sparc32: use memblock to find available system memory Magnus Lindholm
2026-08-30 12:06 ` Magnus Lindholm [this message]
2026-08-30 12:06 ` [PATCH v2 4/6] sparc32: drop unused valid address bitmap Magnus Lindholm
2026-08-30 17:22 ` Sam Ravnborg
2026-08-30 12:06 ` [PATCH v2 5/6] sparc32: move early memory setup to setup_arch Magnus Lindholm
2026-08-30 18:19 ` Sam Ravnborg
2026-09-01 13:54 ` Magnus Lindholm
2026-08-30 12:06 ` [PATCH v2 6/6] sparc32: drop sp_banks Magnus Lindholm
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=20260830120742.20950-4-linmag7@gmail.com \
--to=linmag7@gmail.com \
--cc=andreas@gaisler.com \
--cc=davem@davemloft.net \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
--cc=sparclinux@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.