[PATCH 0/2] sparc64: D-cache alias flushing fixes

From: Imre Kaloz

Date: Sun Sep 27 2026 - 06:57:41 EST


Two fixes to D-cache alias flushing on sparc64 CPUs with a virtually
indexed L1 D-cache.

Patch 1 makes move_pte() and tlb_batch_add() flush only the page a PTE
maps, instead of every page of its folio once per PTE, so the number
of cross-calls for an mremap() of a large folio no longer grows with
the square of its size.

Patch 2 implements flush_cache_vmap() and flush_cache_vunmap(), which
have been no-ops on sparc64. Stale lines left by a vmalloc mapping
corrupt BPF programs and module data on UltraSPARC III. It uses
flush_dcache_page_all() as patch 1 restores it.

Both patches are tagged for stable. Tested on a Sun Ultra 45.

Imre Kaloz (2):
sparc64: flush only the aliased page, not its whole folio
sparc64: flush vmalloc ranges from the D-cache on map and unmap

arch/sparc/include/asm/cacheflush_64.h | 9 ++--
arch/sparc/include/asm/pgtable_64.h | 7 ++-
arch/sparc/kernel/smp_64.c | 42 ++++++++++++-----
arch/sparc/mm/init_64.c | 64 ++++++++++++++++++++++++++
arch/sparc/mm/tlb.c | 2 +-
arch/sparc/mm/ultra.S | 25 ++++++++++
6 files changed, 131 insertions(+), 18 deletions(-)


base-commit: fe2ec83746e501645709761605c2464a44fd2929
--
2.47.3