cpu_errata.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Contains CPU specific errata definitions
  3. *
  4. * Copyright (C) 2014 ARM Ltd.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include <linux/types.h>
  19. #include <asm/cpu.h>
  20. #include <asm/cputype.h>
  21. #include <asm/cpufeature.h>
  22. static bool __maybe_unused
  23. is_affected_midr_range(const struct arm64_cpu_capabilities *entry)
  24. {
  25. return MIDR_IS_CPU_MODEL_RANGE(read_cpuid_id(), entry->midr_model,
  26. entry->midr_range_min,
  27. entry->midr_range_max);
  28. }
  29. #define MIDR_RANGE(model, min, max) \
  30. .matches = is_affected_midr_range, \
  31. .midr_model = model, \
  32. .midr_range_min = min, \
  33. .midr_range_max = max
  34. const struct arm64_cpu_capabilities arm64_errata[] = {
  35. #if defined(CONFIG_ARM64_ERRATUM_826319) || \
  36. defined(CONFIG_ARM64_ERRATUM_827319) || \
  37. defined(CONFIG_ARM64_ERRATUM_824069)
  38. {
  39. /* Cortex-A53 r0p[012] */
  40. .desc = "ARM errata 826319, 827319, 824069",
  41. .capability = ARM64_WORKAROUND_CLEAN_CACHE,
  42. MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x02),
  43. },
  44. #endif
  45. #ifdef CONFIG_ARM64_ERRATUM_819472
  46. {
  47. /* Cortex-A53 r0p[01] */
  48. .desc = "ARM errata 819472",
  49. .capability = ARM64_WORKAROUND_CLEAN_CACHE,
  50. MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x01),
  51. },
  52. #endif
  53. #ifdef CONFIG_ARM64_ERRATUM_832075
  54. {
  55. /* Cortex-A57 r0p0 - r1p2 */
  56. .desc = "ARM erratum 832075",
  57. .capability = ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE,
  58. MIDR_RANGE(MIDR_CORTEX_A57, 0x00,
  59. (1 << MIDR_VARIANT_SHIFT) | 2),
  60. },
  61. #endif
  62. #ifdef CONFIG_ARM64_ERRATUM_834220
  63. {
  64. /* Cortex-A57 r0p0 - r1p2 */
  65. .desc = "ARM erratum 834220",
  66. .capability = ARM64_WORKAROUND_834220,
  67. MIDR_RANGE(MIDR_CORTEX_A57, 0x00,
  68. (1 << MIDR_VARIANT_SHIFT) | 2),
  69. },
  70. #endif
  71. #ifdef CONFIG_ARM64_ERRATUM_845719
  72. {
  73. /* Cortex-A53 r0p[01234] */
  74. .desc = "ARM erratum 845719",
  75. .capability = ARM64_WORKAROUND_845719,
  76. MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x04),
  77. },
  78. #endif
  79. #ifdef CONFIG_CAVIUM_ERRATUM_23154
  80. {
  81. /* Cavium ThunderX, pass 1.x */
  82. .desc = "Cavium erratum 23154",
  83. .capability = ARM64_WORKAROUND_CAVIUM_23154,
  84. MIDR_RANGE(MIDR_THUNDERX, 0x00, 0x01),
  85. },
  86. #endif
  87. #ifdef CONFIG_CAVIUM_ERRATUM_27456
  88. {
  89. /* Cavium ThunderX, T88 pass 1.x - 2.1 */
  90. .desc = "Cavium erratum 27456",
  91. .capability = ARM64_WORKAROUND_CAVIUM_27456,
  92. MIDR_RANGE(MIDR_THUNDERX, 0x00,
  93. (1 << MIDR_VARIANT_SHIFT) | 1),
  94. },
  95. #endif
  96. {
  97. }
  98. };
  99. void check_local_cpu_errata(void)
  100. {
  101. update_cpu_capabilities(arm64_errata, "enabling workaround for");
  102. }