Merge branches 'for-next/sysreg', 'for-next/sme', 'for-next/kselftest', 'for-next...
[linux-2.6-microblaze.git] / arch / arm64 / include / asm / cpufeature.h
index c509283..6bf013f 100644 (file)
@@ -769,6 +769,12 @@ static __always_inline bool system_supports_sme(void)
                cpus_have_const_cap(ARM64_SME);
 }
 
+static __always_inline bool system_supports_sme2(void)
+{
+       return IS_ENABLED(CONFIG_ARM64_SME) &&
+               cpus_have_const_cap(ARM64_SME2);
+}
+
 static __always_inline bool system_supports_fa64(void)
 {
        return IS_ENABLED(CONFIG_ARM64_SME) &&
@@ -864,7 +870,11 @@ static inline bool cpu_has_hw_af(void)
        if (!IS_ENABLED(CONFIG_ARM64_HW_AFDBM))
                return false;
 
-       mmfr1 = read_cpuid(ID_AA64MMFR1_EL1);
+       /*
+        * Use cached version to avoid emulated msr operation on KVM
+        * guests.
+        */
+       mmfr1 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR1_EL1);
        return cpuid_feature_extract_unsigned_field(mmfr1,
                                                ID_AA64MMFR1_EL1_HAFDBS_SHIFT);
 }