diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2018-03-06 12:15:35 -0500 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2018-03-09 08:23:09 -0500 |
commit | ca79acca273630935f2cfdfdf3fc7425ff51ce1c (patch) | |
tree | eb7562df51b97cc6e33b494c9d744744f6dd4a89 | |
parent | e8002e02abf052c07bb87b867789034bc79aac10 (diff) |
arm64/kernel: enable A53 erratum #8434319 handling at runtime
Omit patching of ADRP instruction at module load time if the current
CPUs are not susceptible to the erratum.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
[will: Drop duplicate initialisation of .def_scope field]
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r-- | arch/arm64/include/asm/cpucaps.h | 3 | ||||
-rw-r--r-- | arch/arm64/kernel/cpu_errata.c | 9 | ||||
-rw-r--r-- | arch/arm64/kernel/module-plts.c | 3 | ||||
-rw-r--r-- | arch/arm64/kernel/module.c | 1 |
4 files changed, 14 insertions, 2 deletions
diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h index bb263820de13..39134c46bb13 100644 --- a/arch/arm64/include/asm/cpucaps.h +++ b/arch/arm64/include/asm/cpucaps.h | |||
@@ -45,7 +45,8 @@ | |||
45 | #define ARM64_HARDEN_BRANCH_PREDICTOR 24 | 45 | #define ARM64_HARDEN_BRANCH_PREDICTOR 24 |
46 | #define ARM64_HARDEN_BP_POST_GUEST_EXIT 25 | 46 | #define ARM64_HARDEN_BP_POST_GUEST_EXIT 25 |
47 | #define ARM64_HAS_RAS_EXTN 26 | 47 | #define ARM64_HAS_RAS_EXTN 26 |
48 | #define ARM64_WORKAROUND_843419 27 | ||
48 | 49 | ||
49 | #define ARM64_NCAPS 27 | 50 | #define ARM64_NCAPS 28 |
50 | 51 | ||
51 | #endif /* __ASM_CPUCAPS_H */ | 52 | #endif /* __ASM_CPUCAPS_H */ |
diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index b161abdd6e27..186c0fc61dcd 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c | |||
@@ -298,6 +298,15 @@ const struct arm64_cpu_capabilities arm64_errata[] = { | |||
298 | MIDR_CPU_VAR_REV(1, 2)), | 298 | MIDR_CPU_VAR_REV(1, 2)), |
299 | }, | 299 | }, |
300 | #endif | 300 | #endif |
301 | #ifdef CONFIG_ARM64_ERRATUM_843419 | ||
302 | { | ||
303 | /* Cortex-A53 r0p[01234] */ | ||
304 | .desc = "ARM erratum 843419", | ||
305 | .capability = ARM64_WORKAROUND_843419, | ||
306 | MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x04), | ||
307 | MIDR_FIXED(0x4, BIT(8)), | ||
308 | }, | ||
309 | #endif | ||
301 | #ifdef CONFIG_ARM64_ERRATUM_845719 | 310 | #ifdef CONFIG_ARM64_ERRATUM_845719 |
302 | { | 311 | { |
303 | /* Cortex-A53 r0p[01234] */ | 312 | /* Cortex-A53 r0p[01234] */ |
diff --git a/arch/arm64/kernel/module-plts.c b/arch/arm64/kernel/module-plts.c index 271b77390de0..fa3637284a3d 100644 --- a/arch/arm64/kernel/module-plts.c +++ b/arch/arm64/kernel/module-plts.c | |||
@@ -158,7 +158,8 @@ static unsigned int count_plts(Elf64_Sym *syms, Elf64_Rela *rela, int num, | |||
158 | break; | 158 | break; |
159 | case R_AARCH64_ADR_PREL_PG_HI21_NC: | 159 | case R_AARCH64_ADR_PREL_PG_HI21_NC: |
160 | case R_AARCH64_ADR_PREL_PG_HI21: | 160 | case R_AARCH64_ADR_PREL_PG_HI21: |
161 | if (!IS_ENABLED(CONFIG_ARM64_ERRATUM_843419)) | 161 | if (!IS_ENABLED(CONFIG_ARM64_ERRATUM_843419) || |
162 | !cpus_have_const_cap(ARM64_WORKAROUND_843419)) | ||
162 | break; | 163 | break; |
163 | 164 | ||
164 | /* | 165 | /* |
diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c index f9d824947c34..719fde8dcc19 100644 --- a/arch/arm64/kernel/module.c +++ b/arch/arm64/kernel/module.c | |||
@@ -203,6 +203,7 @@ static int reloc_insn_adrp(struct module *mod, __le32 *place, u64 val) | |||
203 | u32 insn; | 203 | u32 insn; |
204 | 204 | ||
205 | if (!IS_ENABLED(CONFIG_ARM64_ERRATUM_843419) || | 205 | if (!IS_ENABLED(CONFIG_ARM64_ERRATUM_843419) || |
206 | !cpus_have_const_cap(ARM64_WORKAROUND_843419) || | ||
206 | ((u64)place & 0xfff) < 0xff8) | 207 | ((u64)place & 0xfff) < 0xff8) |
207 | return reloc_insn_imm(RELOC_OP_PAGE, place, val, 12, 21, | 208 | return reloc_insn_imm(RELOC_OP_PAGE, place, val, 12, 21, |
208 | AARCH64_INSN_IMM_ADR); | 209 | AARCH64_INSN_IMM_ADR); |