Skip to content

Commit 1175011

Browse files
jgoulyctmarinas
authored andcommitted
arm64: cpufeature: add HWCAP for FEAT_RPRES
Add a new HWCAP to detect the Increased precision of Reciprocal Estimate and Reciprocal Square Root Estimate feature (FEAT_RPRES), introduced in Armv8.7. Also expose this to userspace in the ID_AA64ISAR2_EL1 feature register. Signed-off-by: Joey Gouly <[email protected]> Cc: Will Deacon <[email protected]> Cc: Jonathan Corbet <[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 9e45365 commit 1175011

File tree

6 files changed

+17
-0
lines changed

6 files changed

+17
-0
lines changed

Documentation/arm64/cpu-feature-registers.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,14 @@ infrastructure:
283283
| AFP | [47-44] | y |
284284
+------------------------------+---------+---------+
285285

286+
9) ID_AA64ISAR2_EL1 - Instruction set attribute register 2
287+
288+
+------------------------------+---------+---------+
289+
| Name | bits | visible |
290+
+------------------------------+---------+---------+
291+
| RPRES | [7-4] | y |
292+
+------------------------------+---------+---------+
293+
286294

287295
Appendix I: Example
288296
-------------------

Documentation/arm64/elf_hwcaps.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ HWCAP2_AFP
255255

256256
Functionality implied by ID_AA64MFR1_EL1.AFP == 0b0001.
257257

258+
HWCAP2_RPRES
259+
260+
Functionality implied by ID_AA64ISAR2_EL1.RPRES == 0b0001.
261+
258262
4. Unused AT_HWCAP bits
259263
-----------------------
260264

arch/arm64/include/asm/hwcap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
#define KERNEL_HWCAP_MTE __khwcap2_feature(MTE)
108108
#define KERNEL_HWCAP_ECV __khwcap2_feature(ECV)
109109
#define KERNEL_HWCAP_AFP __khwcap2_feature(AFP)
110+
#define KERNEL_HWCAP_RPRES __khwcap2_feature(RPRES)
110111

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

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,6 @@
7777
#define HWCAP2_MTE (1 << 18)
7878
#define HWCAP2_ECV (1 << 19)
7979
#define HWCAP2_AFP (1 << 20)
80+
#define HWCAP2_RPRES (1 << 21)
8081

8182
#endif /* _UAPI__ASM_HWCAP_H */

arch/arm64/kernel/cpufeature.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ static const struct arm64_ftr_bits ftr_id_aa64isar1[] = {
226226
};
227227

228228
static const struct arm64_ftr_bits ftr_id_aa64isar2[] = {
229+
ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_RPRES_SHIFT, 4, 0),
229230
ARM64_FTR_END,
230231
};
231232

@@ -2487,6 +2488,7 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
24872488
#endif /* CONFIG_ARM64_MTE */
24882489
HWCAP_CAP(SYS_ID_AA64MMFR0_EL1, ID_AA64MMFR0_ECV_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_ECV),
24892490
HWCAP_CAP(SYS_ID_AA64MMFR1_EL1, ID_AA64MMFR1_AFP_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_AFP),
2491+
HWCAP_CAP(SYS_ID_AA64ISAR2_EL1, ID_AA64ISAR2_RPRES_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_RPRES),
24902492
{},
24912493
};
24922494

arch/arm64/kernel/cpuinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ static const char *const hwcap_str[] = {
9696
[KERNEL_HWCAP_MTE] = "mte",
9797
[KERNEL_HWCAP_ECV] = "ecv",
9898
[KERNEL_HWCAP_AFP] = "afp",
99+
[KERNEL_HWCAP_RPRES] = "rpres",
99100
};
100101

101102
#ifdef CONFIG_COMPAT

0 commit comments

Comments
 (0)