[PATCH 15/18] sparc32,leon: skip the GR-LEON4-ITX PROM mapping import

From: Magnus Lindholm

Date: Thu Nov 26 2026 - 04:32:04 EST


The factory U-Boot maps SDRAM with 16 MiB leaves. Linux reaches the
PROM through the linear mapping. Until now leon_swprobe() rejected its
context table at 0x4bffe000 because it lay at max_pfn. Adding the upper
RAM raises max_pfn and makes the importer copy these leaves into the I/O
and vmalloc areas. The first vmap() then faults in
__vmap_pages_range_noflush().

Skip the import on this board, including the high virtual addresses
whose leaves alias RAM that Linux will allocate.

Signed-off-by: Magnus Lindholm <linmag7@xxxxxxxxx>
---
arch/sparc/include/asm/leon.h | 1 +
arch/sparc/kernel/leon_legacy.c | 5 +++++
arch/sparc/mm/srmmu.c | 4 ++++
3 files changed, 10 insertions(+)

diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h
index 67f2822d5fc6..9e51f1fb70fd 100644
--- a/arch/sparc/include/asm/leon.h
+++ b/arch/sparc/include/asm/leon.h
@@ -226,6 +226,7 @@ void leon_update_virq_handling(unsigned int virq,
const char *name, int do_ack);
extern bool leon_gr_leon4_itx;
void leon_init_timers(void);
+bool leon_legacy_is_itx(void);
void leon_node_init(struct device_node *dp, struct device_node ***nextp);
void init_leon(void);
void poke_leonsparc(void);
diff --git a/arch/sparc/kernel/leon_legacy.c b/arch/sparc/kernel/leon_legacy.c
index fa978620f4a6..d6c9efe59f42 100644
--- a/arch/sparc/kernel/leon_legacy.c
+++ b/arch/sparc/kernel/leon_legacy.c
@@ -39,6 +39,11 @@ static u32 __init legacy_read(u32 address)
return LEON3_BYPASS_LOAD_PA(address);
}

+bool __init leon_legacy_is_itx(void)
+{
+ return prom_leon_legacy && leon_gr_leon4_itx;
+}
+
static bool __init legacy_is(u32 id, unsigned int device)
{
return (id >> 24) == VENDOR_GAISLER &&
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index d2963fab829c..2ecc42f6c935 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -767,6 +767,10 @@ static void __init srmmu_inherit_prom_mappings(unsigned long start,
pte_t *ptep;
int what; /* 0 = normal-pte, 1 = pmd-level pte, 2 = pgd-level pte */

+ /* The ITX U-Boot maps only SDRAM here. Its PROM is in the linear map. */
+ if (IS_ENABLED(CONFIG_SPARC_LEON) && leon_legacy_is_itx())
+ return;
+
while (start <= end) {
if (start == 0)
break; /* probably wrap around */
--
2.43.0