elf_hwcaps.rst 7.1 KB

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