Extend R4000/R4400 CPU erratum workaround to all revisions

-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCAA4FiEEbt46xwy6kEcDOXoUeZbBVTGwZHAFAmJzuqcaHHRzYm9nZW5k
 QGFscGhhLmZyYW5rZW4uZGUACgkQeZbBVTGwZHAkhBAAlg6wkfx1OdtCxC3iERqF
 pNh4OWpvGc/N3aTj8cnEl5XnyZo9cIKdt+HU1ayr46dFbCJQW5t/hEYjre5Dm9xO
 9+9mRpoB/y4xpTAJCT+ffNPwtp3wK/w3HCG+DAKFAzI5S0Bz3LOg8x098IfgqrcO
 xVt/Kc15V+dxGstUSvvJjUmlxzIbN0BceGk//MRIm/dTo2Uu/Np3NjII5CUkNHvw
 jM2sXV146lpfM1LqEYkwnplgWWSIs/BKsG1Lzztb6WSanT3w2Dg+v7KdDVksysRb
 zKuRFx/xMkGmIgblM9fIc+E3ya2MmbMP1a8jLNOlqyQQ450Z7IVGcltlxzGk9XDO
 n9HhlWuY7quK1Bl/pQIHfdx5zUk0wad+KiiI83kahupD3MaiCcubV8gnHbF1rqT8
 r5qzWkj2h7JQMVFg26r8dsExbOQs6/h7ddPEiUs+AQmwrcaAkleJwaqQguUQmDq/
 GJT1wuTpHJrNcLJA/HB1vXwlhDbNQlUe5s5BX5fG1XUxOborEupirNqbdvFAEnm4
 0/wEUgVhCaap8yqskcuLtgbNk3iheCDqU6X2GHEhctVFQ11zG2/Oz8STkC2FFm+e
 GFFVisz8Kx+uVzjs6NGd/0Pugm6uXfCQAxhenuFCE20AefTFvAIsesfexezxRkVF
 55DoLKGkrbVQzq/uKpgoGLU=
 =vhRB
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2022-05-05 10:27:30 -07:00
Родитель 68533eb1fb f0a6c68f69
Коммит 905a6537e7
2 изменённых файлов: 7 добавлений и 12 удалений

Просмотреть файл

@ -40,9 +40,9 @@
typedef unsigned int cycles_t;
/*
* On R4000/R4400 before version 5.0 an erratum exists such that if the
* cycle counter is read in the exact moment that it is matching the
* compare register, no interrupt will be generated.
* On R4000/R4400 an erratum exists such that if the cycle counter is
* read in the exact moment that it is matching the compare register,
* no interrupt will be generated.
*
* There is a suggested workaround and also the erratum can't strike if
* 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)
if (!__builtin_constant_p(cpu_has_counter))
asm volatile("" : "=m" (cpu_data[0].options));
if (likely(cpu_has_counter &&
prid >= (PRID_IMP_R4000 | PRID_REV_ENCODE_44(5, 0))))
prid > (PRID_IMP_R4000 | PRID_REV_ENCODE_44(15, 15))))
return 1;
else
return 0;

Просмотреть файл

@ -141,15 +141,10 @@ static __init int cpu_has_mfc0_count_bug(void)
case CPU_R4400MC:
/*
* The published errata for the R4400 up to 3.0 say the CPU
* has the mfc0 from count bug.
* has the mfc0 from count bug. This seems the last version
* produced.
*/
if ((current_cpu_data.processor_id & 0xff) <= 0x30)
return 1;
/*
* we assume newer revisions are ok
*/
return 0;
return 1;
}
return 0;