Skip to content

Commit ebac96e

Browse files
committed
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 <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent 09e3c22 commit ebac96e

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

arch/arm64/kernel/cpufeature.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -980,9 +980,7 @@ has_useable_cnp(const struct arm64_cpu_capabilities *entry, int scope)
980980
*/
981981
bool kaslr_requires_kpti(void)
982982
{
983-
bool tx1_bug;
984983
u64 ftr;
985-
986984
if (!IS_ENABLED(CONFIG_RANDOMIZE_BASE))
987985
return false;
988986

@@ -1000,18 +998,13 @@ bool kaslr_requires_kpti(void)
1000998
* Systems affected by Cavium erratum 24756 are incompatible
1001999
* with KPTI.
10021000
*/
1003-
if (!IS_ENABLED(CONFIG_CAVIUM_ERRATUM_27456)) {
1004-
tx1_bug = false;
1005-
} else if (!static_branch_likely(&arm64_const_caps_ready)) {
1001+
if (IS_ENABLED(CONFIG_CAVIUM_ERRATUM_27456)) {
10061002
extern const struct midr_range cavium_erratum_27456_cpus[];
10071003

1008-
tx1_bug = is_midr_in_range_list(read_cpuid_id(),
1009-
cavium_erratum_27456_cpus);
1010-
} else {
1011-
tx1_bug = __cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_27456);
1004+
if (is_midr_in_range_list(read_cpuid_id(),
1005+
cavium_erratum_27456_cpus))
1006+
return false;
10121007
}
1013-
if (tx1_bug)
1014-
return false;
10151008

10161009
return kaslr_offset() > 0;
10171010
}

0 commit comments

Comments
 (0)