From: Imre Kaloz <kaloz@kernel.org>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] MIPS: sgi-ip32: Reserve the firmware memory
Date: Tue, 13 Oct 2026 11:45:53 +0200 [thread overview]
Message-ID: <20261013094554.16804-3-kaloz@kernel.org> (raw)
In-Reply-To: <20261013094554.16804-1-kaloz@kernel.org>
ARC memory descriptors are ignored on IP32, so firmware data in low
memory ends up in the page allocator and CMA. Reserve it using the
generic ARC walk; RAM comes from CRIME, as ARC lists only the first
256 MiB.
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
arch/mips/fw/arc/memory.c | 11 +++++++++--
arch/mips/include/asm/sgialib.h | 3 +++
arch/mips/sgi-ip32/ip32-memory.c | 3 +++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/arch/mips/fw/arc/memory.c b/arch/mips/fw/arc/memory.c
index fb78e6fd5de4..97eb7ba02cd4 100644
--- a/arch/mips/fw/arc/memory.c
+++ b/arch/mips/fw/arc/memory.c
@@ -120,7 +120,8 @@ static int __init prom_memtype_classify(union linux_memtypes type)
return memtype_classify_arc(type);
}
-void __weak __init prom_meminit(void)
+/* Platforms that detect RAM themselves pass add_ram = false. */
+void __init prom_mdesc_init(bool add_ram)
{
struct linux_mdesc *p;
@@ -151,7 +152,8 @@ void __weak __init prom_meminit(void)
if (base < PHYS_OFFSET)
continue;
- memblock_add(base, size);
+ if (add_ram)
+ memblock_add(base, size);
if (type == mem_reserved)
memblock_reserve(base, size);
@@ -169,6 +171,11 @@ void __weak __init prom_meminit(void)
}
}
+void __weak __init prom_meminit(void)
+{
+ prom_mdesc_init(true);
+}
+
void __weak __init prom_cleanup(void)
{
}
diff --git a/arch/mips/include/asm/sgialib.h b/arch/mips/include/asm/sgialib.h
index 80f900417f7e..28fd9f6fbad2 100644
--- a/arch/mips/include/asm/sgialib.h
+++ b/arch/mips/include/asm/sgialib.h
@@ -36,6 +36,9 @@ extern struct linux_mdesc *prom_getmdesc(struct linux_mdesc *curr);
*/
extern void prom_meminit(void);
+/* Reserve the firmware's memory; add_ram also registers all ranges as RAM. */
+void prom_mdesc_init(bool add_ram);
+
/* PROM device tree library routines. */
#define PROM_NULL_COMPONENT ((pcomponent *) 0)
diff --git a/arch/mips/sgi-ip32/ip32-memory.c b/arch/mips/sgi-ip32/ip32-memory.c
index 5fee33744f67..eadafb98422e 100644
--- a/arch/mips/sgi-ip32/ip32-memory.c
+++ b/arch/mips/sgi-ip32/ip32-memory.c
@@ -40,4 +40,7 @@ void __init prom_meminit(void)
bank, base, size >> 20);
memblock_add(base, size);
}
+
+ /* ARC describes only the first 256 MiB, so RAM comes from CRIME. */
+ prom_mdesc_init(false);
}
--
2.47.3
next prev parent reply other threads:[~2026-10-13 9:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 9:45 [PATCH 0/3] MIPS: SGI fixes Imre Kaloz
2026-10-13 9:45 ` [PATCH 1/3] MIPS: sgi-ip32: Clear latched CRIME errors at boot Imre Kaloz
2026-10-13 9:45 ` Imre Kaloz [this message]
2026-10-13 9:45 ` [PATCH 3/3] MIPS: SGI-IP30: fix the defconfig defaults for the Bridge PROM and RTC Imre Kaloz
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=20261013094554.16804-3-kaloz@kernel.org \
--to=kaloz@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
/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