linux_dsm_epyc7002/arch/mips
Paul Burton b42aa3fd59
MIPS: tlbex: Fix build_restore_pagemask KScratch restore
build_restore_pagemask() will restore the value of register $1/$at when
its restore_scratch argument is non-zero, and aims to do so by filling a
branch delay slot. Commit 0b24cae4d5 ("MIPS: Add missing EHB in mtc0
-> mfc0 sequence.") added an EHB instruction (Execution Hazard Barrier)
prior to restoring $1 from a KScratch register, in order to resolve a
hazard that can result in stale values of the KScratch register being
observed. In particular, P-class CPUs from MIPS with out of order
execution pipelines such as the P5600 & P6600 are affected.

Unfortunately this EHB instruction was inserted in the branch delay slot
causing the MFC0 instruction which performs the restoration to no longer
execute along with the branch. The result is that the $1 register isn't
actually restored, ie. the TLB refill exception handler clobbers it -
which is exactly the problem the EHB is meant to avoid for the P-class
CPUs.

Similarly build_get_pgd_vmalloc() will restore the value of $1/$at when
its mode argument equals refill_scratch, and suffers from the same
problem.

Fix this by in both cases moving the EHB earlier in the emitted code.
There's no reason it needs to immediately precede the MFC0 - it simply
needs to be between the MTC0 & MFC0.

This bug only affects Cavium Octeon systems which use
build_fast_tlb_refill_handler().

Signed-off-by: Paul Burton <paulburton@kernel.org>
Fixes: 0b24cae4d5 ("MIPS: Add missing EHB in mtc0 -> mfc0 sequence.")
Cc: Dmitry Korotin <dkorotin@wavecomp.com>
Cc: stable@vger.kernel.org # v3.15+
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
2019-10-23 21:12:49 -07:00
..
alchemy
ar7
ath25
ath79
bcm47xx
bcm63xx MIPS: bmips: mark exception vectors as char arrays 2019-10-23 21:07:28 -07:00
bmips
boot MIPS: dts: ar9331: fix interrupt-controller size 2019-09-30 15:22:35 -07:00
cavium-octeon Main MIPS changes for v5.4: 2019-09-22 09:30:30 -07:00
cobalt
configs USB: rio500: Remove Rio 500 kernel driver 2019-10-04 10:53:36 +02:00
crypto
dec
emma
fw MIPS: fw: sni: Fix out of bounds init of o32 stack 2019-10-09 12:47:28 -07:00
generic
include MIPS: bmips: mark exception vectors as char arrays 2019-10-23 21:07:28 -07:00
jazz
jz4740
kernel MIPS: bmips: mark exception vectors as char arrays 2019-10-23 21:07:28 -07:00
kvm
lantiq
lasat
lib
loongson32
loongson64 MIPS: Disable Loongson MMI instructions for kernel build 2019-10-10 11:58:52 -07:00
math-emu
mm MIPS: tlbex: Fix build_restore_pagemask KScratch restore 2019-10-23 21:12:49 -07:00
mti-malta
net
netlogic
oprofile
paravirt
pci Main MIPS changes for v5.4: 2019-09-22 09:30:30 -07:00
pic32
pistachio
pmcs-msp71xx MIPS: pmcs-msp71xx: Remove unused addr variable 2019-10-03 15:47:17 -07:00
pnx833x
power
ralink
rb532
sgi-ip22
sgi-ip27
sgi-ip32
sibyte
sni
tools
txx9
vdso MIPS: Disable Loongson MMI instructions for kernel build 2019-10-10 11:58:52 -07:00
vr41xx
Kbuild
Kbuild.platforms
Kconfig mips: use generic mmap top-down layout and brk randomization 2019-09-24 15:54:12 -07:00
Kconfig.debug
Makefile
Makefile.postlink