Skip to content

Commit a569f5f

Browse files
committed
arm64: Use register field helper in kaslr_requires_kpti()
Rather than open-code the extraction of the E0PD field from the MMFR2 register, we can use the cpuid_feature_extract_unsigned_field() helper instead. Acked-by: Suzuki K Poulose <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent ebac96e commit a569f5f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/arm64/kernel/cpufeature.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,6 @@ has_useable_cnp(const struct arm64_cpu_capabilities *entry, int scope)
980980
*/
981981
bool kaslr_requires_kpti(void)
982982
{
983-
u64 ftr;
984983
if (!IS_ENABLED(CONFIG_RANDOMIZE_BASE))
985984
return false;
986985

@@ -989,8 +988,9 @@ bool kaslr_requires_kpti(void)
989988
* where available.
990989
*/
991990
if (IS_ENABLED(CONFIG_ARM64_E0PD)) {
992-
ftr = read_sysreg_s(SYS_ID_AA64MMFR2_EL1);
993-
if ((ftr >> ID_AA64MMFR2_E0PD_SHIFT) & 0xf)
991+
u64 mmfr2 = read_sysreg_s(SYS_ID_AA64MMFR2_EL1);
992+
if (cpuid_feature_extract_unsigned_field(mmfr2,
993+
ID_AA64MMFR2_E0PD_SHIFT))
994994
return false;
995995
}
996996

0 commit comments

Comments
 (0)