All of lore.kernel.org
 help / color / mirror / Atom feed
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 v3 2/6] sparc32: use memblock to find available system memory
Date: Tue,  1 Sep 2026 23:45:46 +0200	[thread overview]
Message-ID: <20260901214611.60560-3-linmag7@gmail.com> (raw)
In-Reply-To: <20260901214611.60560-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>
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
---
 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 23a6383feb15..f094f6c105a2 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


  parent reply	other threads:[~2026-09-01 21:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 21:45 [PATCH v3 0/6] sparc32: replace sp_banks with memblock Magnus Lindholm
2026-09-01 21:45 ` [PATCH v3 1/6] sparc32: use memblock when mapping the kernel Magnus Lindholm
2026-09-01 21:45 ` Magnus Lindholm [this message]
2026-09-01 21:45 ` [PATCH v3 3/6] sparc32: populate memblock from the PROM memory map Magnus Lindholm
2026-09-01 21:45 ` [PATCH v3 4/6] sparc32: drop unused valid address bitmap Magnus Lindholm
2026-09-01 21:45 ` [PATCH v3 5/6] sparc32: move early memory setup to setup_arch Magnus Lindholm
2026-09-02  5:31   ` Sam Ravnborg
2026-09-01 21:45 ` [PATCH v3 6/6] sparc32: drop sp_banks Magnus Lindholm
2026-09-02  5:35 ` [PATCH v3 0/6] sparc32: replace sp_banks with memblock Sam Ravnborg
2026-09-02  5:38   ` 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=20260901214611.60560-3-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.