Skip to content

Commit 905a653

Browse files
committed
Merge tag 'mips-fixes_5.18_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Pull MIPS fix from Thomas Bogendoerfer: "Extend R4000/R4400 CPU erratum workaround to all revisions" * tag 'mips-fixes_5.18_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: MIPS: Fix CP0 counter erratum detection for R4k CPUs
2 parents 68533eb + f0a6c68 commit 905a653

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

arch/mips/include/asm/timex.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
typedef unsigned int cycles_t;
4141

4242
/*
43-
* On R4000/R4400 before version 5.0 an erratum exists such that if the
44-
* cycle counter is read in the exact moment that it is matching the
45-
* compare register, no interrupt will be generated.
43+
* On R4000/R4400 an erratum exists such that if the cycle counter is
44+
* read in the exact moment that it is matching the compare register,
45+
* no interrupt will be generated.
4646
*
4747
* There is a suggested workaround and also the erratum can't strike if
4848
* the compare interrupt isn't being used as the clock source device.
@@ -63,7 +63,7 @@ static inline int can_use_mips_counter(unsigned int prid)
6363
if (!__builtin_constant_p(cpu_has_counter))
6464
asm volatile("" : "=m" (cpu_data[0].options));
6565
if (likely(cpu_has_counter &&
66-
prid >= (PRID_IMP_R4000 | PRID_REV_ENCODE_44(5, 0))))
66+
prid > (PRID_IMP_R4000 | PRID_REV_ENCODE_44(15, 15))))
6767
return 1;
6868
else
6969
return 0;

arch/mips/kernel/time.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,10 @@ static __init int cpu_has_mfc0_count_bug(void)
141141
case CPU_R4400MC:
142142
/*
143143
* The published errata for the R4400 up to 3.0 say the CPU
144-
* has the mfc0 from count bug.
144+
* has the mfc0 from count bug. This seems the last version
145+
* produced.
145146
*/
146-
if ((current_cpu_data.processor_id & 0xff) <= 0x30)
147-
return 1;
148-
149-
/*
150-
* we assume newer revisions are ok
151-
*/
152-
return 0;
147+
return 1;
153148
}
154149

155150
return 0;

0 commit comments

Comments
 (0)