arm64: cpufeature: Add feature for CRC32 instructions

* Add a CRC32 feature bit and wire it up to the CPU id register so we
   will be able to use alternatives patching for CRC32 operations.

Change-Id: Iae808f77016c242c74475f75a85190465088c6f8
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Ard Biesheuvel 2018-08-27 13:02:43 +02:00 committed by Richard Raya
parent 76816685f8
commit 87f52cf992
2 changed files with 11 additions and 1 deletions

View File

@ -49,7 +49,8 @@
#define ARM64_WORKAROUND_1188873 29
#define ARM64_SPECTRE_BHB 30
#define ARM64_WORKAROUND_1742098 31
#define ARM64_HAS_CRC32 32
#define ARM64_NCAPS 32
#define ARM64_NCAPS 33
#endif /* __ASM_CPUCAPS_H */

View File

@ -1240,6 +1240,15 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
.cpu_enable = cpu_enable_hw_dbm,
},
#endif
{
.desc = "CRC32 instructions",
.capability = ARM64_HAS_CRC32,
.type = ARM64_CPUCAP_SYSTEM_FEATURE,
.matches = has_cpuid_feature,
.sys_reg = SYS_ID_AA64ISAR0_EL1,
.field_pos = ID_AA64ISAR0_CRC32_SHIFT,
.min_field_value = 1,
},
#ifdef CONFIG_ARM64_SSBD
{
.desc = "Speculative Store Bypassing Safe (SSBS)",