]> git.baikalelectronics.ru Git - kernel.git/commitdiff
arm64: cpufeature: add HWCAP for FEAT_AFP
authorJoey Gouly <joey.gouly@arm.com>
Fri, 10 Dec 2021 16:54:30 +0000 (16:54 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Mon, 13 Dec 2021 18:52:59 +0000 (18:52 +0000)
Add a new HWCAP to detect the Alternate Floating-point Behaviour
feature (FEAT_AFP), introduced in Armv8.7.

Also expose this to userspace in the ID_AA64MMFR1_EL1 feature register.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Will Deacon <will@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211210165432.8106-2-joey.gouly@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Documentation/arm64/cpu-feature-registers.rst
Documentation/arm64/elf_hwcaps.rst
arch/arm64/include/asm/hwcap.h
arch/arm64/include/asm/sysreg.h
arch/arm64/include/uapi/asm/hwcap.h
arch/arm64/kernel/cpufeature.c
arch/arm64/kernel/cpuinfo.c

index 9f9b8fd060892bad7fb370f6124135ff8c2b58f9..1b19d20c2dbd62632f2a18504e4e03a4f6dcf047 100644 (file)
@@ -275,6 +275,15 @@ infrastructure:
      | SVEVer                       | [3-0]   |    y    |
      +------------------------------+---------+---------+
 
+  8) ID_AA64MMFR1_EL1 - Memory model feature register 1
+
+     +------------------------------+---------+---------+
+     | Name                         |  bits   | visible |
+     +------------------------------+---------+---------+
+     | AFP                          | [47-44] |    y    |
+     +------------------------------+---------+---------+
+
+
 Appendix I: Example
 -------------------
 
index af106af8e1c0010015d0226f14f4dfd1e31ca399..247728d3791182eacb02d873d20cba209ce6e736 100644 (file)
@@ -251,6 +251,10 @@ HWCAP2_ECV
 
     Functionality implied by ID_AA64MMFR0_EL1.ECV == 0b0001.
 
+HWCAP2_AFP
+
+    Functionality implied by ID_AA64MFR1_EL1.AFP == 0b0001.
+
 4. Unused AT_HWCAP bits
 -----------------------
 
index b100e0055eab68998fa0df974a7418c53b791676..2809df2fdd63a7aa4e2688dff74102a6a68179bc 100644 (file)
 #define KERNEL_HWCAP_BTI               __khwcap2_feature(BTI)
 #define KERNEL_HWCAP_MTE               __khwcap2_feature(MTE)
 #define KERNEL_HWCAP_ECV               __khwcap2_feature(ECV)
+#define KERNEL_HWCAP_AFP               __khwcap2_feature(AFP)
 
 /*
  * This yields a mask that user programs can use to figure out what
index 16b3f1a1d46888fce1cd0908ed4a091bf3404d92..adcab9009f9ded7b3783f499b2122af3c0521c88 100644 (file)
 #endif
 
 /* id_aa64mmfr1 */
+#define ID_AA64MMFR1_AFP_SHIFT         44
 #define ID_AA64MMFR1_ETS_SHIFT         36
 #define ID_AA64MMFR1_TWED_SHIFT                32
 #define ID_AA64MMFR1_XNX_SHIFT         28
index 7b23b16f21ce39ff25595920e3d561f292c623e5..180da7396549c6640e7d41df37c4b09dc1ac8dac 100644 (file)
@@ -76,5 +76,6 @@
 #define HWCAP2_BTI             (1 << 17)
 #define HWCAP2_MTE             (1 << 18)
 #define HWCAP2_ECV             (1 << 19)
+#define HWCAP2_AFP             (1 << 20)
 
 #endif /* _UAPI__ASM_HWCAP_H */
index 6f3e677d88f158248bd26e7686cb4f79f5b05573..71ff5a4afb0fce423c060539fc691eb8a6b62144 100644 (file)
@@ -325,6 +325,7 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = {
 };
 
 static const struct arm64_ftr_bits ftr_id_aa64mmfr1[] = {
+       ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_AFP_SHIFT, 4, 0),
        ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_ETS_SHIFT, 4, 0),
        ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_TWED_SHIFT, 4, 0),
        ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_XNX_SHIFT, 4, 0),
@@ -2476,6 +2477,7 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
        HWCAP_CAP(SYS_ID_AA64PFR1_EL1, ID_AA64PFR1_MTE_SHIFT, FTR_UNSIGNED, ID_AA64PFR1_MTE, CAP_HWCAP, KERNEL_HWCAP_MTE),
 #endif /* CONFIG_ARM64_MTE */
        HWCAP_CAP(SYS_ID_AA64MMFR0_EL1, ID_AA64MMFR0_ECV_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_ECV),
+       HWCAP_CAP(SYS_ID_AA64MMFR1_EL1, ID_AA64MMFR1_AFP_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_AFP),
        {},
 };
 
index 6e27b759056a6d615a7c392c94301560f7a2bfff..0e52014019f60201852c7dc87516ebd5034894fa 100644 (file)
@@ -95,6 +95,7 @@ static const char *const hwcap_str[] = {
        [KERNEL_HWCAP_BTI]              = "bti",
        [KERNEL_HWCAP_MTE]              = "mte",
        [KERNEL_HWCAP_ECV]              = "ecv",
+       [KERNEL_HWCAP_AFP]              = "afp",
 };
 
 #ifdef CONFIG_COMPAT