blob: b72ff17d600aee7932157e993e580f41a2a7c426 [file] [log] [blame]
Bailu Lin24729432020-11-23 18:38:14 -08001.. _elf_hwcaps_index:
2
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -03003================
Mark Rutland611a7bc72017-10-11 14:01:03 +01004ARM64 ELF hwcaps
5================
6
7This document describes the usage and semantics of the arm64 ELF hwcaps.
8
9
101. Introduction
11---------------
12
13Some hardware or software features are only available on some CPU
14implementations, and/or with certain kernel configurations, but have no
15architected discovery mechanism available to userspace code at EL0. The
16kernel exposes the presence of these features to userspace through a set
17of flags called hwcaps, exposed in the auxilliary vector.
18
Andrew Murrayaaba0982019-04-09 10:52:40 +010019Userspace software can test for features by acquiring the AT_HWCAP or
20AT_HWCAP2 entry of the auxiliary vector, and testing whether the relevant
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -030021flags are set, e.g.::
Mark Rutland611a7bc72017-10-11 14:01:03 +010022
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -030023 bool floating_point_is_present(void)
24 {
25 unsigned long hwcaps = getauxval(AT_HWCAP);
26 if (hwcaps & HWCAP_FP)
27 return true;
Mark Rutland611a7bc72017-10-11 14:01:03 +010028
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -030029 return false;
30 }
Mark Rutland611a7bc72017-10-11 14:01:03 +010031
32Where software relies on a feature described by a hwcap, it should check
33the relevant hwcap flag to verify that the feature is present before
34attempting to make use of the feature.
35
36Features cannot be probed reliably through other means. When a feature
37is not available, attempting to use it may result in unpredictable
38behaviour, and is not guaranteed to result in any reliable indication
39that the feature is unavailable, such as a SIGILL.
40
41
422. Interpretation of hwcaps
43---------------------------
44
45The majority of hwcaps are intended to indicate the presence of features
46which are described by architected ID registers inaccessible to
47userspace code at EL0. These hwcaps are defined in terms of ID register
48fields, and should be interpreted with reference to the definition of
49these fields in the ARM Architecture Reference Manual (ARM ARM).
50
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -030051Such hwcaps are described below in the form::
Mark Rutland611a7bc72017-10-11 14:01:03 +010052
53 Functionality implied by idreg.field == val.
54
55Such hwcaps indicate the availability of functionality that the ARM ARM
56defines as being present when idreg.field has value val, but do not
57indicate that idreg.field is precisely equal to val, nor do they
58indicate the absence of functionality implied by other values of
59idreg.field.
60
61Other hwcaps may indicate the presence of features which cannot be
62described by ID registers alone. These may be described without
63reference to ID registers, and may refer to other documentation.
64
65
663. The hwcaps exposed in AT_HWCAP
67---------------------------------
68
69HWCAP_FP
Mark Rutland611a7bc72017-10-11 14:01:03 +010070 Functionality implied by ID_AA64PFR0_EL1.FP == 0b0000.
71
72HWCAP_ASIMD
Mark Rutland611a7bc72017-10-11 14:01:03 +010073 Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0000.
74
75HWCAP_EVTSTRM
Mark Rutland611a7bc72017-10-11 14:01:03 +010076 The generic timer is configured to generate events at a frequency of
Catalin Marinas5d8505f2021-05-05 14:28:45 +010077 approximately 10KHz.
Mark Rutland611a7bc72017-10-11 14:01:03 +010078
79HWCAP_AES
Giacomo Travaglini4bfbe5e2018-10-01 15:24:47 +010080 Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0001.
Mark Rutland611a7bc72017-10-11 14:01:03 +010081
82HWCAP_PMULL
Giacomo Travaglini4bfbe5e2018-10-01 15:24:47 +010083 Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0010.
Mark Rutland611a7bc72017-10-11 14:01:03 +010084
85HWCAP_SHA1
Mark Rutland611a7bc72017-10-11 14:01:03 +010086 Functionality implied by ID_AA64ISAR0_EL1.SHA1 == 0b0001.
87
88HWCAP_SHA2
Mark Rutland611a7bc72017-10-11 14:01:03 +010089 Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0001.
90
91HWCAP_CRC32
Mark Rutland611a7bc72017-10-11 14:01:03 +010092 Functionality implied by ID_AA64ISAR0_EL1.CRC32 == 0b0001.
93
94HWCAP_ATOMICS
Mark Rutland611a7bc72017-10-11 14:01:03 +010095 Functionality implied by ID_AA64ISAR0_EL1.Atomic == 0b0010.
96
97HWCAP_FPHP
Mark Rutland611a7bc72017-10-11 14:01:03 +010098 Functionality implied by ID_AA64PFR0_EL1.FP == 0b0001.
99
100HWCAP_ASIMDHP
Mark Rutland611a7bc72017-10-11 14:01:03 +0100101 Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0001.
102
103HWCAP_CPUID
Mark Rutland611a7bc72017-10-11 14:01:03 +0100104 EL0 access to certain ID registers is available, to the extent
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -0300105 described by Documentation/arm64/cpu-feature-registers.rst.
Mark Rutland611a7bc72017-10-11 14:01:03 +0100106
107 These ID registers may imply the availability of features.
108
109HWCAP_ASIMDRDM
Mark Rutland611a7bc72017-10-11 14:01:03 +0100110 Functionality implied by ID_AA64ISAR0_EL1.RDM == 0b0001.
111
112HWCAP_JSCVT
Mark Rutland611a7bc72017-10-11 14:01:03 +0100113 Functionality implied by ID_AA64ISAR1_EL1.JSCVT == 0b0001.
114
115HWCAP_FCMA
Mark Rutland611a7bc72017-10-11 14:01:03 +0100116 Functionality implied by ID_AA64ISAR1_EL1.FCMA == 0b0001.
117
118HWCAP_LRCPC
Mark Rutland611a7bc72017-10-11 14:01:03 +0100119 Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0001.
120
121HWCAP_DCPOP
Mark Rutland611a7bc72017-10-11 14:01:03 +0100122 Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0001.
123
124HWCAP_SHA3
Mark Rutland611a7bc72017-10-11 14:01:03 +0100125 Functionality implied by ID_AA64ISAR0_EL1.SHA3 == 0b0001.
126
127HWCAP_SM3
Mark Rutland611a7bc72017-10-11 14:01:03 +0100128 Functionality implied by ID_AA64ISAR0_EL1.SM3 == 0b0001.
129
130HWCAP_SM4
Mark Rutland611a7bc72017-10-11 14:01:03 +0100131 Functionality implied by ID_AA64ISAR0_EL1.SM4 == 0b0001.
132
133HWCAP_ASIMDDP
Mark Rutland611a7bc72017-10-11 14:01:03 +0100134 Functionality implied by ID_AA64ISAR0_EL1.DP == 0b0001.
135
136HWCAP_SHA512
Giacomo Travaglini4bfbe5e2018-10-01 15:24:47 +0100137 Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0010.
Dave Martin43994d82017-10-31 15:51:19 +0000138
139HWCAP_SVE
Dave Martin43994d82017-10-31 15:51:19 +0000140 Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001.
Dongjiu Geng3b3b6812017-12-13 18:13:56 +0800141
Julien Grall3a25e462019-10-03 12:12:09 +0100142HWCAP_ASIMDFHM
143 Functionality implied by ID_AA64ISAR0_EL1.FHM == 0b0001.
144
145HWCAP_DIT
146 Functionality implied by ID_AA64PFR0_EL1.DIT == 0b0001.
147
148HWCAP_USCAT
149 Functionality implied by ID_AA64MMFR2_EL1.AT == 0b0001.
150
151HWCAP_ILRCPC
152 Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0010.
153
154HWCAP_FLAGM
155 Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0001.
156
157HWCAP_SSBS
158 Functionality implied by ID_AA64PFR1_EL1.SSBS == 0b0010.
159
Julien Grall0f6e4c42019-10-03 12:12:10 +0100160HWCAP_SB
161 Functionality implied by ID_AA64ISAR1_EL1.SB == 0b0001.
162
Julien Grall3a25e462019-10-03 12:12:09 +0100163HWCAP_PACA
164 Functionality implied by ID_AA64ISAR1_EL1.APA == 0b0001 or
165 ID_AA64ISAR1_EL1.API == 0b0001, as described by
166 Documentation/arm64/pointer-authentication.rst.
167
168HWCAP_PACG
169 Functionality implied by ID_AA64ISAR1_EL1.GPA == 0b0001 or
170 ID_AA64ISAR1_EL1.GPI == 0b0001, as described by
171 Documentation/arm64/pointer-authentication.rst.
172
173HWCAP2_DCPODP
174
175 Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0010.
176
Dave Martin06a916f2019-04-18 18:41:38 +0100177HWCAP2_SVE2
178
179 Functionality implied by ID_AA64ZFR0_EL1.SVEVer == 0b0001.
180
181HWCAP2_SVEAES
182
183 Functionality implied by ID_AA64ZFR0_EL1.AES == 0b0001.
184
185HWCAP2_SVEPMULL
186
187 Functionality implied by ID_AA64ZFR0_EL1.AES == 0b0010.
188
189HWCAP2_SVEBITPERM
190
191 Functionality implied by ID_AA64ZFR0_EL1.BitPerm == 0b0001.
192
193HWCAP2_SVESHA3
194
195 Functionality implied by ID_AA64ZFR0_EL1.SHA3 == 0b0001.
196
197HWCAP2_SVESM4
198
199 Functionality implied by ID_AA64ZFR0_EL1.SM4 == 0b0001.
200
Mark Brown12019372019-06-18 19:10:54 +0100201HWCAP2_FLAGM2
202
203 Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0010.
204
Mark Brownca9503f2019-06-18 19:10:55 +0100205HWCAP2_FRINT
206
207 Functionality implied by ID_AA64ISAR1_EL1.FRINTTS == 0b0001.
208
Steven Priced4209d82019-12-16 11:33:37 +0000209HWCAP2_SVEI8MM
210
211 Functionality implied by ID_AA64ZFR0_EL1.I8MM == 0b0001.
212
213HWCAP2_SVEF32MM
214
215 Functionality implied by ID_AA64ZFR0_EL1.F32MM == 0b0001.
216
217HWCAP2_SVEF64MM
218
219 Functionality implied by ID_AA64ZFR0_EL1.F64MM == 0b0001.
220
221HWCAP2_SVEBF16
222
223 Functionality implied by ID_AA64ZFR0_EL1.BF16 == 0b0001.
224
225HWCAP2_I8MM
226
227 Functionality implied by ID_AA64ISAR1_EL1.I8MM == 0b0001.
228
229HWCAP2_BF16
230
231 Functionality implied by ID_AA64ISAR1_EL1.BF16 == 0b0001.
232
233HWCAP2_DGH
234
235 Functionality implied by ID_AA64ISAR1_EL1.DGH == 0b0001.
Andrew Murrayaaba0982019-04-09 10:52:40 +0100236
Richard Henderson1a50ec02020-01-21 12:58:52 +0000237HWCAP2_RNG
238
239 Functionality implied by ID_AA64ISAR0_EL1.RNDR == 0b0001.
240
Dave Martin8ef8f3602020-03-16 16:50:45 +0000241HWCAP2_BTI
242
243 Functionality implied by ID_AA64PFR0_EL1.BT == 0b0001.
244
Vincenzo Frascinodf9d7a22019-09-06 10:52:39 +0100245HWCAP2_MTE
246
247 Functionality implied by ID_AA64PFR1_EL1.MTE == 0b0010, as described
248 by Documentation/arm64/memory-tagging-extension.rst.
Dave Martin8ef8f3602020-03-16 16:50:45 +0000249
Marc Zyngierfee29f02021-10-17 13:42:25 +0100250HWCAP2_ECV
251
252 Functionality implied by ID_AA64MMFR0_EL1.ECV == 0b0001.
253
Joey Gouly5c13f042021-12-10 16:54:30 +0000254HWCAP2_AFP
255
256 Functionality implied by ID_AA64MFR1_EL1.AFP == 0b0001.
257
Joey Gouly11750112021-12-10 16:54:32 +0000258HWCAP2_RPRES
259
260 Functionality implied by ID_AA64ISAR2_EL1.RPRES == 0b0001.
261
Andrew Murrayaaba0982019-04-09 10:52:40 +01002624. Unused AT_HWCAP bits
263-----------------------
264
265For interoperation with userspace, the kernel guarantees that bits 62
266and 63 of AT_HWCAP will always be returned as 0.