perf intel-pt: Factor out intel_pt_8b_tsc()
[linux/fpc-iii.git] / Documentation / arm64 / elf_hwcaps.txt
blobb73a2519ecf231d74ab36f68a9fa2cfdee8af6ac
1 ARM64 ELF hwcaps
2 ================
4 This document describes the usage and semantics of the arm64 ELF hwcaps.
7 1. Introduction
8 ---------------
10 Some hardware or software features are only available on some CPU
11 implementations, and/or with certain kernel configurations, but have no
12 architected discovery mechanism available to userspace code at EL0. The
13 kernel exposes the presence of these features to userspace through a set
14 of flags called hwcaps, exposed in the auxilliary vector.
16 Userspace software can test for features by acquiring the AT_HWCAP or
17 AT_HWCAP2 entry of the auxiliary vector, and testing whether the relevant
18 flags are set, e.g.
20 bool floating_point_is_present(void)
22         unsigned long hwcaps = getauxval(AT_HWCAP);
23         if (hwcaps & HWCAP_FP)
24                 return true;
26         return false;
29 Where software relies on a feature described by a hwcap, it should check
30 the relevant hwcap flag to verify that the feature is present before
31 attempting to make use of the feature.
33 Features cannot be probed reliably through other means. When a feature
34 is not available, attempting to use it may result in unpredictable
35 behaviour, and is not guaranteed to result in any reliable indication
36 that the feature is unavailable, such as a SIGILL.
39 2. Interpretation of hwcaps
40 ---------------------------
42 The majority of hwcaps are intended to indicate the presence of features
43 which are described by architected ID registers inaccessible to
44 userspace code at EL0. These hwcaps are defined in terms of ID register
45 fields, and should be interpreted with reference to the definition of
46 these fields in the ARM Architecture Reference Manual (ARM ARM).
48 Such hwcaps are described below in the form:
50     Functionality implied by idreg.field == val.
52 Such hwcaps indicate the availability of functionality that the ARM ARM
53 defines as being present when idreg.field has value val, but do not
54 indicate that idreg.field is precisely equal to val, nor do they
55 indicate the absence of functionality implied by other values of
56 idreg.field.
58 Other hwcaps may indicate the presence of features which cannot be
59 described by ID registers alone. These may be described without
60 reference to ID registers, and may refer to other documentation.
63 3. The hwcaps exposed in AT_HWCAP
64 ---------------------------------
66 HWCAP_FP
68     Functionality implied by ID_AA64PFR0_EL1.FP == 0b0000.
70 HWCAP_ASIMD
72     Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0000.
74 HWCAP_EVTSTRM
76     The generic timer is configured to generate events at a frequency of
77     approximately 100KHz.
79 HWCAP_AES
81     Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0001.
83 HWCAP_PMULL
85     Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0010.
87 HWCAP_SHA1
89     Functionality implied by ID_AA64ISAR0_EL1.SHA1 == 0b0001.
91 HWCAP_SHA2
93     Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0001.
95 HWCAP_CRC32
97     Functionality implied by ID_AA64ISAR0_EL1.CRC32 == 0b0001.
99 HWCAP_ATOMICS
101     Functionality implied by ID_AA64ISAR0_EL1.Atomic == 0b0010.
103 HWCAP_FPHP
105     Functionality implied by ID_AA64PFR0_EL1.FP == 0b0001.
107 HWCAP_ASIMDHP
109     Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0001.
111 HWCAP_CPUID
113     EL0 access to certain ID registers is available, to the extent
114     described by Documentation/arm64/cpu-feature-registers.txt.
116     These ID registers may imply the availability of features.
118 HWCAP_ASIMDRDM
120     Functionality implied by ID_AA64ISAR0_EL1.RDM == 0b0001.
122 HWCAP_JSCVT
124     Functionality implied by ID_AA64ISAR1_EL1.JSCVT == 0b0001.
126 HWCAP_FCMA
128     Functionality implied by ID_AA64ISAR1_EL1.FCMA == 0b0001.
130 HWCAP_LRCPC
132     Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0001.
134 HWCAP_DCPOP
136     Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0001.
138 HWCAP2_DCPODP
140     Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0010.
142 HWCAP_SHA3
144     Functionality implied by ID_AA64ISAR0_EL1.SHA3 == 0b0001.
146 HWCAP_SM3
148     Functionality implied by ID_AA64ISAR0_EL1.SM3 == 0b0001.
150 HWCAP_SM4
152     Functionality implied by ID_AA64ISAR0_EL1.SM4 == 0b0001.
154 HWCAP_ASIMDDP
156     Functionality implied by ID_AA64ISAR0_EL1.DP == 0b0001.
158 HWCAP_SHA512
160     Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0010.
162 HWCAP_SVE
164     Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001.
166 HWCAP2_SVE2
168     Functionality implied by ID_AA64ZFR0_EL1.SVEVer == 0b0001.
170 HWCAP2_SVEAES
172     Functionality implied by ID_AA64ZFR0_EL1.AES == 0b0001.
174 HWCAP2_SVEPMULL
176     Functionality implied by ID_AA64ZFR0_EL1.AES == 0b0010.
178 HWCAP2_SVEBITPERM
180     Functionality implied by ID_AA64ZFR0_EL1.BitPerm == 0b0001.
182 HWCAP2_SVESHA3
184     Functionality implied by ID_AA64ZFR0_EL1.SHA3 == 0b0001.
186 HWCAP2_SVESM4
188     Functionality implied by ID_AA64ZFR0_EL1.SM4 == 0b0001.
190 HWCAP_ASIMDFHM
192    Functionality implied by ID_AA64ISAR0_EL1.FHM == 0b0001.
194 HWCAP_DIT
196     Functionality implied by ID_AA64PFR0_EL1.DIT == 0b0001.
198 HWCAP_USCAT
200     Functionality implied by ID_AA64MMFR2_EL1.AT == 0b0001.
202 HWCAP_ILRCPC
204     Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0010.
206 HWCAP_FLAGM
208     Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0001.
210 HWCAP_SSBS
212     Functionality implied by ID_AA64PFR1_EL1.SSBS == 0b0010.
214 HWCAP_PACA
216     Functionality implied by ID_AA64ISAR1_EL1.APA == 0b0001 or
217     ID_AA64ISAR1_EL1.API == 0b0001, as described by
218     Documentation/arm64/pointer-authentication.txt.
220 HWCAP_PACG
222     Functionality implied by ID_AA64ISAR1_EL1.GPA == 0b0001 or
223     ID_AA64ISAR1_EL1.GPI == 0b0001, as described by
224     Documentation/arm64/pointer-authentication.txt.
227 4. Unused AT_HWCAP bits
228 -----------------------
230 For interoperation with userspace, the kernel guarantees that bits 62
231 and 63 of AT_HWCAP will always be returned as 0.