diff options
author | Marc Zyngier <maz@kernel.org> | 2020-12-09 11:00:24 +0100 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2020-12-09 11:00:24 +0100 |
commit | 3a514592b698588326924625b6948a10c35fadd5 (patch) | |
tree | 1209f5cb0a780f87c41e3299b22776a221766892 /arch/arm64/include/asm/cpufeature.h | |
parent | Merge remote-tracking branch 'origin/kvm-arm64/misc-5.11' into kvmarm-master/... (diff) | |
parent | KVM: arm64: Fix nVHE boot on VHE systems (diff) | |
download | linux-3a514592b698588326924625b6948a10c35fadd5.tar.xz linux-3a514592b698588326924625b6948a10c35fadd5.zip |
Merge remote-tracking branch 'origin/kvm-arm64/psci-relay' into kvmarm-master/next
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'arch/arm64/include/asm/cpufeature.h')
-rw-r--r-- | arch/arm64/include/asm/cpufeature.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index 461277ae7a48..16063c813dcd 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -669,10 +669,16 @@ static __always_inline bool system_supports_fpsimd(void) return !cpus_have_const_cap(ARM64_HAS_NO_FPSIMD); } +static inline bool system_uses_hw_pan(void) +{ + return IS_ENABLED(CONFIG_ARM64_PAN) && + cpus_have_const_cap(ARM64_HAS_PAN); +} + static inline bool system_uses_ttbr0_pan(void) { return IS_ENABLED(CONFIG_ARM64_SW_TTBR0_PAN) && - !cpus_have_const_cap(ARM64_HAS_PAN); + !system_uses_hw_pan(); } static __always_inline bool system_supports_sve(void) @@ -769,6 +775,13 @@ static inline bool cpu_has_hw_af(void) ID_AA64MMFR1_HADBS_SHIFT); } +static inline bool cpu_has_pan(void) +{ + u64 mmfr1 = read_cpuid(ID_AA64MMFR1_EL1); + return cpuid_feature_extract_unsigned_field(mmfr1, + ID_AA64MMFR1_PAN_SHIFT); +} + #ifdef CONFIG_ARM64_AMU_EXTN /* Check whether the cpu supports the Activity Monitors Unit (AMU) */ extern bool cpu_has_amu_feat(int cpu); |