WSL2-Linux-Kernel/arch/mips
Maciej W. Rozycki f9a1dbc8b8 MIPS: Fix CP0 counter erratum detection for R4k CPUs
commit f0a6c68f69 upstream.

Fix the discrepancy between the two places we check for the CP0 counter
erratum in along with the incorrect comparison of the R4400 revision
number against 0x30 which matches none and consistently consider all
R4000 and R4400 processors affected, as documented in processor errata
publications[1][2][3], following the mapping between CP0 PRId register
values and processor models:

  PRId   |  Processor Model
---------+--------------------
00000422 | R4000 Revision 2.2
00000430 | R4000 Revision 3.0
00000440 | R4400 Revision 1.0
00000450 | R4400 Revision 2.0
00000460 | R4400 Revision 3.0

No other revision of either processor has ever been spotted.

Contrary to what has been stated in commit ce202cbb9e ("[MIPS] Assume
R4000/R4400 newer than 3.0 don't have the mfc0 count bug") marking the
CP0 counter as buggy does not preclude it from being used as either a
clock event or a clock source device.  It just cannot be used as both at
a time, because in that case clock event interrupts will be occasionally
lost, and the use as a clock event device takes precedence.

Compare against 0x4ff in `can_use_mips_counter' so that a single machine
instruction is produced.

References:

[1] "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0", MIPS
    Technologies Inc., May 10, 1994, Erratum 53, p.13

[2] "MIPS R4400PC/SC Errata, Processor Revision 1.0", MIPS Technologies
    Inc., February 9, 1994, Erratum 21, p.4

[3] "MIPS R4400PC/SC Errata, Processor Revision 2.0 & 3.0", MIPS
    Technologies Inc., January 24, 1995, Erratum 14, p.3

Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Fixes: ce202cbb9e ("[MIPS] Assume R4000/R4400 newer than 3.0 don't have the mfc0 count bug")
Cc: stable@vger.kernel.org # v2.6.24+
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-12 12:30:00 +02:00
..
alchemy
ar7
ath25
ath79
bcm47xx
bcm63xx mips: bcm63xx: add support for clk_set_parent() 2022-01-27 11:04:18 +01:00
bmips
boot MIPS: ingenic: correct unit node address 2022-04-13 20:59:09 +02:00
cavium-octeon MIPS: octeon: Fix missed PTR->PTR_WD conversion 2022-02-16 12:56:40 +01:00
cobalt
configs Documentation, arch: Remove leftovers from CIFS_WEAK_PW_HASH 2022-01-27 11:05:21 +01:00
crypto
dec mips: DEC: honor CONFIG_MIPS_FP_SUPPORT=n 2022-04-08 14:23:38 +02:00
fw
generic MIPS: generic/yamon-dt: fix uninitialized variable error 2021-11-25 09:48:36 +01:00
include MIPS: Fix CP0 counter erratum detection for R4k CPUs 2022-05-12 12:30:00 +02:00
ingenic
jazz
kernel MIPS: Fix CP0 counter erratum detection for R4k CPUs 2022-05-12 12:30:00 +02:00
kvm ARM: 2021-09-07 13:40:51 -07:00
lantiq mips: lantiq: add support for clk_set_parent() 2022-01-27 11:04:17 +01:00
lib MIPS: Fix build error due to PTR used in more places 2022-02-16 12:56:16 +01:00
loongson2ef
loongson32
loongson64 PCI/sysfs: Find shadow ROM before static attribute initialization 2022-02-01 17:27:05 +01:00
math-emu
mm MIPS: Sanitise Cavium switch cases in TLB handler synthesizers 2022-04-08 14:23:38 +02:00
mti-malta
n64
net bpf, mips: Validate conditional branch offsets 2021-09-15 21:38:16 +02:00
netlogic
pci
pic32
power
ralink mips: ralink: fix a refcount leak in ill_acc_of_setup() 2022-04-13 20:59:07 +02:00
rb532 MIPS: RB532: fix return value of __setup handler 2022-04-08 14:23:39 +02:00
sgi-ip22
sgi-ip27
sgi-ip30
sgi-ip32
sibyte
sni MIPS: sni: Fix the build 2021-11-25 09:48:28 +01:00
tools
txx9
vdso
vr41xx
Kbuild
Kbuild.platforms MIPS: fix duplicated slashes for Platform file path 2021-11-18 19:17:14 +01:00
Kconfig mips: fix Kconfig reference to PHYS_ADDR_T_64BIT 2022-01-27 11:04:13 +01:00
Kconfig.debug
Makefile MIPS: fix *-pkg builds for loongson2ef platform 2021-11-18 19:17:14 +01:00
Makefile.postlink