aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/cpufeature.c
diff options
context:
space:
mode:
authorWill Deacon <will@kernel.org>2020-01-15 13:59:58 +0000
committerWill Deacon <will@kernel.org>2020-01-15 16:49:27 +0000
commitebac96ede61a1a46bdef12df3c1f9c20b00f2d88 (patch)
tree87ad74e80710fd970b6ba97f812f25aa749cef1e /arch/arm64/kernel/cpufeature.c
parentarm64: Use a variable to store non-global mappings decision (diff)
downloadlinux-dev-ebac96ede61a1a46bdef12df3c1f9c20b00f2d88.tar.xz
linux-dev-ebac96ede61a1a46bdef12df3c1f9c20b00f2d88.zip
arm64: Simplify early check for broken TX1 when KASLR is enabled
Now that the decision to use non-global mappings is stored in a variable, the check to avoid enabling them for the terminally broken ThunderX1 platform can be simplified so that it is only keyed off the MIDR value. Acked-by: Suzuki K Poulose <suzuki.poulose@arm.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/arm64/kernel/cpufeature.c')
-rw-r--r--arch/arm64/kernel/cpufeature.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 4a031111ceb5..d5242b44dc5a 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -980,9 +980,7 @@ has_useable_cnp(const struct arm64_cpu_capabilities *entry, int scope)
*/
bool kaslr_requires_kpti(void)
{
- bool tx1_bug;
u64 ftr;
-
if (!IS_ENABLED(CONFIG_RANDOMIZE_BASE))
return false;
@@ -1000,18 +998,13 @@ bool kaslr_requires_kpti(void)
* Systems affected by Cavium erratum 24756 are incompatible
* with KPTI.
*/
- if (!IS_ENABLED(CONFIG_CAVIUM_ERRATUM_27456)) {
- tx1_bug = false;
- } else if (!static_branch_likely(&arm64_const_caps_ready)) {
+ if (IS_ENABLED(CONFIG_CAVIUM_ERRATUM_27456)) {
extern const struct midr_range cavium_erratum_27456_cpus[];
- tx1_bug = is_midr_in_range_list(read_cpuid_id(),
- cavium_erratum_27456_cpus);
- } else {
- tx1_bug = __cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_27456);
+ if (is_midr_in_range_list(read_cpuid_id(),
+ cavium_erratum_27456_cpus))
+ return false;
}
- if (tx1_bug)
- return false;
return kaslr_offset() > 0;
}