From: Magnus Lindholm <linmag7@gmail.com>
To: davem@davemloft.net, andreas@gaisler.com
Cc: sam@ravnborg.org, sparclinux@vger.kernel.org,
linux-kernel@vger.kernel.org, linmag7@gmail.com
Subject: [PATCH v5 2/6] sparc32: use memblock to find available system memory
Date: Wed, 7 Oct 2026 19:41:11 +0200 [thread overview]
Message-ID: <20261007174128.959307-3-linmag7@gmail.com> (raw)
In-Reply-To: <20261007174128.959307-1-linmag7@gmail.com>
The SRMMU nocache pool is sized after memblock has been populated. Use
memblock_phys_mem_size() instead of summing the private sp_banks array.
Suggested-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
---
arch/sparc/mm/srmmu.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 110e2f248c60..7b57a10c961f 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -226,25 +226,13 @@ void srmmu_free_nocache(void *addr, int size)
static void srmmu_early_allocate_ptable_skeleton(unsigned long start,
unsigned long end);
-/* Return how much physical memory we have. */
-static unsigned long __init probe_memory(void)
-{
- unsigned long total = 0;
- int i;
-
- for (i = 0; sp_banks[i].num_bytes; i++)
- total += sp_banks[i].num_bytes;
-
- return total;
-}
-
/*
* Reserve nocache dynamically proportionally to the amount of
* system RAM. -- Tomas Szepe <szepe@pinerecords.com>, June 2002
*/
static void __init srmmu_nocache_calcsize(void)
{
- unsigned long sysmemavail = probe_memory() / 1024;
+ unsigned long sysmemavail = memblock_phys_mem_size() / 1024;
int srmmu_nocache_npages;
srmmu_nocache_npages =
--
2.43.0
next prev parent reply other threads:[~2026-10-07 17:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 17:41 [PATCH v5 0/6] sparc32: replace sp_banks with memblock Magnus Lindholm
2026-10-07 17:41 ` [PATCH v5 1/6] sparc32: use memblock when mapping the kernel Magnus Lindholm
2026-10-07 17:41 ` Magnus Lindholm [this message]
2026-10-07 17:41 ` [PATCH v5 3/6] sparc32: populate memblock from the PROM memory map Magnus Lindholm
2026-10-07 17:41 ` [PATCH v5 4/6] sparc32: drop unused valid address bitmap Magnus Lindholm
2026-10-07 17:41 ` [PATCH v5 5/6] sparc32: move early memory setup to setup_arch Magnus Lindholm
2026-10-07 17:41 ` [PATCH v5 6/6] sparc32: drop sp_banks Magnus Lindholm
2026-10-08 8:46 ` [PATCH v5 0/6] sparc32: replace sp_banks with memblock Andreas Larsson
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=20261007174128.959307-3-linmag7@gmail.com \
--to=linmag7@gmail.com \
--cc=andreas@gaisler.com \
--cc=davem@davemloft.net \
--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.