blob: e6bc988e8dbf0f69fc4b1a48f9a7b4a89ee713f3 [file] [log] [blame]
Andre Przywarae116a372014-11-14 15:54:09 +00001/*
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
Andre Przywarae116a372014-11-14 15:54:09 +000019#include <linux/types.h>
20#include <asm/cpu.h>
21#include <asm/cputype.h>
22#include <asm/cpufeature.h>
23
Andre Przywara301bcfa2014-11-14 15:54:10 +000024static bool __maybe_unused
Marc Zyngier359b7062015-03-27 13:09:23 +000025is_affected_midr_range(const struct arm64_cpu_capabilities *entry)
Andre Przywara301bcfa2014-11-14 15:54:10 +000026{
Will Deacond5370f72016-02-02 12:46:24 +000027 return MIDR_IS_CPU_MODEL_RANGE(read_cpuid_id(), entry->midr_model,
28 entry->midr_range_min,
29 entry->midr_range_max);
Andre Przywara301bcfa2014-11-14 15:54:10 +000030}
31
32#define MIDR_RANGE(model, min, max) \
Marc Zyngier359b7062015-03-27 13:09:23 +000033 .matches = is_affected_midr_range, \
Andre Przywara301bcfa2014-11-14 15:54:10 +000034 .midr_model = model, \
35 .midr_range_min = min, \
36 .midr_range_max = max
37
Marc Zyngier359b7062015-03-27 13:09:23 +000038const struct arm64_cpu_capabilities arm64_errata[] = {
Andre Przywarac0a01b82014-11-14 15:54:12 +000039#if defined(CONFIG_ARM64_ERRATUM_826319) || \
40 defined(CONFIG_ARM64_ERRATUM_827319) || \
41 defined(CONFIG_ARM64_ERRATUM_824069)
Andre Przywara301bcfa2014-11-14 15:54:10 +000042 {
43 /* Cortex-A53 r0p[012] */
44 .desc = "ARM errata 826319, 827319, 824069",
45 .capability = ARM64_WORKAROUND_CLEAN_CACHE,
46 MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x02),
47 },
Andre Przywarac0a01b82014-11-14 15:54:12 +000048#endif
49#ifdef CONFIG_ARM64_ERRATUM_819472
50 {
51 /* Cortex-A53 r0p[01] */
52 .desc = "ARM errata 819472",
53 .capability = ARM64_WORKAROUND_CLEAN_CACHE,
54 MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x01),
55 },
56#endif
57#ifdef CONFIG_ARM64_ERRATUM_832075
Andre Przywara301bcfa2014-11-14 15:54:10 +000058 {
Andre Przywara5afaa1f2014-11-14 15:54:11 +000059 /* Cortex-A57 r0p0 - r1p2 */
60 .desc = "ARM erratum 832075",
61 .capability = ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE,
Bo Yan6d1966d2015-03-31 21:30:48 +010062 MIDR_RANGE(MIDR_CORTEX_A57, 0x00,
63 (1 << MIDR_VARIANT_SHIFT) | 2),
Andre Przywara5afaa1f2014-11-14 15:54:11 +000064 },
Andre Przywarac0a01b82014-11-14 15:54:12 +000065#endif
Marc Zyngier498cd5c2015-11-16 10:28:18 +000066#ifdef CONFIG_ARM64_ERRATUM_834220
67 {
68 /* Cortex-A57 r0p0 - r1p2 */
69 .desc = "ARM erratum 834220",
70 .capability = ARM64_WORKAROUND_834220,
71 MIDR_RANGE(MIDR_CORTEX_A57, 0x00,
72 (1 << MIDR_VARIANT_SHIFT) | 2),
73 },
74#endif
Will Deacon905e8c52015-03-23 19:07:02 +000075#ifdef CONFIG_ARM64_ERRATUM_845719
76 {
77 /* Cortex-A53 r0p[01234] */
78 .desc = "ARM erratum 845719",
79 .capability = ARM64_WORKAROUND_845719,
80 MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x04),
81 },
82#endif
Robert Richter6d4e11c2015-09-21 22:58:35 +020083#ifdef CONFIG_CAVIUM_ERRATUM_23154
84 {
85 /* Cavium ThunderX, pass 1.x */
86 .desc = "Cavium erratum 23154",
87 .capability = ARM64_WORKAROUND_CAVIUM_23154,
88 MIDR_RANGE(MIDR_THUNDERX, 0x00, 0x01),
89 },
90#endif
Andre Przywara5afaa1f2014-11-14 15:54:11 +000091 {
Andre Przywara301bcfa2014-11-14 15:54:10 +000092 }
Andre Przywarae116a372014-11-14 15:54:09 +000093};
94
95void check_local_cpu_errata(void)
96{
Suzuki K. Poulosece8b6022015-10-19 14:24:49 +010097 update_cpu_capabilities(arm64_errata, "enabling workaround for");
Andre Przywarae116a372014-11-14 15:54:09 +000098}