Blame view

Documentation/arm64/elf_hwcaps.rst 6.61 KB
b693d0b37   Mauro Carvalho Chehab   docs: arm64: conv...
1
  ================
611a7bc74   Mark Rutland   arm64: docs: desc...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  ARM64 ELF hwcaps
  ================
  
  This document describes the usage and semantics of the arm64 ELF hwcaps.
  
  
  1. Introduction
  ---------------
  
  Some hardware or software features are only available on some CPU
  implementations, and/or with certain kernel configurations, but have no
  architected discovery mechanism available to userspace code at EL0. The
  kernel exposes the presence of these features to userspace through a set
  of flags called hwcaps, exposed in the auxilliary vector.
aaba098fe   Andrew Murray   arm64: HWCAP: add...
16
17
  Userspace software can test for features by acquiring the AT_HWCAP or
  AT_HWCAP2 entry of the auxiliary vector, and testing whether the relevant
b693d0b37   Mauro Carvalho Chehab   docs: arm64: conv...
18
  flags are set, e.g.::
611a7bc74   Mark Rutland   arm64: docs: desc...
19

b693d0b37   Mauro Carvalho Chehab   docs: arm64: conv...
20
21
22
23
24
  	bool floating_point_is_present(void)
  	{
  		unsigned long hwcaps = getauxval(AT_HWCAP);
  		if (hwcaps & HWCAP_FP)
  			return true;
611a7bc74   Mark Rutland   arm64: docs: desc...
25

b693d0b37   Mauro Carvalho Chehab   docs: arm64: conv...
26
27
  		return false;
  	}
611a7bc74   Mark Rutland   arm64: docs: desc...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  
  Where software relies on a feature described by a hwcap, it should check
  the relevant hwcap flag to verify that the feature is present before
  attempting to make use of the feature.
  
  Features cannot be probed reliably through other means. When a feature
  is not available, attempting to use it may result in unpredictable
  behaviour, and is not guaranteed to result in any reliable indication
  that the feature is unavailable, such as a SIGILL.
  
  
  2. Interpretation of hwcaps
  ---------------------------
  
  The majority of hwcaps are intended to indicate the presence of features
  which are described by architected ID registers inaccessible to
  userspace code at EL0. These hwcaps are defined in terms of ID register
  fields, and should be interpreted with reference to the definition of
  these fields in the ARM Architecture Reference Manual (ARM ARM).
b693d0b37   Mauro Carvalho Chehab   docs: arm64: conv...
47
  Such hwcaps are described below in the form::
611a7bc74   Mark Rutland   arm64: docs: desc...
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  
      Functionality implied by idreg.field == val.
  
  Such hwcaps indicate the availability of functionality that the ARM ARM
  defines as being present when idreg.field has value val, but do not
  indicate that idreg.field is precisely equal to val, nor do they
  indicate the absence of functionality implied by other values of
  idreg.field.
  
  Other hwcaps may indicate the presence of features which cannot be
  described by ID registers alone. These may be described without
  reference to ID registers, and may refer to other documentation.
  
  
  3. The hwcaps exposed in AT_HWCAP
  ---------------------------------
  
  HWCAP_FP
611a7bc74   Mark Rutland   arm64: docs: desc...
66
67
68
      Functionality implied by ID_AA64PFR0_EL1.FP == 0b0000.
  
  HWCAP_ASIMD
611a7bc74   Mark Rutland   arm64: docs: desc...
69
70
71
      Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0000.
  
  HWCAP_EVTSTRM
611a7bc74   Mark Rutland   arm64: docs: desc...
72
73
74
75
      The generic timer is configured to generate events at a frequency of
      approximately 100KHz.
  
  HWCAP_AES
4bfbe5eee   Giacomo Travaglini   arm64: docs: Fix ...
76
      Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0001.
611a7bc74   Mark Rutland   arm64: docs: desc...
77
78
  
  HWCAP_PMULL
4bfbe5eee   Giacomo Travaglini   arm64: docs: Fix ...
79
      Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0010.
611a7bc74   Mark Rutland   arm64: docs: desc...
80
81
  
  HWCAP_SHA1
611a7bc74   Mark Rutland   arm64: docs: desc...
82
83
84
      Functionality implied by ID_AA64ISAR0_EL1.SHA1 == 0b0001.
  
  HWCAP_SHA2
611a7bc74   Mark Rutland   arm64: docs: desc...
85
86
87
      Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0001.
  
  HWCAP_CRC32
611a7bc74   Mark Rutland   arm64: docs: desc...
88
89
90
      Functionality implied by ID_AA64ISAR0_EL1.CRC32 == 0b0001.
  
  HWCAP_ATOMICS
611a7bc74   Mark Rutland   arm64: docs: desc...
91
92
93
      Functionality implied by ID_AA64ISAR0_EL1.Atomic == 0b0010.
  
  HWCAP_FPHP
611a7bc74   Mark Rutland   arm64: docs: desc...
94
95
96
      Functionality implied by ID_AA64PFR0_EL1.FP == 0b0001.
  
  HWCAP_ASIMDHP
611a7bc74   Mark Rutland   arm64: docs: desc...
97
98
99
      Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0001.
  
  HWCAP_CPUID
611a7bc74   Mark Rutland   arm64: docs: desc...
100
      EL0 access to certain ID registers is available, to the extent
b693d0b37   Mauro Carvalho Chehab   docs: arm64: conv...
101
      described by Documentation/arm64/cpu-feature-registers.rst.
611a7bc74   Mark Rutland   arm64: docs: desc...
102
103
104
105
  
      These ID registers may imply the availability of features.
  
  HWCAP_ASIMDRDM
611a7bc74   Mark Rutland   arm64: docs: desc...
106
107
108
      Functionality implied by ID_AA64ISAR0_EL1.RDM == 0b0001.
  
  HWCAP_JSCVT
611a7bc74   Mark Rutland   arm64: docs: desc...
109
110
111
      Functionality implied by ID_AA64ISAR1_EL1.JSCVT == 0b0001.
  
  HWCAP_FCMA
611a7bc74   Mark Rutland   arm64: docs: desc...
112
113
114
      Functionality implied by ID_AA64ISAR1_EL1.FCMA == 0b0001.
  
  HWCAP_LRCPC
611a7bc74   Mark Rutland   arm64: docs: desc...
115
116
117
      Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0001.
  
  HWCAP_DCPOP
611a7bc74   Mark Rutland   arm64: docs: desc...
118
119
120
      Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0001.
  
  HWCAP_SHA3
611a7bc74   Mark Rutland   arm64: docs: desc...
121
122
123
      Functionality implied by ID_AA64ISAR0_EL1.SHA3 == 0b0001.
  
  HWCAP_SM3
611a7bc74   Mark Rutland   arm64: docs: desc...
124
125
126
      Functionality implied by ID_AA64ISAR0_EL1.SM3 == 0b0001.
  
  HWCAP_SM4
611a7bc74   Mark Rutland   arm64: docs: desc...
127
128
129
      Functionality implied by ID_AA64ISAR0_EL1.SM4 == 0b0001.
  
  HWCAP_ASIMDDP
611a7bc74   Mark Rutland   arm64: docs: desc...
130
131
132
      Functionality implied by ID_AA64ISAR0_EL1.DP == 0b0001.
  
  HWCAP_SHA512
4bfbe5eee   Giacomo Travaglini   arm64: docs: Fix ...
133
      Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0010.
43994d824   Dave Martin   arm64/sve: Detect...
134
135
  
  HWCAP_SVE
43994d824   Dave Martin   arm64/sve: Detect...
136
      Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001.
3b3b68109   Dongjiu Geng   arm64: v8.4: Supp...
137
138
  
  HWCAP_ASIMDFHM
3b3b68109   Dongjiu Geng   arm64: v8.4: Supp...
139
     Functionality implied by ID_AA64ISAR0_EL1.FHM == 0b0001.
7206dc93a   Suzuki K Poulose   arm64: Expose Arm...
140
141
  
  HWCAP_DIT
7206dc93a   Suzuki K Poulose   arm64: Expose Arm...
142
143
144
      Functionality implied by ID_AA64PFR0_EL1.DIT == 0b0001.
  
  HWCAP_USCAT
7206dc93a   Suzuki K Poulose   arm64: Expose Arm...
145
146
147
      Functionality implied by ID_AA64MMFR2_EL1.AT == 0b0001.
  
  HWCAP_ILRCPC
4bfbe5eee   Giacomo Travaglini   arm64: docs: Fix ...
148
      Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0010.
7206dc93a   Suzuki K Poulose   arm64: Expose Arm...
149
150
  
  HWCAP_FLAGM
7206dc93a   Suzuki K Poulose   arm64: Expose Arm...
151
      Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0001.
ee9117612   Will Deacon   arm64: docs: Docu...
152
153
  
  HWCAP_SSBS
ee9117612   Will Deacon   arm64: docs: Docu...
154
      Functionality implied by ID_AA64PFR1_EL1.SSBS == 0b0010.
fbedc599e   Mark Rutland   arm64: docs: docu...
155

0f6e4c401   Julien Grall   docs/arm64: elf_h...
156
157
  HWCAP_SB
      Functionality implied by ID_AA64ISAR1_EL1.SB == 0b0001.
fbedc599e   Mark Rutland   arm64: docs: docu...
158
  HWCAP_PACA
fbedc599e   Mark Rutland   arm64: docs: docu...
159
160
      Functionality implied by ID_AA64ISAR1_EL1.APA == 0b0001 or
      ID_AA64ISAR1_EL1.API == 0b0001, as described by
b693d0b37   Mauro Carvalho Chehab   docs: arm64: conv...
161
      Documentation/arm64/pointer-authentication.rst.
fbedc599e   Mark Rutland   arm64: docs: docu...
162
163
  
  HWCAP_PACG
fbedc599e   Mark Rutland   arm64: docs: docu...
164
165
      Functionality implied by ID_AA64ISAR1_EL1.GPA == 0b0001 or
      ID_AA64ISAR1_EL1.GPI == 0b0001, as described by
b693d0b37   Mauro Carvalho Chehab   docs: arm64: conv...
166
      Documentation/arm64/pointer-authentication.rst.
aaba098fe   Andrew Murray   arm64: HWCAP: add...
167

3a25e46c9   Julien Grall   docs/arm64: elf_h...
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
  HWCAP2_DCPODP
  
      Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0010.
  
  HWCAP2_SVE2
  
      Functionality implied by ID_AA64ZFR0_EL1.SVEVer == 0b0001.
  
  HWCAP2_SVEAES
  
      Functionality implied by ID_AA64ZFR0_EL1.AES == 0b0001.
  
  HWCAP2_SVEPMULL
  
      Functionality implied by ID_AA64ZFR0_EL1.AES == 0b0010.
  
  HWCAP2_SVEBITPERM
  
      Functionality implied by ID_AA64ZFR0_EL1.BitPerm == 0b0001.
  
  HWCAP2_SVESHA3
  
      Functionality implied by ID_AA64ZFR0_EL1.SHA3 == 0b0001.
  
  HWCAP2_SVESM4
  
      Functionality implied by ID_AA64ZFR0_EL1.SM4 == 0b0001.
  
  HWCAP2_FLAGM2
  
      Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0010.
ca9503fc9   Mark Brown   arm64: Expose FRI...
199
200
201
  HWCAP2_FRINT
  
      Functionality implied by ID_AA64ISAR1_EL1.FRINTTS == 0b0001.
d4209d8b7   Steven Price   arm64: cpufeature...
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
  HWCAP2_SVEI8MM
  
      Functionality implied by ID_AA64ZFR0_EL1.I8MM == 0b0001.
  
  HWCAP2_SVEF32MM
  
      Functionality implied by ID_AA64ZFR0_EL1.F32MM == 0b0001.
  
  HWCAP2_SVEF64MM
  
      Functionality implied by ID_AA64ZFR0_EL1.F64MM == 0b0001.
  
  HWCAP2_SVEBF16
  
      Functionality implied by ID_AA64ZFR0_EL1.BF16 == 0b0001.
  
  HWCAP2_I8MM
  
      Functionality implied by ID_AA64ISAR1_EL1.I8MM == 0b0001.
  
  HWCAP2_BF16
  
      Functionality implied by ID_AA64ISAR1_EL1.BF16 == 0b0001.
  
  HWCAP2_DGH
  
      Functionality implied by ID_AA64ISAR1_EL1.DGH == 0b0001.
aaba098fe   Andrew Murray   arm64: HWCAP: add...
229

1a50ec0b3   Richard Henderson   arm64: Implement ...
230
231
232
  HWCAP2_RNG
  
      Functionality implied by ID_AA64ISAR0_EL1.RNDR == 0b0001.
8ef8f360c   Dave Martin   arm64: Basic Bran...
233
234
235
  HWCAP2_BTI
  
      Functionality implied by ID_AA64PFR0_EL1.BT == 0b0001.
df9d7a22d   Vincenzo Frascino   arm64: mte: Add M...
236
237
238
239
  HWCAP2_MTE
  
      Functionality implied by ID_AA64PFR1_EL1.MTE == 0b0010, as described
      by Documentation/arm64/memory-tagging-extension.rst.
8ef8f360c   Dave Martin   arm64: Basic Bran...
240

aaba098fe   Andrew Murray   arm64: HWCAP: add...
241
242
243
244
245
  4. Unused AT_HWCAP bits
  -----------------------
  
  For interoperation with userspace, the kernel guarantees that bits 62
  and 63 of AT_HWCAP will always be returned as 0.