blob: 9e1c1aef9ebd64ff4a83c660172e6d94d1c58cc5 [file] [log] [blame]
Thomas Gleixnercaab2772019-06-03 07:44:50 +02001// SPDX-License-Identifier: GPL-2.0-only
Andre Przywarae116a372014-11-14 15:54:09 +00002/*
3 * Contains CPU specific errata definitions
4 *
5 * Copyright (C) 2014 ARM Ltd.
Andre Przywarae116a372014-11-14 15:54:09 +00006 */
7
Arnd Bergmann94a5d872018-06-05 13:50:07 +02008#include <linux/arm-smccc.h>
Andre Przywarae116a372014-11-14 15:54:09 +00009#include <linux/types.h>
Josh Poimboeufa111b7c2019-04-12 15:39:32 -050010#include <linux/cpu.h>
Andre Przywarae116a372014-11-14 15:54:09 +000011#include <asm/cpu.h>
12#include <asm/cputype.h>
13#include <asm/cpufeature.h>
Mark Brown4db61fe2020-02-18 19:58:39 +000014#include <asm/kvm_asm.h>
Marc Zyngier93916be2019-04-09 16:26:21 +010015#include <asm/smp_plat.h>
Andre Przywarae116a372014-11-14 15:54:09 +000016
Andre Przywara301bcfa2014-11-14 15:54:10 +000017static bool __maybe_unused
Suzuki K Poulose92406f02016-04-22 12:25:31 +010018is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope)
Andre Przywara301bcfa2014-11-14 15:54:10 +000019{
Ard Biesheuvele8002e02018-03-06 17:15:34 +000020 const struct arm64_midr_revidr *fix;
21 u32 midr = read_cpuid_id(), revidr;
22
Suzuki K Poulose92406f02016-04-22 12:25:31 +010023 WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
Suzuki K Poulose1df31052018-03-26 15:12:44 +010024 if (!is_midr_in_range(midr, &entry->midr_range))
Ard Biesheuvele8002e02018-03-06 17:15:34 +000025 return false;
26
27 midr &= MIDR_REVISION_MASK | MIDR_VARIANT_MASK;
28 revidr = read_cpuid(REVIDR_EL1);
29 for (fix = entry->fixed_revs; fix && fix->revidr_mask; fix++)
30 if (midr == fix->midr_rv && (revidr & fix->revidr_mask))
31 return false;
32
33 return true;
Andre Przywara301bcfa2014-11-14 15:54:10 +000034}
35
Stephen Boydbb487112017-12-13 14:19:37 -080036static bool __maybe_unused
Suzuki K Poulosebe5b2992018-03-26 15:12:45 +010037is_affected_midr_range_list(const struct arm64_cpu_capabilities *entry,
38 int scope)
39{
40 WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
41 return is_midr_in_range_list(read_cpuid_id(), entry->midr_range_list);
Andre Przywara301bcfa2014-11-14 15:54:10 +000042}
43
Stephen Boydbb487112017-12-13 14:19:37 -080044static bool __maybe_unused
45is_kryo_midr(const struct arm64_cpu_capabilities *entry, int scope)
46{
47 u32 model;
48
49 WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
50
51 model = read_cpuid_id();
52 model &= MIDR_IMPLEMENTOR_MASK | (0xf00 << MIDR_PARTNUM_SHIFT) |
53 MIDR_ARCHITECTURE_MASK;
54
Suzuki K Poulose1df31052018-03-26 15:12:44 +010055 return model == entry->midr_range.model;
Stephen Boydbb487112017-12-13 14:19:37 -080056}
57
Suzuki K Poulose116c81f2016-09-09 14:07:16 +010058static bool
Suzuki K Poulose314d53d2018-07-04 23:07:46 +010059has_mismatched_cache_type(const struct arm64_cpu_capabilities *entry,
60 int scope)
Suzuki K Poulose116c81f2016-09-09 14:07:16 +010061{
Suzuki K Poulose1602df02018-10-09 14:47:06 +010062 u64 mask = arm64_ftr_reg_ctrel0.strict_mask;
63 u64 sys = arm64_ftr_reg_ctrel0.sys_val & mask;
64 u64 ctr_raw, ctr_real;
Suzuki K Poulose314d53d2018-07-04 23:07:46 +010065
Suzuki K Poulose116c81f2016-09-09 14:07:16 +010066 WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
Suzuki K Poulose1602df02018-10-09 14:47:06 +010067
68 /*
69 * We want to make sure that all the CPUs in the system expose
70 * a consistent CTR_EL0 to make sure that applications behaves
71 * correctly with migration.
72 *
73 * If a CPU has CTR_EL0.IDC but does not advertise it via CTR_EL0 :
74 *
75 * 1) It is safe if the system doesn't support IDC, as CPU anyway
76 * reports IDC = 0, consistent with the rest.
77 *
78 * 2) If the system has IDC, it is still safe as we trap CTR_EL0
79 * access on this CPU via the ARM64_HAS_CACHE_IDC capability.
80 *
81 * So, we need to make sure either the raw CTR_EL0 or the effective
82 * CTR_EL0 matches the system's copy to allow a secondary CPU to boot.
83 */
84 ctr_raw = read_cpuid_cachetype() & mask;
85 ctr_real = read_cpuid_effective_cachetype() & mask;
86
87 return (ctr_real != sys) && (ctr_raw != sys);
Suzuki K Poulose116c81f2016-09-09 14:07:16 +010088}
89
Dave Martinc0cda3b2018-03-26 15:12:28 +010090static void
James Morse05460842019-10-17 18:42:58 +010091cpu_enable_trap_ctr_access(const struct arm64_cpu_capabilities *cap)
Suzuki K Poulose116c81f2016-09-09 14:07:16 +010092{
Suzuki K Poulose4afe8e72018-10-09 14:47:07 +010093 u64 mask = arm64_ftr_reg_ctrel0.strict_mask;
James Morse05460842019-10-17 18:42:58 +010094 bool enable_uct_trap = false;
Suzuki K Poulose4afe8e72018-10-09 14:47:07 +010095
96 /* Trap CTR_EL0 access on this CPU, only if it has a mismatch */
97 if ((read_cpuid_cachetype() & mask) !=
98 (arm64_ftr_reg_ctrel0.sys_val & mask))
James Morse05460842019-10-17 18:42:58 +010099 enable_uct_trap = true;
100
101 /* ... or if the system is affected by an erratum */
102 if (cap->capability == ARM64_WORKAROUND_1542419)
103 enable_uct_trap = true;
104
105 if (enable_uct_trap)
Suzuki K Poulose4afe8e72018-10-09 14:47:07 +0100106 sysreg_clear_set(sctlr_el1, SCTLR_EL1_UCT, 0);
Suzuki K Poulose116c81f2016-09-09 14:07:16 +0100107}
108
Will Deacon969f5ea2019-04-29 13:03:57 +0100109#ifdef CONFIG_ARM64_ERRATUM_1463225
Will Deacon969f5ea2019-04-29 13:03:57 +0100110static bool
111has_cortex_a76_erratum_1463225(const struct arm64_cpu_capabilities *entry,
112 int scope)
113{
Sai Prakash Ranjana9e821b2020-06-30 23:30:54 +0530114 return is_affected_midr_range_list(entry, scope) && is_kernel_in_hyp_mode();
Will Deacon969f5ea2019-04-29 13:03:57 +0100115}
116#endif
117
Will Deaconb8925ee2018-08-07 13:53:41 +0100118static void __maybe_unused
119cpu_enable_cache_maint_trap(const struct arm64_cpu_capabilities *__unused)
120{
121 sysreg_clear_set(sctlr_el1, SCTLR_EL1_UCI, 0);
122}
123
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100124#define CAP_MIDR_RANGE(model, v_min, r_min, v_max, r_max) \
125 .matches = is_affected_midr_range, \
Suzuki K Poulose1df31052018-03-26 15:12:44 +0100126 .midr_range = MIDR_RANGE(model, v_min, r_min, v_max, r_max)
Andre Przywara301bcfa2014-11-14 15:54:10 +0000127
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100128#define CAP_MIDR_ALL_VERSIONS(model) \
129 .matches = is_affected_midr_range, \
Suzuki K Poulose1df31052018-03-26 15:12:44 +0100130 .midr_range = MIDR_ALL_VERSIONS(model)
Marc Zyngier06f14942017-02-01 14:38:46 +0000131
Ard Biesheuvele8002e02018-03-06 17:15:34 +0000132#define MIDR_FIXED(rev, revidr_mask) \
133 .fixed_revs = (struct arm64_midr_revidr[]){{ (rev), (revidr_mask) }, {}}
134
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100135#define ERRATA_MIDR_RANGE(model, v_min, r_min, v_max, r_max) \
136 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, \
137 CAP_MIDR_RANGE(model, v_min, r_min, v_max, r_max)
138
Suzuki K Poulosebe5b2992018-03-26 15:12:45 +0100139#define CAP_MIDR_RANGE_LIST(list) \
140 .matches = is_affected_midr_range_list, \
141 .midr_range_list = list
142
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100143/* Errata affecting a range of revisions of given model variant */
144#define ERRATA_MIDR_REV_RANGE(m, var, r_min, r_max) \
145 ERRATA_MIDR_RANGE(m, var, r_min, var, r_max)
146
147/* Errata affecting a single variant/revision of a model */
148#define ERRATA_MIDR_REV(model, var, rev) \
149 ERRATA_MIDR_RANGE(model, var, rev, var, rev)
150
151/* Errata affecting all variants/revisions of a given a model */
152#define ERRATA_MIDR_ALL_VERSIONS(model) \
153 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, \
154 CAP_MIDR_ALL_VERSIONS(model)
155
Suzuki K Poulosebe5b2992018-03-26 15:12:45 +0100156/* Errata affecting a list of midr ranges, with same work around */
157#define ERRATA_MIDR_RANGE_LIST(midr_list) \
158 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, \
159 CAP_MIDR_RANGE_LIST(midr_list)
160
Marc Zyngier93916be2019-04-09 16:26:21 +0100161static const __maybe_unused struct midr_range tx2_family_cpus[] = {
162 MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
163 MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
164 {},
165};
166
167static bool __maybe_unused
168needs_tx2_tvm_workaround(const struct arm64_cpu_capabilities *entry,
169 int scope)
170{
171 int i;
172
173 if (!is_affected_midr_range_list(entry, scope) ||
174 !is_hyp_mode_available())
175 return false;
176
177 for_each_possible_cpu(i) {
178 if (MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 0) != 0)
179 return true;
180 }
181
182 return false;
183}
184
James Morse05460842019-10-17 18:42:58 +0100185static bool __maybe_unused
186has_neoverse_n1_erratum_1542419(const struct arm64_cpu_capabilities *entry,
187 int scope)
188{
189 u32 midr = read_cpuid_id();
190 bool has_dic = read_cpuid_cachetype() & BIT(CTR_DIC_SHIFT);
191 const struct midr_range range = MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1);
Marc Zyngier8892b712018-04-10 11:36:43 +0100192
James Morse05460842019-10-17 18:42:58 +0100193 WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
194 return is_midr_in_range(midr, &range) && has_dic;
195}
196
Catalin Marinasce8c80c2018-11-19 11:27:28 +0000197#ifdef CONFIG_ARM64_WORKAROUND_REPEAT_TLBI
Bjorn Andersson36c602d2019-10-29 16:27:38 -0700198static const struct arm64_cpu_capabilities arm64_repeat_tlbi_list[] = {
Catalin Marinasce8c80c2018-11-19 11:27:28 +0000199#ifdef CONFIG_QCOM_FALKOR_ERRATUM_1009
Bjorn Andersson36c602d2019-10-29 16:27:38 -0700200 {
201 ERRATA_MIDR_REV(MIDR_QCOM_FALKOR_V1, 0, 0)
202 },
203 {
204 .midr_range.model = MIDR_QCOM_KRYO,
205 .matches = is_kryo_midr,
206 },
Catalin Marinasce8c80c2018-11-19 11:27:28 +0000207#endif
208#ifdef CONFIG_ARM64_ERRATUM_1286807
Bjorn Andersson36c602d2019-10-29 16:27:38 -0700209 {
210 ERRATA_MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 0),
211 },
Catalin Marinasce8c80c2018-11-19 11:27:28 +0000212#endif
213 {},
214};
Catalin Marinasce8c80c2018-11-19 11:27:28 +0000215#endif
216
Suzuki K Poulosef58cdf72018-11-30 17:18:01 +0000217#ifdef CONFIG_CAVIUM_ERRATUM_27456
Will Deaconb89d82e2019-01-08 16:19:01 +0000218const struct midr_range cavium_erratum_27456_cpus[] = {
Suzuki K Poulosef58cdf72018-11-30 17:18:01 +0000219 /* Cavium ThunderX, T88 pass 1.x - 2.1 */
220 MIDR_RANGE(MIDR_THUNDERX, 0, 0, 1, 1),
221 /* Cavium ThunderX, T81 pass 1.0 */
222 MIDR_REV(MIDR_THUNDERX_81XX, 0, 0),
223 {},
224};
225#endif
226
227#ifdef CONFIG_CAVIUM_ERRATUM_30115
228static const struct midr_range cavium_erratum_30115_cpus[] = {
229 /* Cavium ThunderX, T88 pass 1.x - 2.2 */
230 MIDR_RANGE(MIDR_THUNDERX, 0, 0, 1, 2),
231 /* Cavium ThunderX, T81 pass 1.0 - 1.2 */
232 MIDR_REV_RANGE(MIDR_THUNDERX_81XX, 0, 0, 2),
233 /* Cavium ThunderX, T83 pass 1.0 */
234 MIDR_REV(MIDR_THUNDERX_83XX, 0, 0),
235 {},
236};
237#endif
238
Suzuki K Poulosea3dcea2c2018-11-30 17:18:02 +0000239#ifdef CONFIG_QCOM_FALKOR_ERRATUM_1003
240static const struct arm64_cpu_capabilities qcom_erratum_1003_list[] = {
241 {
242 ERRATA_MIDR_REV(MIDR_QCOM_FALKOR_V1, 0, 0),
243 },
244 {
245 .midr_range.model = MIDR_QCOM_KRYO,
246 .matches = is_kryo_midr,
247 },
248 {},
249};
250#endif
251
Suzuki K Poulosec9460dc2018-11-30 17:18:00 +0000252#ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE
253static const struct midr_range workaround_clean_cache[] = {
Andre Przywarac0a01b82014-11-14 15:54:12 +0000254#if defined(CONFIG_ARM64_ERRATUM_826319) || \
255 defined(CONFIG_ARM64_ERRATUM_827319) || \
256 defined(CONFIG_ARM64_ERRATUM_824069)
Suzuki K Poulosec9460dc2018-11-30 17:18:00 +0000257 /* Cortex-A53 r0p[012]: ARM errata 826319, 827319, 824069 */
258 MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 2),
Andre Przywarac0a01b82014-11-14 15:54:12 +0000259#endif
Suzuki K Poulosec9460dc2018-11-30 17:18:00 +0000260#ifdef CONFIG_ARM64_ERRATUM_819472
261 /* Cortex-A53 r0p[01] : ARM errata 819472 */
262 MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 1),
263#endif
264 {},
265};
266#endif
267
Marc Zyngiera5325082019-05-23 11:24:50 +0100268#ifdef CONFIG_ARM64_ERRATUM_1418040
269/*
270 * - 1188873 affects r0p0 to r2p0
271 * - 1418040 affects r0p0 to r3p1
272 */
273static const struct midr_range erratum_1418040_list[] = {
274 /* Cortex-A76 r0p0 to r3p1 */
275 MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 1),
276 /* Neoverse-N1 r0p0 to r3p1 */
277 MIDR_RANGE(MIDR_NEOVERSE_N1, 0, 0, 3, 1),
Sai Prakash Ranjana9e821b2020-06-30 23:30:54 +0530278 /* Kryo4xx Gold (rcpe to rfpf) => (r0p0 to r3p1) */
279 MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xf),
Marc Zyngier69893032019-04-15 13:03:54 +0100280 {},
281};
282#endif
283
Doug Bergerbfc97f92019-10-31 14:47:23 -0700284#ifdef CONFIG_ARM64_ERRATUM_845719
285static const struct midr_range erratum_845719_list[] = {
286 /* Cortex-A53 r0p[01234] */
287 MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4),
288 /* Brahma-B53 r0p[0] */
289 MIDR_REV(MIDR_BRAHMA_B53, 0, 0),
Konrad Dybcio23c21642020-11-05 00:22:13 +0100290 /* Kryo2XX Silver rAp4 */
291 MIDR_REV(MIDR_QCOM_KRYO_2XX_SILVER, 0xa, 0x4),
Doug Bergerbfc97f92019-10-31 14:47:23 -0700292 {},
293};
294#endif
295
Florian Fainelli1cf45b82019-10-31 14:47:25 -0700296#ifdef CONFIG_ARM64_ERRATUM_843419
297static const struct arm64_cpu_capabilities erratum_843419_list[] = {
298 {
299 /* Cortex-A53 r0p[01234] */
300 .matches = is_affected_midr_range,
301 ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A53, 0, 0, 4),
302 MIDR_FIXED(0x4, BIT(8)),
303 },
304 {
305 /* Brahma-B53 r0p[0] */
306 .matches = is_affected_midr_range,
307 ERRATA_MIDR_REV(MIDR_BRAHMA_B53, 0, 0),
308 },
309 {},
310};
311#endif
312
Andrew Scull02ab1f52020-05-04 10:48:58 +0100313#ifdef CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT
314static const struct midr_range erratum_speculative_at_list[] = {
Steven Pricee85d68f2019-12-16 11:56:29 +0000315#ifdef CONFIG_ARM64_ERRATUM_1165522
316 /* Cortex A76 r0p0 to r2p0 */
317 MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 2, 0),
318#endif
Andrew Scull02ab1f52020-05-04 10:48:58 +0100319#ifdef CONFIG_ARM64_ERRATUM_1319367
320 MIDR_ALL_VERSIONS(MIDR_CORTEX_A57),
321 MIDR_ALL_VERSIONS(MIDR_CORTEX_A72),
322#endif
Steven Price275fa0e2019-12-16 11:56:31 +0000323#ifdef CONFIG_ARM64_ERRATUM_1530923
324 /* Cortex A55 r0p0 to r2p0 */
325 MIDR_RANGE(MIDR_CORTEX_A55, 0, 0, 2, 0),
Sai Prakash Ranjan9b23d952020-06-30 23:30:55 +0530326 /* Kryo4xx Silver (rdpe => r1p0) */
327 MIDR_REV(MIDR_QCOM_KRYO_4XX_SILVER, 0xd, 0xe),
Steven Price275fa0e2019-12-16 11:56:31 +0000328#endif
Steven Pricee85d68f2019-12-16 11:56:29 +0000329 {},
330};
331#endif
332
Sai Prakash Ranjana9e821b2020-06-30 23:30:54 +0530333#ifdef CONFIG_ARM64_ERRATUM_1463225
334static const struct midr_range erratum_1463225[] = {
335 /* Cortex-A76 r0p0 - r3p1 */
336 MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 1),
337 /* Kryo4xx Gold (rcpe to rfpf) => (r0p0 to r3p1) */
338 MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xf),
Florian Fainelli09c717c2020-07-08 22:13:40 -0700339 {},
Sai Prakash Ranjana9e821b2020-06-30 23:30:54 +0530340};
341#endif
342
Suzuki K Pouloseb9d216f2021-10-19 17:31:40 +0100343#ifdef CONFIG_ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
344static const struct midr_range trbe_overwrite_fill_mode_cpus[] = {
345#ifdef CONFIG_ARM64_ERRATUM_2139208
346 MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2),
347#endif
348#ifdef CONFIG_ARM64_ERRATUM_2119858
349 MIDR_ALL_VERSIONS(MIDR_CORTEX_A710),
350#endif
351 {},
352};
353#endif /* CONFIG_ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE */
354
Suzuki K Poulosefa82d0b2021-10-19 17:31:41 +0100355#ifdef CONFIG_ARM64_WORKAROUND_TSB_FLUSH_FAILURE
356static const struct midr_range tsb_flush_fail_cpus[] = {
357#ifdef CONFIG_ARM64_ERRATUM_2067961
358 MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2),
359#endif
360#ifdef CONFIG_ARM64_ERRATUM_2054223
361 MIDR_ALL_VERSIONS(MIDR_CORTEX_A710),
362#endif
363 {},
364};
365#endif /* CONFIG_ARM64_WORKAROUND_TSB_FLUSH_FAILURE */
366
Suzuki K Poulose8d81b2a2021-10-19 17:31:42 +0100367#ifdef CONFIG_ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
368static struct midr_range trbe_write_out_of_range_cpus[] = {
369#ifdef CONFIG_ARM64_ERRATUM_2253138
370 MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N2),
371#endif
372#ifdef CONFIG_ARM64_ERRATUM_2224489
373 MIDR_ALL_VERSIONS(MIDR_CORTEX_A710),
374#endif
375 {},
376};
377#endif /* CONFIG_ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE */
378
Suzuki K Poulosec9460dc2018-11-30 17:18:00 +0000379const struct arm64_cpu_capabilities arm64_errata[] = {
380#ifdef CONFIG_ARM64_WORKAROUND_CLEAN_CACHE
Andre Przywarac0a01b82014-11-14 15:54:12 +0000381 {
Geert Uytterhoeven357dd8a2020-05-12 16:52:55 +0200382 .desc = "ARM errata 826319, 827319, 824069, or 819472",
Andre Przywarac0a01b82014-11-14 15:54:12 +0000383 .capability = ARM64_WORKAROUND_CLEAN_CACHE,
Suzuki K Poulosec9460dc2018-11-30 17:18:00 +0000384 ERRATA_MIDR_RANGE_LIST(workaround_clean_cache),
Dave Martinc0cda3b2018-03-26 15:12:28 +0100385 .cpu_enable = cpu_enable_cache_maint_trap,
Andre Przywarac0a01b82014-11-14 15:54:12 +0000386 },
387#endif
388#ifdef CONFIG_ARM64_ERRATUM_832075
Andre Przywara301bcfa2014-11-14 15:54:10 +0000389 {
Andre Przywara5afaa1f2014-11-14 15:54:11 +0000390 /* Cortex-A57 r0p0 - r1p2 */
391 .desc = "ARM erratum 832075",
392 .capability = ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100393 ERRATA_MIDR_RANGE(MIDR_CORTEX_A57,
394 0, 0,
395 1, 2),
Andre Przywara5afaa1f2014-11-14 15:54:11 +0000396 },
Andre Przywarac0a01b82014-11-14 15:54:12 +0000397#endif
Marc Zyngier498cd5c2015-11-16 10:28:18 +0000398#ifdef CONFIG_ARM64_ERRATUM_834220
399 {
400 /* Cortex-A57 r0p0 - r1p2 */
401 .desc = "ARM erratum 834220",
402 .capability = ARM64_WORKAROUND_834220,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100403 ERRATA_MIDR_RANGE(MIDR_CORTEX_A57,
404 0, 0,
405 1, 2),
Marc Zyngier498cd5c2015-11-16 10:28:18 +0000406 },
407#endif
Ard Biesheuvelca79acc2018-03-06 17:15:35 +0000408#ifdef CONFIG_ARM64_ERRATUM_843419
409 {
Ard Biesheuvelca79acc2018-03-06 17:15:35 +0000410 .desc = "ARM erratum 843419",
411 .capability = ARM64_WORKAROUND_843419,
Florian Fainelli1cf45b82019-10-31 14:47:25 -0700412 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
413 .matches = cpucap_multi_entry_cap_matches,
414 .match_list = erratum_843419_list,
Will Deacon905e8c52015-03-23 19:07:02 +0000415 },
Robert Richter6d4e11c2015-09-21 22:58:35 +0200416#endif
417#ifdef CONFIG_ARM64_ERRATUM_845719
418 {
Andre Przywarae116a372014-11-14 15:54:09 +0000419 .desc = "ARM erratum 845719",
420 .capability = ARM64_WORKAROUND_845719,
Doug Bergerbfc97f92019-10-31 14:47:23 -0700421 ERRATA_MIDR_RANGE_LIST(erratum_845719_list),
Marc Zyngier359b7062015-03-27 13:09:23 +0000422 },
Andre Przywarae116a372014-11-14 15:54:09 +0000423#endif
Robert Richter6d4e11c2015-09-21 22:58:35 +0200424#ifdef CONFIG_CAVIUM_ERRATUM_23154
425 {
426 /* Cavium ThunderX, pass 1.x */
427 .desc = "Cavium erratum 23154",
428 .capability = ARM64_WORKAROUND_CAVIUM_23154,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100429 ERRATA_MIDR_REV_RANGE(MIDR_THUNDERX, 0, 0, 1),
Robert Richter6d4e11c2015-09-21 22:58:35 +0200430 },
431#endif
Andrew Pinski104a0c02016-02-24 17:44:57 -0800432#ifdef CONFIG_CAVIUM_ERRATUM_27456
433 {
Andrew Pinski104a0c02016-02-24 17:44:57 -0800434 .desc = "Cavium erratum 27456",
435 .capability = ARM64_WORKAROUND_CAVIUM_27456,
Suzuki K Poulosef58cdf72018-11-30 17:18:01 +0000436 ERRATA_MIDR_RANGE_LIST(cavium_erratum_27456_cpus),
Ganapatrao Kulkarni47c459b2016-07-07 10:18:17 +0530437 },
Andrew Pinski104a0c02016-02-24 17:44:57 -0800438#endif
David Daney690a3412017-06-09 12:49:48 +0100439#ifdef CONFIG_CAVIUM_ERRATUM_30115
440 {
David Daney690a3412017-06-09 12:49:48 +0100441 .desc = "Cavium erratum 30115",
442 .capability = ARM64_WORKAROUND_CAVIUM_30115,
Suzuki K Poulosef58cdf72018-11-30 17:18:01 +0000443 ERRATA_MIDR_RANGE_LIST(cavium_erratum_30115_cpus),
David Daney690a3412017-06-09 12:49:48 +0100444 },
445#endif
Andre Przywarae116a372014-11-14 15:54:09 +0000446 {
Will Deacon880f7cc2018-09-19 11:41:21 +0100447 .desc = "Mismatched cache type (CTR_EL0)",
Suzuki K Poulose314d53d2018-07-04 23:07:46 +0100448 .capability = ARM64_MISMATCHED_CACHE_TYPE,
449 .matches = has_mismatched_cache_type,
Suzuki K Poulose5b4747c2018-03-26 15:12:32 +0100450 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
Dave Martinc0cda3b2018-03-26 15:12:28 +0100451 .cpu_enable = cpu_enable_trap_ctr_access,
Suzuki K Poulose116c81f2016-09-09 14:07:16 +0100452 },
Christopher Covington38fd94b2017-02-08 15:08:37 -0500453#ifdef CONFIG_QCOM_FALKOR_ERRATUM_1003
454 {
Suzuki K Poulosea3dcea2c2018-11-30 17:18:02 +0000455 .desc = "Qualcomm Technologies Falkor/Kryo erratum 1003",
Christopher Covington38fd94b2017-02-08 15:08:37 -0500456 .capability = ARM64_WORKAROUND_QCOM_FALKOR_E1003,
Bjorn Anderssond4af3c42019-10-29 10:15:39 -0700457 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
Will Deacon1e013d02018-12-12 15:53:54 +0000458 .matches = cpucap_multi_entry_cap_matches,
Suzuki K Poulosea3dcea2c2018-11-30 17:18:02 +0000459 .match_list = qcom_erratum_1003_list,
Stephen Boydbb487112017-12-13 14:19:37 -0800460 },
Christopher Covington38fd94b2017-02-08 15:08:37 -0500461#endif
Catalin Marinasce8c80c2018-11-19 11:27:28 +0000462#ifdef CONFIG_ARM64_WORKAROUND_REPEAT_TLBI
Christopher Covingtond9ff80f2017-01-31 12:50:19 -0500463 {
Geert Uytterhoeven357dd8a2020-05-12 16:52:55 +0200464 .desc = "Qualcomm erratum 1009, or ARM erratum 1286807",
Christopher Covingtond9ff80f2017-01-31 12:50:19 -0500465 .capability = ARM64_WORKAROUND_REPEAT_TLBI,
Bjorn Andersson36c602d2019-10-29 16:27:38 -0700466 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
467 .matches = cpucap_multi_entry_cap_matches,
468 .match_list = arm64_repeat_tlbi_list,
Christopher Covingtond9ff80f2017-01-31 12:50:19 -0500469 },
470#endif
Marc Zyngiereeb1efb2017-03-20 17:18:06 +0000471#ifdef CONFIG_ARM64_ERRATUM_858921
472 {
473 /* Cortex-A73 all versions */
474 .desc = "ARM erratum 858921",
475 .capability = ARM64_WORKAROUND_858921,
Suzuki K Poulose5e7951c2018-03-26 15:12:43 +0100476 ERRATA_MIDR_ALL_VERSIONS(MIDR_CORTEX_A73),
Marc Zyngiereeb1efb2017-03-20 17:18:06 +0000477 },
478#endif
Will Deaconaa6acde2018-01-03 12:46:21 +0000479 {
Will Deacond4647f02020-09-15 23:30:17 +0100480 .desc = "Spectre-v2",
Will Deacon688f1e42020-09-15 23:00:31 +0100481 .capability = ARM64_SPECTRE_V2,
Marc Zyngier73f38162019-04-15 16:21:23 -0500482 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
Will Deacond4647f02020-09-15 23:30:17 +0100483 .matches = has_spectre_v2,
484 .cpu_enable = spectre_v2_enable_mitigation,
Jayachandran Cf3d795d2018-01-19 04:22:47 -0800485 },
David Brazdila59a2ed2020-07-21 10:44:45 +0100486#ifdef CONFIG_RANDOMIZE_BASE
Marc Zyngier4b472ff2018-02-15 11:49:20 +0000487 {
Will Deaconb881cdc2020-11-13 11:38:44 +0000488 /* Must come after the Spectre-v2 entry */
Will Deaconc4792b62020-11-13 11:38:45 +0000489 .desc = "Spectre-v3a",
490 .capability = ARM64_SPECTRE_V3A,
Will Deaconcd1f56b2020-11-13 11:38:46 +0000491 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
492 .matches = has_spectre_v3a,
Will Deaconc4792b62020-11-13 11:38:45 +0000493 .cpu_enable = spectre_v3a_enable_mitigation,
Marc Zyngier4b472ff2018-02-15 11:49:20 +0000494 },
495#endif
Marc Zyngiera725e3d2018-05-29 13:11:08 +0100496 {
Will Deaconc2876202020-09-18 11:54:33 +0100497 .desc = "Spectre-v4",
Will Deacon9b0955b2020-09-15 23:00:31 +0100498 .capability = ARM64_SPECTRE_V4,
Marc Zyngiera725e3d2018-05-29 13:11:08 +0100499 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
Will Deaconc2876202020-09-18 11:54:33 +0100500 .matches = has_spectre_v4,
501 .cpu_enable = spectre_v4_enable_mitigation,
Marc Zyngiera725e3d2018-05-29 13:11:08 +0100502 },
Marc Zyngiera5325082019-05-23 11:24:50 +0100503#ifdef CONFIG_ARM64_ERRATUM_1418040
Marc Zyngier95b861a42018-09-27 17:15:34 +0100504 {
Marc Zyngiera5325082019-05-23 11:24:50 +0100505 .desc = "ARM erratum 1418040",
506 .capability = ARM64_WORKAROUND_1418040,
507 ERRATA_MIDR_RANGE_LIST(erratum_1418040_list),
Marc Zyngiered888cb2020-09-11 19:16:11 +0100508 /*
509 * We need to allow affected CPUs to come in late, but
510 * also need the non-affected CPUs to be able to come
511 * in at any point in time. Wonderful.
512 */
513 .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE,
Marc Zyngier95b861a42018-09-27 17:15:34 +0100514 },
515#endif
Andrew Scull02ab1f52020-05-04 10:48:58 +0100516#ifdef CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT
Marc Zyngier8b2cca92018-12-06 17:31:23 +0000517 {
Will Deaconc3507172020-05-28 18:02:51 +0100518 .desc = "ARM errata 1165522, 1319367, or 1530923",
Andrew Scull02ab1f52020-05-04 10:48:58 +0100519 .capability = ARM64_WORKAROUND_SPECULATIVE_AT,
520 ERRATA_MIDR_RANGE_LIST(erratum_speculative_at_list),
Marc Zyngier8b2cca92018-12-06 17:31:23 +0000521 },
522#endif
Will Deacon969f5ea2019-04-29 13:03:57 +0100523#ifdef CONFIG_ARM64_ERRATUM_1463225
524 {
525 .desc = "ARM erratum 1463225",
526 .capability = ARM64_WORKAROUND_1463225,
527 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
528 .matches = has_cortex_a76_erratum_1463225,
Sai Prakash Ranjana9e821b2020-06-30 23:30:54 +0530529 .midr_range_list = erratum_1463225,
Will Deacon969f5ea2019-04-29 13:03:57 +0100530 },
531#endif
Marc Zyngier93916be2019-04-09 16:26:21 +0100532#ifdef CONFIG_CAVIUM_TX2_ERRATUM_219
533 {
534 .desc = "Cavium ThunderX2 erratum 219 (KVM guest sysreg trapping)",
535 .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_TVM,
536 ERRATA_MIDR_RANGE_LIST(tx2_family_cpus),
537 .matches = needs_tx2_tvm_workaround,
538 },
Marc Zyngier94054472019-04-09 16:22:24 +0100539 {
540 .desc = "Cavium ThunderX2 erratum 219 (PRFM removal)",
541 .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM,
542 ERRATA_MIDR_RANGE_LIST(tx2_family_cpus),
543 },
Marc Zyngier93916be2019-04-09 16:26:21 +0100544#endif
James Morse05460842019-10-17 18:42:58 +0100545#ifdef CONFIG_ARM64_ERRATUM_1542419
546 {
547 /* we depend on the firmware portion for correctness */
548 .desc = "ARM erratum 1542419 (kernel portion)",
549 .capability = ARM64_WORKAROUND_1542419,
550 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
551 .matches = has_neoverse_n1_erratum_1542419,
552 .cpu_enable = cpu_enable_trap_ctr_access,
553 },
554#endif
Rob Herring96d389ca2020-10-28 13:28:39 -0500555#ifdef CONFIG_ARM64_ERRATUM_1508412
556 {
557 /* we depend on the firmware portion for correctness */
558 .desc = "ARM erratum 1508412 (kernel portion)",
559 .capability = ARM64_WORKAROUND_1508412,
560 ERRATA_MIDR_RANGE(MIDR_CORTEX_A77,
561 0, 0,
562 1, 0),
563 },
564#endif
Rich Wiley20109a82021-03-23 17:28:09 -0700565#ifdef CONFIG_NVIDIA_CARMEL_CNP_ERRATUM
566 {
567 /* NVIDIA Carmel */
568 .desc = "NVIDIA Carmel CNP erratum",
569 .capability = ARM64_WORKAROUND_NVIDIA_CARMEL_CNP,
570 ERRATA_MIDR_ALL_VERSIONS(MIDR_NVIDIA_CARMEL),
571 },
572#endif
Suzuki K Pouloseb9d216f2021-10-19 17:31:40 +0100573#ifdef CONFIG_ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE
574 {
575 /*
576 * The erratum work around is handled within the TRBE
577 * driver and can be applied per-cpu. So, we can allow
578 * a late CPU to come online with this erratum.
579 */
580 .desc = "ARM erratum 2119858 or 2139208",
581 .capability = ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE,
582 .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE,
583 CAP_MIDR_RANGE_LIST(trbe_overwrite_fill_mode_cpus),
584 },
585#endif
Suzuki K Poulosefa82d0b2021-10-19 17:31:41 +0100586#ifdef CONFIG_ARM64_WORKAROUND_TSB_FLUSH_FAILURE
587 {
588 .desc = "ARM erratum 2067961 or 2054223",
589 .capability = ARM64_WORKAROUND_TSB_FLUSH_FAILURE,
590 ERRATA_MIDR_RANGE_LIST(tsb_flush_fail_cpus),
591 },
592#endif
Suzuki K Poulose8d81b2a2021-10-19 17:31:42 +0100593#ifdef CONFIG_ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
594 {
595 .desc = "ARM erratum 2253138 or 2224489",
596 .capability = ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE,
597 .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE,
598 CAP_MIDR_RANGE_LIST(trbe_write_out_of_range_cpus),
599 },
600#endif
Suzuki K Poulose116c81f2016-09-09 14:07:16 +0100601 {
Andre Przywarae116a372014-11-14 15:54:09 +0000602 }
603};