Skip to content

Commit fee29f0

Browse files
Marc Zyngierwilldeacon
authored andcommitted
arm64: Add HWCAP for self-synchronising virtual counter
Since userspace can make use of the CNTVSS_EL0 instruction, expose it via a HWCAP. Suggested-by: Will Deacon <[email protected]> Acked-by: Will Deacon <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent ae976f0 commit fee29f0

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed

Documentation/arm64/cpu-feature-registers.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,23 @@ infrastructure:
235235
| DPB | [3-0] | y |
236236
+------------------------------+---------+---------+
237237

238-
6) ID_AA64MMFR2_EL1 - Memory model feature register 2
238+
6) ID_AA64MMFR0_EL1 - Memory model feature register 0
239+
240+
+------------------------------+---------+---------+
241+
| Name | bits | visible |
242+
+------------------------------+---------+---------+
243+
| ECV | [63-60] | y |
244+
+------------------------------+---------+---------+
245+
246+
7) ID_AA64MMFR2_EL1 - Memory model feature register 2
239247

240248
+------------------------------+---------+---------+
241249
| Name | bits | visible |
242250
+------------------------------+---------+---------+
243251
| AT | [35-32] | y |
244252
+------------------------------+---------+---------+
245253

246-
7) ID_AA64ZFR0_EL1 - SVE feature ID register 0
254+
8) ID_AA64ZFR0_EL1 - SVE feature ID register 0
247255

248256
+------------------------------+---------+---------+
249257
| Name | bits | visible |

Documentation/arm64/elf_hwcaps.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ HWCAP2_MTE
247247
Functionality implied by ID_AA64PFR1_EL1.MTE == 0b0010, as described
248248
by Documentation/arm64/memory-tagging-extension.rst.
249249

250+
HWCAP2_ECV
251+
252+
Functionality implied by ID_AA64MMFR0_EL1.ECV == 0b0001.
253+
250254
4. Unused AT_HWCAP bits
251255
-----------------------
252256

arch/arm64/include/asm/hwcap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
#define KERNEL_HWCAP_RNG __khwcap2_feature(RNG)
106106
#define KERNEL_HWCAP_BTI __khwcap2_feature(BTI)
107107
#define KERNEL_HWCAP_MTE __khwcap2_feature(MTE)
108+
#define KERNEL_HWCAP_ECV __khwcap2_feature(ECV)
108109

109110
/*
110111
* 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
@@ -75,5 +75,6 @@
7575
#define HWCAP2_RNG (1 << 16)
7676
#define HWCAP2_BTI (1 << 17)
7777
#define HWCAP2_MTE (1 << 18)
78+
#define HWCAP2_ECV (1 << 19)
7879

7980
#endif /* _UAPI__ASM_HWCAP_H */

arch/arm64/kernel/cpufeature.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ static const struct arm64_ftr_bits ftr_id_aa64zfr0[] = {
279279
};
280280

281281
static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = {
282-
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_ECV_SHIFT, 4, 0),
282+
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_ECV_SHIFT, 4, 0),
283283
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_FGT_SHIFT, 4, 0),
284284
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_EXS_SHIFT, 4, 0),
285285
/*
@@ -2461,6 +2461,7 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
24612461
#ifdef CONFIG_ARM64_MTE
24622462
HWCAP_CAP(SYS_ID_AA64PFR1_EL1, ID_AA64PFR1_MTE_SHIFT, FTR_UNSIGNED, ID_AA64PFR1_MTE, CAP_HWCAP, KERNEL_HWCAP_MTE),
24632463
#endif /* CONFIG_ARM64_MTE */
2464+
HWCAP_CAP(SYS_ID_AA64MMFR0_EL1, ID_AA64MMFR0_ECV_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_ECV),
24642465
{},
24652466
};
24662467

arch/arm64/kernel/cpuinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ static const char *const hwcap_str[] = {
9494
[KERNEL_HWCAP_RNG] = "rng",
9595
[KERNEL_HWCAP_BTI] = "bti",
9696
[KERNEL_HWCAP_MTE] = "mte",
97+
[KERNEL_HWCAP_ECV] = "ecv",
9798
};
9899

99100
#ifdef CONFIG_COMPAT

0 commit comments

Comments
 (0)