elf_hwcaps.txt 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. ARM64 ELF hwcaps
  2. ================
  3. This document describes the usage and semantics of the arm64 ELF hwcaps.
  4. 1. Introduction
  5. ---------------
  6. Some hardware or software features are only available on some CPU
  7. implementations, and/or with certain kernel configurations, but have no
  8. architected discovery mechanism available to userspace code at EL0. The
  9. kernel exposes the presence of these features to userspace through a set
  10. of flags called hwcaps, exposed in the auxilliary vector.
  11. Userspace software can test for features by acquiring the AT_HWCAP entry
  12. of the auxilliary vector, and testing whether the relevant flags are
  13. set, e.g.
  14. bool floating_point_is_present(void)
  15. {
  16. unsigned long hwcaps = getauxval(AT_HWCAP);
  17. if (hwcaps & HWCAP_FP)
  18. return true;
  19. return false;
  20. }
  21. Where software relies on a feature described by a hwcap, it should check
  22. the relevant hwcap flag to verify that the feature is present before
  23. attempting to make use of the feature.
  24. Features cannot be probed reliably through other means. When a feature
  25. is not available, attempting to use it may result in unpredictable
  26. behaviour, and is not guaranteed to result in any reliable indication
  27. that the feature is unavailable, such as a SIGILL.
  28. 2. Interpretation of hwcaps
  29. ---------------------------
  30. The majority of hwcaps are intended to indicate the presence of features
  31. which are described by architected ID registers inaccessible to
  32. userspace code at EL0. These hwcaps are defined in terms of ID register
  33. fields, and should be interpreted with reference to the definition of
  34. these fields in the ARM Architecture Reference Manual (ARM ARM).
  35. Such hwcaps are described below in the form:
  36. Functionality implied by idreg.field == val.
  37. Such hwcaps indicate the availability of functionality that the ARM ARM
  38. defines as being present when idreg.field has value val, but do not
  39. indicate that idreg.field is precisely equal to val, nor do they
  40. indicate the absence of functionality implied by other values of
  41. idreg.field.
  42. Other hwcaps may indicate the presence of features which cannot be
  43. described by ID registers alone. These may be described without
  44. reference to ID registers, and may refer to other documentation.
  45. 3. The hwcaps exposed in AT_HWCAP
  46. ---------------------------------
  47. HWCAP_FP
  48. Functionality implied by ID_AA64PFR0_EL1.FP == 0b0000.
  49. HWCAP_ASIMD
  50. Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0000.
  51. HWCAP_EVTSTRM
  52. The generic timer is configured to generate events at a frequency of
  53. approximately 100KHz.
  54. HWCAP_AES
  55. Functionality implied by ID_AA64ISAR1_EL1.AES == 0b0001.
  56. HWCAP_PMULL
  57. Functionality implied by ID_AA64ISAR1_EL1.AES == 0b0010.
  58. HWCAP_SHA1
  59. Functionality implied by ID_AA64ISAR0_EL1.SHA1 == 0b0001.
  60. HWCAP_SHA2
  61. Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0001.
  62. HWCAP_CRC32
  63. Functionality implied by ID_AA64ISAR0_EL1.CRC32 == 0b0001.
  64. HWCAP_ATOMICS
  65. Functionality implied by ID_AA64ISAR0_EL1.Atomic == 0b0010.
  66. HWCAP_FPHP
  67. Functionality implied by ID_AA64PFR0_EL1.FP == 0b0001.
  68. HWCAP_ASIMDHP
  69. Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0001.
  70. HWCAP_CPUID
  71. EL0 access to certain ID registers is available, to the extent
  72. described by Documentation/arm64/cpu-feature-registers.txt.
  73. These ID registers may imply the availability of features.
  74. HWCAP_ASIMDRDM
  75. Functionality implied by ID_AA64ISAR0_EL1.RDM == 0b0001.
  76. HWCAP_JSCVT
  77. Functionality implied by ID_AA64ISAR1_EL1.JSCVT == 0b0001.
  78. HWCAP_FCMA
  79. Functionality implied by ID_AA64ISAR1_EL1.FCMA == 0b0001.
  80. HWCAP_LRCPC
  81. Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0001.
  82. HWCAP_DCPOP
  83. Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0001.
  84. HWCAP_SHA3
  85. Functionality implied by ID_AA64ISAR0_EL1.SHA3 == 0b0001.
  86. HWCAP_SM3
  87. Functionality implied by ID_AA64ISAR0_EL1.SM3 == 0b0001.
  88. HWCAP_SM4
  89. Functionality implied by ID_AA64ISAR0_EL1.SM4 == 0b0001.
  90. HWCAP_ASIMDDP
  91. Functionality implied by ID_AA64ISAR0_EL1.DP == 0b0001.
  92. HWCAP_SHA512
  93. Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0002.
  94. HWCAP_SVE
  95. Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001.
  96. HWCAP_ASIMDFHM
  97. Functionality implied by ID_AA64ISAR0_EL1.FHM == 0b0001.
  98. HWCAP_DIT
  99. Functionality implied by ID_AA64PFR0_EL1.DIT == 0b0001.
  100. HWCAP_USCAT
  101. Functionality implied by ID_AA64MMFR2_EL1.AT == 0b0001.
  102. HWCAP_ILRCPC
  103. Functionality implied by ID_AA64ISR1_EL1.LRCPC == 0b0002.
  104. HWCAP_FLAGM
  105. Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0001.
  106. HWCAP_SSBS
  107. Functionality implied by ID_AA64PFR1_EL1.SSBS == 0b0010.