mirror-linux/arch/mips/include/asm
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
..
dec DEC: Limit PMAX memory probing to R3k systems 2022-03-07 13:10:44 +01:00
fw
ip32
mach-ar7 mips: ar7: convert to CONFIG_COMMON_CLK 2021-06-08 17:00:09 +02:00
mach-ath25 MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-ath79 MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-au1x00 MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-bcm47xx MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-bcm63xx PCI: Add defines for normal and subtractive PCI bridges 2022-02-17 15:29:35 -06:00
mach-bmips MIPS: cleanup fixup_bigphys_addr handling 2020-04-19 16:09:44 +02:00
mach-cavium-octeon MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-cobalt MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-db1x00
mach-dec MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-generic MIPS: Remove KVM_GUEST support 2021-03-10 15:18:40 +01:00
mach-ingenic MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-ip22 MIPS: Remove mach-*/war.h 2020-09-07 22:25:27 +02:00
mach-ip27 MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-ip28 MIPS: SGI-IP28: disable use of ll/sc in kernel 2020-10-08 10:33:27 +02:00
mach-ip30 MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-ip32 MIPS: Remove mach-*/war.h 2020-09-07 22:25:27 +02:00
mach-jazz mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
mach-lantiq MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-loongson2ef MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-loongson32
mach-loongson64 MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-malta MIPS: malta: remove mach-malta/malta-dtshim.h header file 2020-09-21 22:16:47 +02:00
mach-n64 mips: Add N64 machine type 2021-01-22 11:40:00 +01:00
mach-pic32 MIPS: Add header files reference with path prefix 2020-03-19 13:12:27 +01:00
mach-ralink MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
mach-rc32434 MIPS: rb532: move GPIOD definition into C-files 2022-03-30 20:26:26 +02:00
mach-rm MIPS: Remove mach-*/war.h 2020-09-07 22:25:27 +02:00
mach-sibyte MIPS: Remove mach-*/war.h 2020-09-07 22:25:27 +02:00
mach-tx49xx MIPS: TXX9: Remove rbtx4939 board support 2022-01-02 14:10:40 +01:00
mach-vr41xx MIPS: Add header files reference with path prefix 2020-03-19 13:12:27 +01:00
mips-boards MIPS: launch.h: add include guard to prevent build errors 2021-05-25 15:18:59 +02:00
octeon MIPS: Octeon: Fix build errors using clang 2021-12-21 13:51:26 +01:00
pci
sgi MIPS: SGI-IP30: Move irq bits to better header files 2020-09-21 22:15:49 +02:00
sibyte MIPS: fix typo in a comment 2021-12-14 10:03:45 +01:00
sn MIPS: PCI: Add detection of IOC3 on IO7, IO8, IO9 and Fuel 2020-01-24 11:37:45 -08:00
txx9 MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
vdso MIPS: vdso: Invalid GIC access through VDSO 2021-07-09 15:29:06 +02:00
vr41xx
xtalk
Kbuild mips: syscalls: switch to generic syscalltbl.sh 2021-03-10 15:19:14 +01:00
abi.h
addrspace.h
amon.h
arch_hweight.h
asm-eva.h MIPS: Fix typo for user_ld macro definition 2020-04-16 17:30:16 +02:00
asm-offsets.h
asm-prototypes.h
asm.h MIPS: Fix build error due to PTR used in more places 2022-01-27 09:04:19 +01:00
asmmacro-32.h
asmmacro-64.h
asmmacro.h MIPS: fix local_irq_{disable,enable} in asmmacro.h 2021-03-24 10:48:55 +01:00
atomic.h MIPS: retire "asm/llsc.h" 2022-01-05 11:16:35 +01:00
barrier.h
bcache.h
bitops.h bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
bitrev.h
bmips-spaces.h
bmips.h
bootinfo.h MIPS: Ingenic: Add system type for new Ingenic SoCs. 2021-07-19 13:16:42 +02:00
branch.h MIPS: Fix the declaration conflict of mm_isBranchInstr() 2020-04-24 18:17:44 +02:00
break.h
bug.h
bugs.h
cache.h treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
cacheflush.h Add linux/cacheflush.h 2021-11-17 10:36:15 -05:00
cacheops.h MIPS: Rename the "Fill" cache ops to avoid build failure 2020-04-26 15:40:50 +02:00
cdmm.h
cevt-r4k.h
checksum.h MIPS: Fix inline asm input/output type mismatch in checksum.h used with Clang 2021-01-27 21:59:28 +01:00
clocksource.h mips: Introduce asm/vdso/clocksource.h 2020-03-21 15:23:55 +01:00
cmp.h
cmpxchg.h MIPS: retire "asm/llsc.h" 2022-01-05 11:16:35 +01:00
compat-signal.h
compat.h arch: remove compat_alloc_user_space 2021-09-08 15:32:35 -07:00
compiler.h MIPS: remove GCC < 4.9 support 2020-11-11 23:49:22 +01:00
cop2.h MIPS: Remove NETLOGIC support 2021-10-24 17:24:47 +02:00
cpu-features.h MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
cpu-info.h MIPS: emulate CPUCFG instruction on older Loongson64 cores 2020-05-24 09:26:55 +02:00
cpu-type.h MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
cpu.h MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
cpufeature.h
debug.h
delay.h
div64.h MIPS: Avoid handcoded DIVU in `__div64_32' altogether 2021-04-23 13:40:31 +02:00
dma-direct.h dma-direct: rename and cleanup __phys_to_dma 2020-09-11 09:14:43 +02:00
dma-mapping.h
dma.h
dmi.h MIPS: Add support for Desktop Management Interface (DMI) 2020-03-23 15:44:05 +01:00
ds1287.h
dsemul.h
dsp.h
edac.h
elf.h mips compat: switch to compat_binfmt_elf.c 2021-01-06 08:42:49 -05:00
elfcore-compat.h mips compat: switch to compat_binfmt_elf.c 2021-01-06 08:42:49 -05:00
errno.h
eva.h
exec.h
extable.h
fb.h
fixmap.h mips/mm/highmem: Switch to generic kmap atomic 2020-11-06 23:14:56 +01:00
floppy.h
fpregdef.h
fpu.h MIPS: Fix unreachable code issue 2021-07-13 15:08:15 -05:00
fpu_emulator.h MIPS: Fix the declaration conflict of mm_isBranchInstr() 2020-04-24 18:17:44 +02:00
ftrace.h MIPS: Fix build error due to PTR used in more places 2022-01-27 09:04:19 +01:00
futex.h MIPS: remove asm/war.h 2022-02-22 09:35:49 +01:00
ginvt.h MIPS: Avoid macro redefinitions 2021-09-23 11:23:35 +02:00
gio_device.h
gt64120.h
hardirq.h
hazards.h MIPS: Remove NETLOGIC support 2021-10-24 17:24:47 +02:00
highmem.h MIPS: Fix PKMAP with 32-bit MIPS huge page support 2021-06-30 14:41:32 +02:00
hpet.h
hugetlb.h hugetlb: clear huge pte during flush function on mips platform 2021-05-11 22:34:53 +02:00
hw_irq.h
i8259.h irqchip: Add driver for Loongson-3 HyperTransport PIC controller 2020-03-25 10:56:43 +01:00
ide.h
idle.h MIPS: idle: Add prototype for function check_wait 2020-09-27 13:00:45 +02:00
inst.h MIPS: Make definitions of MIPSInst_FMA_{FUNC,FMTM} consistent with MIPS64 manual 2021-01-22 11:45:52 +01:00
io.h mm: remove xlate_dev_kmem_ptr() 2021-05-07 00:26:34 -07:00
irq.h irqchip/mips: Fix RCU violation when using irqdomain lookup on interrupt entry 2021-07-09 10:18:58 +01:00
irq_cpu.h MIPS: Kill RM7K & RM9K IRQ Code 2021-01-04 11:37:27 +01:00
irq_gt641xx.h
irq_regs.h
irqflags.h mips: Implement arch_irqs_disabled() 2020-08-26 12:41:55 +02:00
isa-rev.h
isadep.h MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
jazz.h
jazzdma.h MIPS/jazzdma: remove the unused vdma_remap function 2020-09-11 08:13:49 +02:00
jump_label.h
kdebug.h
kexec.h
kgdb.h mips: kgdb: adjust the comment to the actual ifdef condition 2021-12-16 15:47:58 +01:00
kprobes.h
kvm_host.h RISCV: 2022-01-16 16:15:14 +02:00
kvm_types.h KVM: MIPS: Use common KVM implementation of MMU memory caches 2020-07-09 13:29:44 -04:00
linkage.h
local.h MIPS: Remove duplicated include in local.h 2022-01-09 15:40:18 +01:00
maar.h mips: MAAR: Add XPA mode support 2020-05-19 17:39:32 +02:00
machine.h treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
mc146818-time.h
mc146818rtc.h
mips-cm.h mips: cm: Convert to bitfield API to fix out-of-bounds access 2021-11-02 10:53:52 +01:00
mips-cpc.h
mips-cps.h MIPS: CPS: Use bitfield helpers 2021-11-29 12:43:06 +01:00
mips-gic.h
mips-r2-to-r6-emul.h
mips_mt.h
mipsmtregs.h MIPS: remove asm/war.h 2022-02-22 09:35:49 +01:00
mipsprom.h
mipsregs.h MIPS: remove asm/war.h 2022-02-22 09:35:49 +01:00
mmiowb.h
mmu.h
mmu_context.h mips: use asm-generic/mmu_context.h for no-op implementations 2020-10-27 16:02:36 +01:00
mmzone.h mm: replace CONFIG_NEED_MULTIPLE_NODES with CONFIG_NUMA 2021-06-29 10:53:55 -07:00
module.h mips: Add MIPS Warrior P5600 support 2020-05-22 09:10:53 +02:00
msa.h MIPS: Avoid macro redefinitions 2021-09-23 11:23:35 +02:00
msc01_ic.h
paccess.h
page.h mm: replace CONFIG_NEED_MULTIPLE_NODES with CONFIG_NUMA 2021-06-29 10:53:55 -07:00
pci.h MIPS: Only define pci_remap_iospace() for Ralink 2021-12-09 10:22:24 +01:00
perf_event.h
pgalloc.h MIPS: pgalloc: fix memory leak caused by pgd_free() 2022-03-14 15:05:18 +01:00
pgtable-32.h mm: define default value for FIRST_USER_ADDRESS 2021-07-01 11:06:02 -07:00
pgtable-64.h mm: rename p4d_page_vaddr to p4d_pgtable and make it return pud_t * 2021-07-08 11:48:22 -07:00
pgtable-bits.h MIPS: cpu-probe: Set Ingenic's writecombine to _CACHE_CACHABLE_WA 2020-09-18 16:26:36 +02:00
pgtable.h mips: Make pmd_pfn() available in all configurations 2022-03-21 12:59:02 -04:00
pm-cps.h
pm.h
prefetch.h
processor.h - added printing of CPU options for /proc/cpuinfo 2021-11-05 08:13:19 -07:00
prom.h MIPS: Fix wrong comments in asm/prom.h 2022-03-14 15:09:27 +01:00
ptrace.h Revert "MIPS: Add basic support for ptrace single step" 2021-02-18 11:57:44 +01:00
r4k-timer.h MIPS: Correct the header guard of r4k-timer.h 2020-09-18 15:29:00 +02:00
r4kcache.h MIPS: Fix build error due to PTR used in more places 2022-01-27 09:04:19 +01:00
reboot.h
reg.h
regdef.h
rtlx.h
seccomp.h seccomp: Use -1 marker for end of mode 1 syscall list 2020-07-10 16:01:52 -07:00
setup.h MIPS: fix fortify panic when copying asm exception handlers 2022-03-07 13:09:28 +01:00
sgialib.h
sgiarcs.h
shmparam.h
sigcontext.h
signal.h
sim.h
smp-cps.h
smp-ops.h MIPS: only register MT SMP ops if MT is supported 2021-12-21 13:51:39 +01:00
smp.h MIPS: arch_send_call_function_single_ipi() calling conventions change 2020-04-24 18:27:51 +02:00
sni.h MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
socket.h
sparsemem.h
spinlock.h locking/arch: Move qrwlock.h include after qspinlock.h 2021-02-11 07:59:54 -05:00
spinlock_types.h
spram.h MIPS: asm: spram: remove unneeded semicolon 2021-01-27 21:50:22 +01:00
stackframe.h MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
stackprotector.h
stacktrace.h
string.h
switch_to.h MIPS: context switch: Use save/restore instead of set/clear for Status.CU2 2020-09-21 22:14:47 +02:00
sync.h MIPS: cavium_octeon: Fix syncw generation. 2020-02-15 12:44:03 -08:00
syscall.h
termios.h
thread_info.h MIPS: Only use current_stack_pointer on GCC 2022-03-14 15:02:53 +01:00
time.h
timex.h MIPS: Fix CP0 counter erratum detection for R4k CPUs 2022-04-29 15:52:00 +02:00
tlb.h
tlbdebug.h
tlbex.h
tlbflush.h
tlbmisc.h
topology.h
traps.h MIPS: Allow modules to set board_be_handler 2021-11-09 16:07:26 +01:00
txx9irq.h MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
txx9pio.h
txx9tmr.h MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
types.h mips: Remove #include <uapi/asm/types.h> from <asm/types.h> 2020-11-11 23:45:46 +01:00
uaccess.h uaccess: generalize access_ok() 2022-02-25 09:36:05 +01:00
uasm.h mips, uasm: Add workaround for Loongson-2F nop CPU errata 2021-10-06 12:28:09 -07:00
unaligned-emul.h MIPS: Fix build error due to PTR used in more places 2022-01-27 09:04:19 +01:00
unistd.h mips: syscalls: define syscall offsets directly in <asm/unistd.h> 2021-06-01 11:17:24 +02:00
unroll.h treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
uprobes.h
vdso.h
vermagic.h MIPS: Remove TX39XX support 2022-03-01 10:07:22 +01:00
vga.h
vmalloc.h
vpe.h MIPS: vpe: Remove vpe_getcwd 2021-01-27 21:49:16 +01:00
watch.h
wbflush.h
yamon-dt.h