aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuzuki K Poulose <suzuki.poulose@arm.com>2018-10-09 09:47:07 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2018-10-16 06:53:34 -0400
commit4afe8e79da920bdf6698b01bc668fffc6758f37b (patch)
treed2c1918b8acb95d4b5b36c103c82057cac9cd4a1
parent1602df02f33f61fe0de1bbfeba0d1c97c14bff19 (diff)
arm64: cpufeature: Trap CTR_EL0 access only where it is necessary
When there is a mismatch in the CTR_EL0 field, we trap access to CTR from EL0 on all CPUs to expose the safe value. However, we could skip trapping on a CPU which matches the safe value. Cc: Mark Rutland <mark.rutland@arm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r--arch/arm64/kernel/cpu_errata.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
index 3deb01c6ed49..9af8df96ec49 100644
--- a/arch/arm64/kernel/cpu_errata.c
+++ b/arch/arm64/kernel/cpu_errata.c
@@ -99,7 +99,12 @@ has_mismatched_cache_type(const struct arm64_cpu_capabilities *entry,
99static void 99static void
100cpu_enable_trap_ctr_access(const struct arm64_cpu_capabilities *__unused) 100cpu_enable_trap_ctr_access(const struct arm64_cpu_capabilities *__unused)
101{ 101{
102 sysreg_clear_set(sctlr_el1, SCTLR_EL1_UCT, 0); 102 u64 mask = arm64_ftr_reg_ctrel0.strict_mask;
103
104 /* Trap CTR_EL0 access on this CPU, only if it has a mismatch */
105 if ((read_cpuid_cachetype() & mask) !=
106 (arm64_ftr_reg_ctrel0.sys_val & mask))
107 sysreg_clear_set(sctlr_el1, SCTLR_EL1_UCT, 0);
103} 108}
104 109
105atomic_t arm64_el2_vector_last_slot = ATOMIC_INIT(-1); 110atomic_t arm64_el2_vector_last_slot = ATOMIC_INIT(-1);