1
0
Fork 0
alistair23-linux/arch/mips
Hauke Mehrtens 032343ed69 MIPS: Add missing EHB in mtc0 -> mfc0 sequence for DSPen
commit fcec538ef8 upstream.

This resolves the hazard between the mtc0 in the change_c0_status() and
the mfc0 in configure_exception_vector(). Without resolving this hazard
configure_exception_vector() could read an old value and would restore
this old value again. This would revert the changes change_c0_status()
did. I checked this by printing out the read_c0_status() at the end of
per_cpu_trap_init() and the ST0_MX is not set without this patch.

The hazard is documented in the MIPS Architecture Reference Manual Vol.
III: MIPS32/microMIPS32 Privileged Resource Architecture (MD00088), rev
6.03 table 8.1 which includes:

   Producer | Consumer | Hazard
  ----------|----------|----------------------------
   mtc0     | mfc0     | any coprocessor 0 register

I saw this hazard on an Atheros AR9344 rev 2 SoC with a MIPS 74Kc CPU.
There the change_c0_status() function would activate the DSPen by
setting ST0_MX in the c0_status register. This was reverted and then the
system got a DSP exception when the DSP registers were saved in
save_dsp() in the first process switch. The crash looks like this:

[    0.089999] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.097796] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.107070] Kernel panic - not syncing: Unexpected DSP exception
[    0.113470] Rebooting in 1 seconds..

We saw this problem in OpenWrt only on the MIPS 74Kc based Atheros SoCs,
not on the 24Kc based SoCs. We only saw it with kernel 5.4 not with
kernel 4.19, in addition we had to use GCC 8.4 or 9.X, with GCC 8.3 it
did not happen.

In the kernel I bisected this problem to commit 9012d01166 ("compiler:
allow all arches to enable CONFIG_OPTIMIZE_INLINING"), but when this was
reverted it also happened after commit 172dcd935c ("MIPS: Always
allocate exception vector for MIPSr2+").

Commit 0b24cae4d5 ("MIPS: Add missing EHB in mtc0 -> mfc0 sequence.")
does similar changes to a different file. I am not sure if there are
more places affected by this problem.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-09 09:37:56 +02:00
..
alchemy treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 182 2019-05-30 11:29:20 -07:00
ar7 The main MIPS changes for a pretty light v5.3 cycle, including: 2019-07-17 09:42:03 -07:00
ath25 PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
ath79 The main MIPS changes for a pretty light v5.3 cycle, including: 2019-07-17 09:42:03 -07:00
bcm47xx MIPS: BCM47XX: Add support for Netgear R6200 V1 2019-07-25 22:10:05 -07:00
bcm63xx MIPS: bmips: mark exception vectors as char arrays 2019-10-23 21:07:28 -07:00
bmips docs: arm: convert docs to ReST and rename to *.rst 2019-07-15 09:20:24 -03:00
boot MIPS: Truncate link address into 32bit for 32bit kernel 2020-06-22 09:31:03 +02:00
cavium-octeon MIPS: OCTEON: irq: Fix potential NULL pointer dereference 2020-04-17 10:50:12 +02:00
cobalt treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 1 2019-05-21 11:28:39 +02:00
configs MIPS: Loongson: Build ATI Radeon GPU driver as module 2020-06-22 09:30:54 +02:00
crypto MIPS: crypto: Add crc32 and crc32c hw accelerated module 2018-02-19 20:50:36 +00:00
dec treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
emma treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
fw MIPS: fw: sni: Fix out of bounds init of o32 stack 2019-10-09 12:47:28 -07:00
generic treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
include mips: MAAR: Use more precise address mask 2020-06-22 09:31:07 +02:00
jazz dma-mapping: explicitly wire up ->mmap and ->get_sgtable 2019-09-04 11:13:18 +02:00
jz4740 Merge branch 'ingenic-tcu-v5.4' into mips-next 2019-08-08 15:33:16 -07:00
kernel MIPS: Add missing EHB in mtc0 -> mfc0 sequence for DSPen 2020-07-09 09:37:56 +02:00
kvm Bugfixes (arm and x86) and cleanups. 2019-08-09 15:46:29 -07:00
lantiq MIPS: lantiq: xway: sysctrl: fix the GPHY clock alias names 2020-07-09 09:37:56 +02:00
lasat treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 182 2019-05-30 11:29:20 -07:00
lib treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 504 2019-06-19 17:09:56 +02:00
loongson32 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
loongson64 MIPS: Loongson: Fix potential NULL dereference in loongson3_platform_init() 2020-02-24 08:36:27 +01:00
math-emu treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 454 2019-06-19 17:09:09 +02:00
mm MIPS/tlbex: Fix LDDIR usage in setup_pw() for Loongson-3 2020-04-17 10:50:12 +02:00
mti-malta MIPS: malta: Drop prom_free_prom_memory 2019-08-23 14:47:13 +01:00
net bpf, mips: Limit to 33 tail calls 2020-01-12 12:21:24 +01:00
netlogic MIPS: xlp: Drop boot_mem_map 2019-08-23 14:47:21 +01:00
oprofile MIPS: OProfile: Mark expected switch fall-throughs 2019-07-30 09:40:17 -07:00
paravirt mips: unify prom_putchar() declarations 2018-07-17 09:40:17 -07:00
pci MIPS: PCI: remember nasid changed by set interrupt affinity 2020-01-17 19:48:54 +01:00
pic32 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 445 2019-06-05 17:37:18 +02:00
pistachio A batch of MIPS fixes: 2019-06-08 13:09:31 -07:00
pmcs-msp71xx MIPS: pmcs-msp71xx: Remove unused addr variable 2019-10-03 15:47:17 -07:00
pnx833x A batch of MIPS fixes: 2019-06-08 13:09:31 -07:00
power treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 305 2019-06-05 17:37:04 +02:00
ralink MIPS: ralink: enable PCI support only if driver for mt7621 SoC is selected 2019-12-31 16:45:29 +01:00
rb532 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 182 2019-05-30 11:29:20 -07:00
sgi-ip22 MIPS: ip22: Drop addr_is_ram 2019-08-23 14:47:18 +01:00
sgi-ip27 MIPS: SGI-IP27: Fix crash, when CPUs are disabled via nr_cpus parameter 2020-01-17 19:48:55 +01:00
sgi-ip32 Merge branch 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2019-07-08 21:48:15 -07:00
sibyte treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
sni treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 210 2019-05-30 11:29:53 -07:00
tools MIPS: tools: Fix resource leak in elf-entry.c 2020-06-22 09:31:08 +02:00
txx9 A batch of MIPS fixes: 2019-06-08 13:09:31 -07:00
vdso mips: Fix gettimeofday() in the vdso library 2020-01-17 19:49:04 +01:00
vr41xx treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
Kbuild treewide: Add SPDX license identifier - Kbuild 2019-05-30 11:32:33 -07:00
Kbuild.platforms treewide: Add SPDX license identifier - Kbuild 2019-05-30 11:32:33 -07:00
Kconfig MIPS: BPF: eBPF JIT: check for MIPS ISA compliance in Kconfig 2020-01-09 10:19:56 +01:00
Kconfig.debug Kconfig: consolidate the "Kernel hacking" menu 2018-08-02 08:06:48 +09:00
Makefile MIPS: Truncate link address into 32bit for 32bit kernel 2020-06-22 09:31:03 +02:00
Makefile.postlink MIPS: fix indentation of the 'RELOCS' message 2020-02-11 04:35:16 -08:00