Skip to content

Commit 5c13f04

Browse files
jgoulyctmarinas
authored andcommitted
arm64: cpufeature: add HWCAP for FEAT_AFP
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 <[email protected]> Cc: Will Deacon <[email protected]> Acked-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent d58071a commit 5c13f04

File tree

7 files changed

+19
-0
lines changed

7 files changed

+19
-0
lines changed

Documentation/arm64/cpu-feature-registers.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,15 @@ infrastructure:
275275
| SVEVer | [3-0] | y |
276276
+------------------------------+---------+---------+
277277

278+
8) ID_AA64MMFR1_EL1 - Memory model feature register 1
279+
280+
+------------------------------+---------+---------+
281+
| Name | bits | visible |
282+
+------------------------------+---------+---------+
283+
| AFP | [47-44] | y |
284+
+------------------------------+---------+---------+
285+
286+
278287
Appendix I: Example
279288
-------------------
280289

Documentation/arm64/elf_hwcaps.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ HWCAP2_ECV
251251

252252
Functionality implied by ID_AA64MMFR0_EL1.ECV == 0b0001.
253253

254+
HWCAP2_AFP
255+
256+
Functionality implied by ID_AA64MFR1_EL1.AFP == 0b0001.
257+
254258
4. Unused AT_HWCAP bits
255259
-----------------------
256260

arch/arm64/include/asm/hwcap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
#define KERNEL_HWCAP_BTI __khwcap2_feature(BTI)
107107
#define KERNEL_HWCAP_MTE __khwcap2_feature(MTE)
108108
#define KERNEL_HWCAP_ECV __khwcap2_feature(ECV)
109+
#define KERNEL_HWCAP_AFP __khwcap2_feature(AFP)
109110

110111
/*
111112
* This yields a mask that user programs can use to figure out what

arch/arm64/include/asm/sysreg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@
889889
#endif
890890

891891
/* id_aa64mmfr1 */
892+
#define ID_AA64MMFR1_AFP_SHIFT 44
892893
#define ID_AA64MMFR1_ETS_SHIFT 36
893894
#define ID_AA64MMFR1_TWED_SHIFT 32
894895
#define ID_AA64MMFR1_XNX_SHIFT 28

arch/arm64/include/uapi/asm/hwcap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,6 @@
7676
#define HWCAP2_BTI (1 << 17)
7777
#define HWCAP2_MTE (1 << 18)
7878
#define HWCAP2_ECV (1 << 19)
79+
#define HWCAP2_AFP (1 << 20)
7980

8081
#endif /* _UAPI__ASM_HWCAP_H */

arch/arm64/kernel/cpufeature.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = {
325325
};
326326

327327
static const struct arm64_ftr_bits ftr_id_aa64mmfr1[] = {
328+
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_AFP_SHIFT, 4, 0),
328329
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_ETS_SHIFT, 4, 0),
329330
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_TWED_SHIFT, 4, 0),
330331
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[] = {
24762477
HWCAP_CAP(SYS_ID_AA64PFR1_EL1, ID_AA64PFR1_MTE_SHIFT, FTR_UNSIGNED, ID_AA64PFR1_MTE, CAP_HWCAP, KERNEL_HWCAP_MTE),
24772478
#endif /* CONFIG_ARM64_MTE */
24782479
HWCAP_CAP(SYS_ID_AA64MMFR0_EL1, ID_AA64MMFR0_ECV_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_ECV),
2480+
HWCAP_CAP(SYS_ID_AA64MMFR1_EL1, ID_AA64MMFR1_AFP_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_AFP),
24792481
{},
24802482
};
24812483

arch/arm64/kernel/cpuinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ static const char *const hwcap_str[] = {
9595
[KERNEL_HWCAP_BTI] = "bti",
9696
[KERNEL_HWCAP_MTE] = "mte",
9797
[KERNEL_HWCAP_ECV] = "ecv",
98+
[KERNEL_HWCAP_AFP] = "afp",
9899
};
99100

100101
#ifdef CONFIG_COMPAT

0 commit comments

Comments
 (0)