1 |
From foo@baz Tue Mar 8 08:47:19 PM CET 2022 |
2 |
From: Marc Zyngier <maz@kernel.org> |
3 |
Date: Sun, 17 Oct 2021 13:42:25 +0100 |
4 |
Subject: arm64: Add HWCAP for self-synchronising virtual counter |
5 |
|
6 |
From: Marc Zyngier <maz@kernel.org> |
7 |
|
8 |
commit fee29f008aa3f2aff01117f28b57b1145d92cb9b upstream. |
9 |
|
10 |
Since userspace can make use of the CNTVSS_EL0 instruction, expose |
11 |
it via a HWCAP. |
12 |
|
13 |
Suggested-by: Will Deacon <will@kernel.org> |
14 |
Acked-by: Will Deacon <will@kernel.org> |
15 |
Signed-off-by: Marc Zyngier <maz@kernel.org> |
16 |
Link: https://lore.kernel.org/r/20211017124225.3018098-18-maz@kernel.org |
17 |
Signed-off-by: Will Deacon <will@kernel.org> |
18 |
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
19 |
--- |
20 |
Documentation/arm64/cpu-feature-registers.rst | 12 ++++++++++-- |
21 |
Documentation/arm64/elf_hwcaps.rst | 4 ++++ |
22 |
arch/arm64/include/asm/hwcap.h | 1 + |
23 |
arch/arm64/include/uapi/asm/hwcap.h | 1 + |
24 |
arch/arm64/kernel/cpufeature.c | 3 ++- |
25 |
arch/arm64/kernel/cpuinfo.c | 1 + |
26 |
6 files changed, 19 insertions(+), 3 deletions(-) |
27 |
|
28 |
--- a/Documentation/arm64/cpu-feature-registers.rst |
29 |
+++ b/Documentation/arm64/cpu-feature-registers.rst |
30 |
@@ -235,7 +235,15 @@ infrastructure: |
31 |
| DPB | [3-0] | y | |
32 |
+------------------------------+---------+---------+ |
33 |
|
34 |
- 6) ID_AA64MMFR2_EL1 - Memory model feature register 2 |
35 |
+ 6) ID_AA64MMFR0_EL1 - Memory model feature register 0 |
36 |
+ |
37 |
+ +------------------------------+---------+---------+ |
38 |
+ | Name | bits | visible | |
39 |
+ +------------------------------+---------+---------+ |
40 |
+ | ECV | [63-60] | y | |
41 |
+ +------------------------------+---------+---------+ |
42 |
+ |
43 |
+ 7) ID_AA64MMFR2_EL1 - Memory model feature register 2 |
44 |
|
45 |
+------------------------------+---------+---------+ |
46 |
| Name | bits | visible | |
47 |
@@ -243,7 +251,7 @@ infrastructure: |
48 |
| AT | [35-32] | y | |
49 |
+------------------------------+---------+---------+ |
50 |
|
51 |
- 7) ID_AA64ZFR0_EL1 - SVE feature ID register 0 |
52 |
+ 8) ID_AA64ZFR0_EL1 - SVE feature ID register 0 |
53 |
|
54 |
+------------------------------+---------+---------+ |
55 |
| Name | bits | visible | |
56 |
--- a/Documentation/arm64/elf_hwcaps.rst |
57 |
+++ b/Documentation/arm64/elf_hwcaps.rst |
58 |
@@ -247,6 +247,10 @@ HWCAP2_MTE |
59 |
Functionality implied by ID_AA64PFR1_EL1.MTE == 0b0010, as described |
60 |
by Documentation/arm64/memory-tagging-extension.rst. |
61 |
|
62 |
+HWCAP2_ECV |
63 |
+ |
64 |
+ Functionality implied by ID_AA64MMFR0_EL1.ECV == 0b0001. |
65 |
+ |
66 |
4. Unused AT_HWCAP bits |
67 |
----------------------- |
68 |
|
69 |
--- a/arch/arm64/include/asm/hwcap.h |
70 |
+++ b/arch/arm64/include/asm/hwcap.h |
71 |
@@ -105,6 +105,7 @@ |
72 |
#define KERNEL_HWCAP_RNG __khwcap2_feature(RNG) |
73 |
#define KERNEL_HWCAP_BTI __khwcap2_feature(BTI) |
74 |
#define KERNEL_HWCAP_MTE __khwcap2_feature(MTE) |
75 |
+#define KERNEL_HWCAP_ECV __khwcap2_feature(ECV) |
76 |
|
77 |
/* |
78 |
* This yields a mask that user programs can use to figure out what |
79 |
--- a/arch/arm64/include/uapi/asm/hwcap.h |
80 |
+++ b/arch/arm64/include/uapi/asm/hwcap.h |
81 |
@@ -75,5 +75,6 @@ |
82 |
#define HWCAP2_RNG (1 << 16) |
83 |
#define HWCAP2_BTI (1 << 17) |
84 |
#define HWCAP2_MTE (1 << 18) |
85 |
+#define HWCAP2_ECV (1 << 19) |
86 |
|
87 |
#endif /* _UAPI__ASM_HWCAP_H */ |
88 |
--- a/arch/arm64/kernel/cpufeature.c |
89 |
+++ b/arch/arm64/kernel/cpufeature.c |
90 |
@@ -279,7 +279,7 @@ static const struct arm64_ftr_bits ftr_i |
91 |
}; |
92 |
|
93 |
static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = { |
94 |
- ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_ECV_SHIFT, 4, 0), |
95 |
+ ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_ECV_SHIFT, 4, 0), |
96 |
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_FGT_SHIFT, 4, 0), |
97 |
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR0_EXS_SHIFT, 4, 0), |
98 |
/* |
99 |
@@ -2455,6 +2455,7 @@ static const struct arm64_cpu_capabiliti |
100 |
#ifdef CONFIG_ARM64_MTE |
101 |
HWCAP_CAP(SYS_ID_AA64PFR1_EL1, ID_AA64PFR1_MTE_SHIFT, FTR_UNSIGNED, ID_AA64PFR1_MTE, CAP_HWCAP, KERNEL_HWCAP_MTE), |
102 |
#endif /* CONFIG_ARM64_MTE */ |
103 |
+ HWCAP_CAP(SYS_ID_AA64MMFR0_EL1, ID_AA64MMFR0_ECV_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_ECV), |
104 |
{}, |
105 |
}; |
106 |
|
107 |
--- a/arch/arm64/kernel/cpuinfo.c |
108 |
+++ b/arch/arm64/kernel/cpuinfo.c |
109 |
@@ -94,6 +94,7 @@ static const char *const hwcap_str[] = { |
110 |
[KERNEL_HWCAP_RNG] = "rng", |
111 |
[KERNEL_HWCAP_BTI] = "bti", |
112 |
[KERNEL_HWCAP_MTE] = "mte", |
113 |
+ [KERNEL_HWCAP_ECV] = "ecv", |
114 |
}; |
115 |
|
116 |
#ifdef CONFIG_COMPAT |