[PATCH 02/18] sparc32,leon: retain SMP TLB shootdowns
From: Magnus Lindholm
Date: Thu Nov 26 2026 - 04:31:30 EST
LEON replaces the synchronous SMP TLB wrappers with local operations,
leaving remote translations stale after a mapping change. Keep the SMP
wrappers for LEON. On GR-LEON4-ITX, all 512 remapping reads were stale
without this change and all 512 were fresh with it.
leon_switch_mm() passed NULL to flush_tlb_mm(), which the SMP wrapper
would dereference. A context switch only needs a local flush, so call
leon_flush_tlb_all() directly.
This is based on "sparc32: retain mm_cpumask across TLB shootdowns" and
"sparc32: enroll and order CPUs before switching address spaces".
Fixes: 8401707ff645 ("sparc,leon: Sparc-Leon SMP support")
Signed-off-by: Magnus Lindholm <linmag7@xxxxxxxxx>
---
arch/sparc/mm/leon_mm.c | 3 ++-
arch/sparc/mm/srmmu.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/sparc/mm/leon_mm.c b/arch/sparc/mm/leon_mm.c
index a43c5ffbbbe5..c19eb23b62e2 100644
--- a/arch/sparc/mm/leon_mm.c
+++ b/arch/sparc/mm/leon_mm.c
@@ -264,7 +264,8 @@ int __init leon_flush_needed(void)
void leon_switch_mm(void)
{
- flush_tlb_mm((void *)0);
+ /* Context switches are local; mapping changes use the SMP wrappers. */
+ leon_flush_tlb_all();
if (leon_flush_during_switch)
leon_flush_cache_all();
}
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 145a63a5fda9..fb95865d7ddd 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -1746,7 +1746,8 @@ void __init load_mmu(void)
/* El switcheroo... */
local_ops = sparc32_cachetlb_ops;
- if (sparc_cpu_model == sun4d || sparc_cpu_model == sparc_leon) {
+ /* sun4d supplies its own SMP TLB operations. */
+ if (sparc_cpu_model == sun4d) {
smp_cachetlb_ops.tlb_all = local_ops->tlb_all;
smp_cachetlb_ops.tlb_mm = local_ops->tlb_mm;
smp_cachetlb_ops.tlb_range = local_ops->tlb_range;
--
2.43.0