[PATCH 2/3] MIPS: sgi-ip32: Reserve the firmware memory
From: Imre Kaloz
Date: Tue Oct 13 2026 - 06:09:33 EST
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@xxxxxxxxxx>
---
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