linux-stable/arch/mips/kernel
Maciej W. Rozycki f0a6c68f69 MIPS: Fix CP0 counter erratum detection for R4k CPUs
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>
2022-04-29 15:52:00 +02:00
..
syscalls arch: syscalls: simplify uapi/kapi directory creation 2022-03-31 12:03:46 +09:00
.gitignore
access-helper.h MIPS: Fix new sparse warnings 2021-04-07 16:11:05 +02:00
asm-offsets.c sched,arch: Remove unused TASK_STATE offsets 2021-06-18 11:43:09 +02:00
bmips_5xxx_init.S
bmips_vec.S
branch.c MIPS: kernel: include probes-common.h header in branch.c 2020-09-21 22:14:24 +02:00
cacheinfo.c drivers: base: cacheinfo: Get rid of DEFINE_SMP_CALL_CACHE_FUNCTION() 2021-09-01 10:29:10 +02:00
cevt-bcm1480.c
cevt-ds1287.c
cevt-gt641xx.c
cevt-r4k.c MIPS: Remove KVM_GUEST support 2021-03-10 15:18:40 +01:00
cevt-sb1250.c
cevt-txx9.c mips: kernel: convert comma to semicolon 2020-12-28 22:32:28 +01:00
cmpxchg.c locking/atomic: mips: move to ARCH_ATOMIC 2021-05-26 13:20:51 +02:00
cps-vec-ns16550.S
cps-vec.S MIPS: CPS: don't create redundant .text.cps-vec section 2021-01-15 15:27:54 +01:00
cpu-probe.c MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
cpu-r3k-probe.c MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
crash.c
crash_dump.c MIPS: crash_dump.c: Simplify copy_oldmem_page() 2021-02-09 13:30:12 +01:00
csrc-bcm1480.c
csrc-ioasic.c
csrc-r4k.c
csrc-sb1250.c
early_printk.c
early_printk_8250.c
elf.c MIPS: Modernize READ_IMPLIES_EXEC 2022-02-23 13:08:30 +01:00
entry.S MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
fpu-probe.c MIPS: cpu-probe: move fpu probing/handling into its own file 2020-10-12 12:04:50 +02:00
fpu-probe.h MIPS: cpu-probe: move fpu probing/handling into its own file 2020-10-12 12:04:50 +02:00
ftrace.c MIPS: kernel: Remove not needed set_fs calls 2021-04-06 14:36:56 +02:00
genex.S MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
gpio_txx9.c
head.S MIPS: of: Introduce helper function to get DTB 2021-02-04 13:34:51 +01:00
i8253.c
idle.c MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
irq-gt641xx.c
irq-msc01.c
irq.c MIPS: Only use current_stack_pointer on GCC 2022-03-14 15:02:53 +01:00
irq_txx9.c MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
jump_label.c
kgdb.c MIPS: kernel: Drop kgdb_call_nmi_hook 2021-02-15 12:23:54 +01:00
kprobes.c kprobes: treewide: Make it harder to refer kretprobe_trampoline directly 2021-09-30 21:24:06 -04:00
linux32.c
machine_kexec.c
Makefile MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mcount.S
mips-cm.c mips: cm: Convert to bitfield API to fix out-of-bounds access 2021-11-02 10:53:52 +01:00
mips-cpc.c MIPS: CPC: Use bitfield helpers 2021-11-29 12:42:57 +01:00
mips-mt-fpaff.c MIPS: Replace deprecated CPU-hotplug functions. 2021-08-05 10:57:01 +02:00
mips-mt.c
mips-r2-to-r6-emul.c MIPS: Fix build error due to PTR used in more places 2022-01-27 09:04:19 +01:00
module.c MIPS: module: optimize module relocations processing 2021-01-18 15:55:16 +01:00
octeon_switch.S
perf_event.c
perf_event_mipsxx.c MIPS: Remove NETLOGIC support 2021-10-24 17:24:47 +02:00
perf_regs.c MIPS: kernel: Support extracting off-line stack traces from user-space with perf 2021-02-04 21:55:45 +01:00
pm-cps.c
pm.c
probes-common.h
proc.c MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
process.c MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
prom.c MIPS: Remove redundant definitions of device_tree_init() 2022-03-14 15:09:02 +01:00
ptrace.c ptrace: Create ptrace_report_syscall_{entry,exit} in ptrace.h 2022-03-10 13:35:08 -06:00
ptrace32.c
r4k-bugs64.c MIPS: remove asm/war.h 2022-02-22 09:35:49 +01:00
r4k_fpu.S MIPS: Fix build error due to PTR used in more places 2022-01-27 09:04:19 +01:00
r4k_switch.S
r2300_fpu.S MIPS: Fix build error due to PTR used in more places 2022-01-27 09:04:19 +01:00
r2300_switch.S
relocate.c kernel.h: split out panic and oops helpers 2021-07-01 11:06:04 -07:00
relocate_kernel.S MIPS: Fix build error due to PTR used in more places 2022-01-27 09:04:19 +01:00
reset.c
rtlx-cmp.c
rtlx-mt.c
rtlx.c
scall32-o32.S MIPS: remove asm/war.h 2022-02-22 09:35:49 +01:00
scall64-n32.S MIPS: Fix build error due to PTR used in more places 2022-01-27 09:04:19 +01:00
scall64-n64.S MIPS: remove asm/war.h 2022-02-22 09:35:49 +01:00
scall64-o32.S MIPS: Fix build error due to PTR used in more places 2022-01-27 09:04:19 +01:00
segment.c
setup.c mips: setup: fix setnocoherentio() boolean setting 2022-02-22 09:35:02 +01:00
signal-common.h
signal.c ptrace: Cleanups for v5.18 2022-03-28 17:29:53 -07:00
signal32.c
signal_n32.c MIPS: remove asm/war.h 2022-02-22 09:35:49 +01:00
signal_o32.c
smp-bmips.c MIPS: BMIPS: Remove use of irq_cpu_offline 2021-10-20 20:06:32 +01:00
smp-cmp.c
smp-cps.c MIPS: No need to check CPU 0 in cps_cpu_disable() 2020-12-28 22:34:09 +01:00
smp-mt.c
smp-up.c
smp.c MIPS: smp: fill in sibling and core maps earlier 2022-02-16 20:48:10 +01:00
spinlock_test.c mips: kernel: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe() 2021-03-14 14:09:49 +01:00
spram.c
stacktrace.c
sync-r4k.c
syscall.c MIPS: Fix build error due to PTR used in more places 2022-01-27 09:04:19 +01:00
sysrq.c
time.c MIPS: Fix CP0 counter erratum detection for R4k CPUs 2022-04-29 15:52:00 +02:00
topology.c drivers/base/node: consolidate node device subsystem initialization in node_dev_init() 2022-03-22 15:57:10 -07:00
traps.c MIPS: fix fortify panic when copying asm exception handlers 2022-03-07 13:09:28 +01:00
unaligned.c MIPS: Handle address errors for accesses above CPU max virtual user address 2022-02-25 09:36:05 +01:00
uprobes.c MIPS: Fix fall-through warnings for Clang 2021-10-13 14:47:42 -05:00
vdso.c MIPS: Add support for CONFIG_DEBUG_VIRTUAL 2021-04-06 14:34:02 +02:00
vmlinux.lds.S MIPS: vmlinux.lds.S: Fix appended dtb not properly aligned 2021-03-16 22:53:08 +01:00
vpe-cmp.c mips: pci: convert comma to semicolon 2020-12-28 22:33:43 +01:00
vpe-mt.c mips: kernel: convert comma to semicolon 2020-12-28 22:32:28 +01:00
vpe.c MIPS: vpe: Remove vpe_getcwd 2021-01-27 21:49:16 +01:00
watch.c