[PATCH 3/7] sparc64: avoid huge kernel PUD mappings on sun4u
From: Magnus Lindholm
Date: Fri Oct 02 2026 - 12:20:57 EST
The kernel PUD refill path merges virtual address bits 32:28 into a
TTE, requiring a hardware page size of at least 256MB. On sun4u,
kern_linear_pte_xor[2] and [3] instead select the 4MB fallback TTE.
Consequently address bits 27:22 are lost when refilling a huge PUD.
Keep the kernel linear mapping at PMD granularity on sun4u. Its refill
path preserves bit 22, as required by the 4MB TTE. Leave the sun4v
mapping selection unchanged.
Fixes: 0dd5b7b09e13 ("sparc64: Fix physical memory management regressions with large max_phys_bits.")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Magnus Lindholm <linmag7@xxxxxxxxx>
---
arch/sparc/mm/init_64.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 103db4683b16..0ae97e616435 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -1696,6 +1696,14 @@ static unsigned long __ref kernel_map_hugepud(unsigned long vstart,
static bool kernel_can_map_hugepud(unsigned long vstart, unsigned long vend,
bool guard)
{
+ /*
+ * The PUD miss path propagates VA bits 32:28, assuming at least
+ * 256MB hardware pages. Sun4u uses 4MB pages here: retain PMD
+ * mappings so bits 27:22 are not lost during TLB refill.
+ */
+ if (tlb_type != hypervisor)
+ return false;
+
if (guard && !(vstart & ~PUD_MASK) && (vend - vstart) >= PUD_SIZE)
return true;
--
2.43.0