arm64: cpufeature: Track 32bit EL0 support
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Mon, 18 Apr 2016 09:28:36 +0000 (10:28 +0100)
committerWill Deacon <will.deacon@arm.com>
Wed, 20 Apr 2016 11:22:42 +0000 (12:22 +0100)
Add cpu_hwcap bit for keeping track of the support for 32bit EL0.

Tested-by: Yury Norov <ynorov@caviumnetworks.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/cpufeature.h
arch/arm64/kernel/cpufeature.c

index 7f64285e4ef70f45aaef90cc83ff4400bb05d421..ca8fb4bcfb1a126011b97b1f13f0a1d624872c46 100644 (file)
@@ -35,8 +35,9 @@
 #define ARM64_ALT_PAN_NOT_UAO                  10
 #define ARM64_HAS_VIRT_HOST_EXTN               11
 #define ARM64_WORKAROUND_CAVIUM_27456          12
+#define ARM64_HAS_32BIT_EL0                    13
 
-#define ARM64_NCAPS                            13
+#define ARM64_NCAPS                            14
 
 #ifndef __ASSEMBLY__
 
@@ -192,6 +193,11 @@ static inline bool cpu_supports_mixed_endian_el0(void)
        return id_aa64mmfr0_mixed_endian_el0(read_cpuid(ID_AA64MMFR0_EL1));
 }
 
+static inline bool system_supports_32bit_el0(void)
+{
+       return cpus_have_cap(ARM64_HAS_32BIT_EL0);
+}
+
 static inline bool system_supports_mixed_endian_el0(void)
 {
        return id_aa64mmfr0_mixed_endian_el0(read_system_reg(SYS_ID_AA64MMFR0_EL1));
index 9097ce9244e3c3fdf0ccdcc73b72f5eda1dc3a33..40a23f24559d4c355713410f50dd7411c474a1ee 100644 (file)
@@ -737,6 +737,15 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
                .capability = ARM64_HAS_VIRT_HOST_EXTN,
                .matches = runs_at_el2,
        },
+       {
+               .desc = "32-bit EL0 Support",
+               .capability = ARM64_HAS_32BIT_EL0,
+               .matches = has_cpuid_feature,
+               .sys_reg = SYS_ID_AA64PFR0_EL1,
+               .sign = FTR_UNSIGNED,
+               .field_pos = ID_AA64PFR0_EL0_SHIFT,
+               .min_field_value = ID_AA64PFR0_EL0_32BIT_64BIT,
+       },
        {},
 };