blob: 91f79529c58c51c75955d4da5a51d9211cc0ad61 [file] [log] [blame]
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -03001================
Mark Rutland611a7bc72017-10-11 14:01:03 +01002ARM64 ELF hwcaps
3================
4
5This document describes the usage and semantics of the arm64 ELF hwcaps.
6
7
81. Introduction
9---------------
10
11Some hardware or software features are only available on some CPU
12implementations, and/or with certain kernel configurations, but have no
13architected discovery mechanism available to userspace code at EL0. The
14kernel exposes the presence of these features to userspace through a set
15of flags called hwcaps, exposed in the auxilliary vector.
16
Andrew Murrayaaba0982019-04-09 10:52:40 +010017Userspace software can test for features by acquiring the AT_HWCAP or
18AT_HWCAP2 entry of the auxiliary vector, and testing whether the relevant
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -030019flags are set, e.g.::
Mark Rutland611a7bc72017-10-11 14:01:03 +010020
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -030021 bool floating_point_is_present(void)
22 {
23 unsigned long hwcaps = getauxval(AT_HWCAP);
24 if (hwcaps & HWCAP_FP)
25 return true;
Mark Rutland611a7bc72017-10-11 14:01:03 +010026
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -030027 return false;
28 }
Mark Rutland611a7bc72017-10-11 14:01:03 +010029
30Where software relies on a feature described by a hwcap, it should check
31the relevant hwcap flag to verify that the feature is present before
32attempting to make use of the feature.
33
34Features cannot be probed reliably through other means. When a feature
35is not available, attempting to use it may result in unpredictable
36behaviour, and is not guaranteed to result in any reliable indication
37that the feature is unavailable, such as a SIGILL.
38
39
402. Interpretation of hwcaps
41---------------------------
42
43The majority of hwcaps are intended to indicate the presence of features
44which are described by architected ID registers inaccessible to
45userspace code at EL0. These hwcaps are defined in terms of ID register
46fields, and should be interpreted with reference to the definition of
47these fields in the ARM Architecture Reference Manual (ARM ARM).
48
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -030049Such hwcaps are described below in the form::
Mark Rutland611a7bc72017-10-11 14:01:03 +010050
51 Functionality implied by idreg.field == val.
52
53Such hwcaps indicate the availability of functionality that the ARM ARM
54defines as being present when idreg.field has value val, but do not
55indicate that idreg.field is precisely equal to val, nor do they
56indicate the absence of functionality implied by other values of
57idreg.field.
58
59Other hwcaps may indicate the presence of features which cannot be
60described by ID registers alone. These may be described without
61reference to ID registers, and may refer to other documentation.
62
63
643. The hwcaps exposed in AT_HWCAP
65---------------------------------
66
67HWCAP_FP
Mark Rutland611a7bc72017-10-11 14:01:03 +010068 Functionality implied by ID_AA64PFR0_EL1.FP == 0b0000.
69
70HWCAP_ASIMD
Mark Rutland611a7bc72017-10-11 14:01:03 +010071 Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0000.
72
73HWCAP_EVTSTRM
Mark Rutland611a7bc72017-10-11 14:01:03 +010074 The generic timer is configured to generate events at a frequency of
75 approximately 100KHz.
76
77HWCAP_AES
Giacomo Travaglini4bfbe5e2018-10-01 15:24:47 +010078 Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0001.
Mark Rutland611a7bc72017-10-11 14:01:03 +010079
80HWCAP_PMULL
Giacomo Travaglini4bfbe5e2018-10-01 15:24:47 +010081 Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0010.
Mark Rutland611a7bc72017-10-11 14:01:03 +010082
83HWCAP_SHA1
Mark Rutland611a7bc72017-10-11 14:01:03 +010084 Functionality implied by ID_AA64ISAR0_EL1.SHA1 == 0b0001.
85
86HWCAP_SHA2
Mark Rutland611a7bc72017-10-11 14:01:03 +010087 Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0001.
88
89HWCAP_CRC32
Mark Rutland611a7bc72017-10-11 14:01:03 +010090 Functionality implied by ID_AA64ISAR0_EL1.CRC32 == 0b0001.
91
92HWCAP_ATOMICS
Mark Rutland611a7bc72017-10-11 14:01:03 +010093 Functionality implied by ID_AA64ISAR0_EL1.Atomic == 0b0010.
94
95HWCAP_FPHP
Mark Rutland611a7bc72017-10-11 14:01:03 +010096 Functionality implied by ID_AA64PFR0_EL1.FP == 0b0001.
97
98HWCAP_ASIMDHP
Mark Rutland611a7bc72017-10-11 14:01:03 +010099 Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0001.
100
101HWCAP_CPUID
Mark Rutland611a7bc72017-10-11 14:01:03 +0100102 EL0 access to certain ID registers is available, to the extent
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -0300103 described by Documentation/arm64/cpu-feature-registers.rst.
Mark Rutland611a7bc72017-10-11 14:01:03 +0100104
105 These ID registers may imply the availability of features.
106
107HWCAP_ASIMDRDM
Mark Rutland611a7bc72017-10-11 14:01:03 +0100108 Functionality implied by ID_AA64ISAR0_EL1.RDM == 0b0001.
109
110HWCAP_JSCVT
Mark Rutland611a7bc72017-10-11 14:01:03 +0100111 Functionality implied by ID_AA64ISAR1_EL1.JSCVT == 0b0001.
112
113HWCAP_FCMA
Mark Rutland611a7bc72017-10-11 14:01:03 +0100114 Functionality implied by ID_AA64ISAR1_EL1.FCMA == 0b0001.
115
116HWCAP_LRCPC
Mark Rutland611a7bc72017-10-11 14:01:03 +0100117 Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0001.
118
119HWCAP_DCPOP
Mark Rutland611a7bc72017-10-11 14:01:03 +0100120 Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0001.
121
Andrew Murray671db582019-04-09 10:52:43 +0100122HWCAP2_DCPODP
123
124 Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0010.
125
Mark Rutland611a7bc72017-10-11 14:01:03 +0100126HWCAP_SHA3
Mark Rutland611a7bc72017-10-11 14:01:03 +0100127 Functionality implied by ID_AA64ISAR0_EL1.SHA3 == 0b0001.
128
129HWCAP_SM3
Mark Rutland611a7bc72017-10-11 14:01:03 +0100130 Functionality implied by ID_AA64ISAR0_EL1.SM3 == 0b0001.
131
132HWCAP_SM4
Mark Rutland611a7bc72017-10-11 14:01:03 +0100133 Functionality implied by ID_AA64ISAR0_EL1.SM4 == 0b0001.
134
135HWCAP_ASIMDDP
Mark Rutland611a7bc72017-10-11 14:01:03 +0100136 Functionality implied by ID_AA64ISAR0_EL1.DP == 0b0001.
137
138HWCAP_SHA512
Giacomo Travaglini4bfbe5e2018-10-01 15:24:47 +0100139 Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0010.
Dave Martin43994d82017-10-31 15:51:19 +0000140
141HWCAP_SVE
Dave Martin43994d82017-10-31 15:51:19 +0000142 Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001.
Dongjiu Geng3b3b6812017-12-13 18:13:56 +0800143
Dave Martin06a916f2019-04-18 18:41:38 +0100144HWCAP2_SVE2
145
146 Functionality implied by ID_AA64ZFR0_EL1.SVEVer == 0b0001.
147
148HWCAP2_SVEAES
149
150 Functionality implied by ID_AA64ZFR0_EL1.AES == 0b0001.
151
152HWCAP2_SVEPMULL
153
154 Functionality implied by ID_AA64ZFR0_EL1.AES == 0b0010.
155
156HWCAP2_SVEBITPERM
157
158 Functionality implied by ID_AA64ZFR0_EL1.BitPerm == 0b0001.
159
160HWCAP2_SVESHA3
161
162 Functionality implied by ID_AA64ZFR0_EL1.SHA3 == 0b0001.
163
164HWCAP2_SVESM4
165
166 Functionality implied by ID_AA64ZFR0_EL1.SM4 == 0b0001.
167
Dongjiu Geng3b3b6812017-12-13 18:13:56 +0800168HWCAP_ASIMDFHM
Dongjiu Geng3b3b6812017-12-13 18:13:56 +0800169 Functionality implied by ID_AA64ISAR0_EL1.FHM == 0b0001.
Suzuki K Poulose7206dc92018-03-12 10:04:14 +0000170
171HWCAP_DIT
Suzuki K Poulose7206dc92018-03-12 10:04:14 +0000172 Functionality implied by ID_AA64PFR0_EL1.DIT == 0b0001.
173
174HWCAP_USCAT
Suzuki K Poulose7206dc92018-03-12 10:04:14 +0000175 Functionality implied by ID_AA64MMFR2_EL1.AT == 0b0001.
176
177HWCAP_ILRCPC
Giacomo Travaglini4bfbe5e2018-10-01 15:24:47 +0100178 Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0010.
Suzuki K Poulose7206dc92018-03-12 10:04:14 +0000179
180HWCAP_FLAGM
Suzuki K Poulose7206dc92018-03-12 10:04:14 +0000181 Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0001.
Will Deaconee911762018-10-01 15:24:48 +0100182
Mark Brown12019372019-06-18 19:10:54 +0100183HWCAP2_FLAGM2
184
185 Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0010.
186
Will Deaconee911762018-10-01 15:24:48 +0100187HWCAP_SSBS
Will Deaconee911762018-10-01 15:24:48 +0100188 Functionality implied by ID_AA64PFR1_EL1.SSBS == 0b0010.
Mark Rutlandfbedc592018-12-07 18:39:31 +0000189
190HWCAP_PACA
Mark Rutlandfbedc592018-12-07 18:39:31 +0000191 Functionality implied by ID_AA64ISAR1_EL1.APA == 0b0001 or
192 ID_AA64ISAR1_EL1.API == 0b0001, as described by
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -0300193 Documentation/arm64/pointer-authentication.rst.
Mark Rutlandfbedc592018-12-07 18:39:31 +0000194
195HWCAP_PACG
Mark Rutlandfbedc592018-12-07 18:39:31 +0000196 Functionality implied by ID_AA64ISAR1_EL1.GPA == 0b0001 or
197 ID_AA64ISAR1_EL1.GPI == 0b0001, as described by
Mauro Carvalho Chehabb693d0b2019-06-12 14:52:38 -0300198 Documentation/arm64/pointer-authentication.rst.
Andrew Murrayaaba0982019-04-09 10:52:40 +0100199
Mark Brownca9503f2019-06-18 19:10:55 +0100200HWCAP2_FRINT
201
202 Functionality implied by ID_AA64ISAR1_EL1.FRINTTS == 0b0001.
203
Andrew Murrayaaba0982019-04-09 10:52:40 +0100204
2054. Unused AT_HWCAP bits
206-----------------------
207
208For interoperation with userspace, the kernel guarantees that bits 62
209and 63 of AT_HWCAP will always be returned as 0.