powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')
[linux-block.git] / Documentation / powerpc / elf_hwcaps.rst
CommitLineData
ef1911c6
NP
1.. _elf_hwcaps_index:
2
3==================
4POWERPC ELF HWCAPs
5==================
6
7This document describes the usage and semantics of the powerpc 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 other
15discovery mechanism available to userspace code. The kernel exposes the
16presence of these features to userspace through a set of flags called HWCAPs,
17exposed in the auxiliary vector.
18
19Userspace software can test for features by acquiring the AT_HWCAP or
20AT_HWCAP2 entry of the auxiliary vector, and testing whether the relevant
21flags are set, e.g.::
22
23 bool floating_point_is_present(void)
24 {
25 unsigned long HWCAPs = getauxval(AT_HWCAP);
26 if (HWCAPs & PPC_FEATURE_HAS_FPU)
27 return true;
28
29 return false;
30 }
31
32Where software relies on a feature described by a HWCAP, it should check the
33relevant HWCAP flag to verify that the feature is present before attempting to
34make use of the feature.
35
36HWCAP is the preferred method to test for the presence of a feature rather
37than probing through other means, which may not be reliable or may cause
38unpredictable behaviour.
39
40Software that targets a particular platform does not necessarily have to
41test for required or implied features. For example if the program requires
42FPU, VMX, VSX, it is not necessary to test those HWCAPs, and it may be
43impossible to do so if the compiler generates code requiring those features.
44
452. Facilities
46-------------
47
48The Power ISA uses the term "facility" to describe a class of instructions,
49registers, interrupts, etc. The presence or absence of a facility indicates
50whether this class is available to be used, but the specifics depend on the
51ISA version. For example, if the VSX facility is available, the VSX
52instructions that can be used differ between the v3.0B and v3.1B ISA
53versions.
54
553. Categories
56-------------
57
58The Power ISA before v3.0 uses the term "category" to describe certain
59classes of instructions and operating modes which may be optional or
60mutually exclusive, the exact meaning of the HWCAP flag may depend on
61context, e.g., the presence of the BOOKE feature implies that the server
62category is not implemented.
63
644. HWCAP allocation
65-------------------
66
67HWCAPs are allocated as described in Power Architecture 64-Bit ELF V2 ABI
68Specification (which will be reflected in the kernel's uapi headers).
69
705. The HWCAPs exposed in AT_HWCAP
71---------------------------------
72
73PPC_FEATURE_32
74 32-bit CPU
75
76PPC_FEATURE_64
77 64-bit CPU (userspace may be running in 32-bit mode).
78
79PPC_FEATURE_601_INSTR
80 The processor is PowerPC 601.
81 Unused in the kernel since:
82 f0ed73f3fa2c ("powerpc: Remove PowerPC 601")
83
84PPC_FEATURE_HAS_ALTIVEC
85 Vector (aka Altivec, VMX) facility is available.
86
87PPC_FEATURE_HAS_FPU
88 Floating point facility is available.
89
90PPC_FEATURE_HAS_MMU
91 Memory management unit is present and enabled.
92
93PPC_FEATURE_HAS_4xxMAC
94 The processor is 40x or 44x family.
95
96PPC_FEATURE_UNIFIED_CACHE
97 The processor has a unified L1 cache for instructions and data, as
98 found in NXP e200.
99 Unused in the kernel since:
100 39c8bf2b3cc1 ("powerpc: Retire e200 core (mpc555x processor)")
101
102PPC_FEATURE_HAS_SPE
103 Signal Processing Engine facility is available.
104
105PPC_FEATURE_HAS_EFP_SINGLE
106 Embedded Floating Point single precision operations are available.
107
108PPC_FEATURE_HAS_EFP_DOUBLE
109 Embedded Floating Point double precision operations are available.
110
111PPC_FEATURE_NO_TB
112 The timebase facility (mftb instruction) is not available.
113 This is a 601 specific HWCAP, so if it is known that the processor
114 running is not a 601, via other HWCAPs or other means, it is not
115 required to test this bit before using the timebase.
116 Unused in the kernel since:
117 f0ed73f3fa2c ("powerpc: Remove PowerPC 601")
118
119PPC_FEATURE_POWER4
120 The processor is POWER4 or PPC970/FX/MP.
121 POWER4 support dropped from the kernel since:
122 471d7ff8b51b ("powerpc/64s: Remove POWER4 support")
123
124PPC_FEATURE_POWER5
125 The processor is POWER5.
126
127PPC_FEATURE_POWER5_PLUS
128 The processor is POWER5+.
129
130PPC_FEATURE_CELL
131 The processor is Cell.
132
133PPC_FEATURE_BOOKE
134 The processor implements the embedded category ("BookE") architecture.
135
136PPC_FEATURE_SMT
137 The processor implements SMT.
138
139PPC_FEATURE_ICACHE_SNOOP
140 The processor icache is coherent with the dcache, and instruction storage
141 can be made consistent with data storage for the purpose of executing
142 instructions with the sequence (as described in, e.g., POWER9 Processor
143 User's Manual, 4.6.2.2 Instruction Cache Block Invalidate (icbi)):
144 sync
145 icbi (to any address)
146 isync
147
148PPC_FEATURE_ARCH_2_05
149 The processor supports the v2.05 userlevel architecture. Processors
150 supporting later architectures DO NOT set this feature.
151
152PPC_FEATURE_PA6T
153 The processor is PA6T.
154
155PPC_FEATURE_HAS_DFP
156 DFP facility is available.
157
158PPC_FEATURE_POWER6_EXT
159 The processor is POWER6.
160
161PPC_FEATURE_ARCH_2_06
162 The processor supports the v2.06 userlevel architecture. Processors
163 supporting later architectures also set this feature.
164
165PPC_FEATURE_HAS_VSX
166 VSX facility is available.
167
168PPC_FEATURE_PSERIES_PERFMON_COMPAT
169 The processor supports architected PMU events in the range 0xE0-0xFF.
170
171PPC_FEATURE_TRUE_LE
172 The processor supports true little-endian mode.
173
174PPC_FEATURE_PPC_LE
175 The processor supports "PowerPC Little-Endian", that uses address
176 munging to make storage access appear to be little-endian, but the
177 data is stored in a different format that is unsuitable to be
178 accessed by other agents not running in this mode.
179
1806. The HWCAPs exposed in AT_HWCAP2
181----------------------------------
182
183PPC_FEATURE2_ARCH_2_07
184 The processor supports the v2.07 userlevel architecture. Processors
185 supporting later architectures also set this feature.
186
187PPC_FEATURE2_HTM
188 Transactional Memory feature is available.
189
190PPC_FEATURE2_DSCR
191 DSCR facility is available.
192
193PPC_FEATURE2_EBB
194 EBB facility is available.
195
196PPC_FEATURE2_ISEL
197 isel instruction is available. This is superseded by ARCH_2_07 and
198 later.
199
200PPC_FEATURE2_TAR
201 TAR facility is available.
202
203PPC_FEATURE2_VEC_CRYPTO
204 v2.07 crypto instructions are available.
205
206PPC_FEATURE2_HTM_NOSC
207 System calls fail if called in a transactional state, see
208 Documentation/powerpc/syscall64-abi.rst
209
210PPC_FEATURE2_ARCH_3_00
211 The processor supports the v3.0B / v3.0C userlevel architecture. Processors
212 supporting later architectures also set this feature.
213
214PPC_FEATURE2_HAS_IEEE128
215 IEEE 128-bit binary floating point is supported with VSX
216 quad-precision instructions and data types.
217
218PPC_FEATURE2_DARN
219 darn instruction is available.
220
221PPC_FEATURE2_SCV
222 The scv 0 instruction may be used for system calls, see
223 Documentation/powerpc/syscall64-abi.rst.
224
225PPC_FEATURE2_HTM_NO_SUSPEND
226 A limited Transactional Memory facility that does not support suspend is
227 available, see Documentation/powerpc/transactional_memory.rst.
228
229PPC_FEATURE2_ARCH_3_1
230 The processor supports the v3.1 userlevel architecture. Processors
231 supporting later architectures also set this feature.
232
233PPC_FEATURE2_MMA
234 MMA facility is available.