linux/arch
Maciej W. Rozycki 19f3ace949 MIPS: mm: Prevent a TLB shutdown on initial uniquification
commit 9f048fa487 upstream.

Depending on the particular CPU implementation a TLB shutdown may occur
if multiple matching entries are detected upon the execution of a TLBP
or the TLBWI/TLBWR instructions.  Given that we don't know what entries
we have been handed we need to be very careful with the initial TLB
setup and avoid all these instructions.

Therefore read all the TLB entries one by one with the TLBR instruction,
bypassing the content addressing logic, and truncate any large pages in
place so as to avoid a case in the second step where an incoming entry
for a large page at a lower address overlaps with a replacement entry
chosen at another index.  Then preinitialize the TLB using addresses
outside our usual unique range and avoiding clashes with any entries
received, before making the usual call to local_flush_tlb_all().

This fixes (at least) R4x00 cores if TLBP hits multiple matching TLB
entries (SGI IP22 PROM for examples sets up all TLBs to the same virtual
address).

Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Fixes: 35ad7e1815 ("MIPS: mm: tlb-r4k: Uniquify TLB entries on init")
Cc: stable@vger.kernel.org
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Tested-by: Jiaxun Yang <jiaxun.yang@flygoat.com> # Boston I6400, M5150 sim
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-12-07 06:09:34 +09:00
..
alpha sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
arc arc: Fix __fls() const-foldability via __builtin_clzl() 2025-12-07 06:09:16 +09:00
arm lib/crypto: arm/curve25519: Disable on CPU_BIG_ENDIAN 2025-12-07 06:09:29 +09:00
arm64 arm64: errata: Apply workarounds for Neoverse-V3AE 2025-10-29 14:03:13 +01:00
csky sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
h8300 sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
hexagon sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
ia64 sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
m68k m68k: bitops: Fix find_*_bit() signatures 2025-10-29 14:03:10 +01:00
microblaze sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
mips MIPS: mm: Prevent a TLB shutdown on initial uniquification 2025-12-07 06:09:34 +09:00
nds32 sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
nios2 nios2: ensure that memblock.current_limit is set when setting pfn limits 2025-10-29 14:03:10 +01:00
openrisc sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
parisc arch: back to -std=gnu89 in < v5.18 2025-12-07 06:09:15 +09:00
powerpc powerpc/eeh: Use result of error_detected() in uevent 2025-12-07 06:09:19 +09:00
riscv RISC-V: clear hot-unplugged cores from all task mm_cpumasks to avoid rfence errors 2025-12-07 06:09:27 +09:00
s390 Makefile.compiler: replace cc-ifversion with compiler-specific macros 2025-12-07 06:09:32 +09:00
sh sh: Do not use hyphen in exported variable name 2025-08-28 16:24:11 +02:00
sparc sparc/module: Add R_SPARC_UA64 relocation handling 2025-12-07 06:09:23 +09:00
um um: Fix help message for ssl-non-raw 2025-12-07 06:09:24 +09:00
x86 Revert "perf/x86: Always store regs->ip in perf_callchain_kernel()" 2025-12-07 06:09:34 +09:00
xtensa sched: Add wrapper for get_wchan() to keep task blocked 2025-08-28 16:24:03 +02:00
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
Kconfig cpu: Re-enable CPU mitigations by default for !X86 architectures 2024-05-02 16:24:48 +02:00