]> git.baikalelectronics.ru Git - kernel.git/commitdiff
arm64: cpufeature: add feature for CRC32 instructions
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 27 Aug 2018 11:02:43 +0000 (13:02 +0200)
committerCatalin Marinas <catalin.marinas@arm.com>
Mon, 10 Sep 2018 15:10:09 +0000 (16:10 +0100)
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.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/cpucaps.h
arch/arm64/kernel/cpufeature.c

index ae1f70450fb2129b5c195be0678ae9935bb3a450..9932aca9704b33ea9f95b472291053869b9f44b9 100644 (file)
@@ -51,7 +51,8 @@
 #define ARM64_SSBD                             30
 #define ARM64_MISMATCHED_CACHE_TYPE            31
 #define ARM64_HAS_STAGE2_FWB                   32
+#define ARM64_HAS_CRC32                                33
 
-#define ARM64_NCAPS                            33
+#define ARM64_NCAPS                            34
 
 #endif /* __ASM_CPUCAPS_H */
index e238b7932096d5641de25a6f16a9292cc1f3d517..7626b80128f5c519be891045a2801b77b74c9fe3 100644 (file)
@@ -1222,6 +1222,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,
+       },
        {},
 };