Merge branch 'arm-detect-pmull' of https://github.com/sitsofe/fio
authorJens Axboe <axboe@kernel.dk>
Mon, 6 Dec 2021 20:26:52 +0000 (13:26 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 6 Dec 2021 20:26:52 +0000 (13:26 -0700)
* 'arm-detect-pmull' of https://github.com/sitsofe/fio:
  os: detect PMULL support before enabling accelerated crc32c on ARM

os/os-linux.h

index 808f1d022779c8ba7ca0fda0470bfa5783262fd0..3001140ca486630d6bb60a2958c01d824fbd7fc8 100644 (file)
@@ -20,6 +20,9 @@
 
 #ifdef ARCH_HAVE_CRC_CRYPTO
 #include <sys/auxv.h>
+#ifndef HWCAP_PMULL
+#define HWCAP_PMULL             (1 << 4)
+#endif /* HWCAP_PMULL */
 #ifndef HWCAP_CRC32
 #define HWCAP_CRC32             (1 << 7)
 #endif /* HWCAP_CRC32 */
@@ -405,7 +408,8 @@ static inline bool os_cpu_has(cpu_features feature)
 #ifdef ARCH_HAVE_CRC_CRYPTO
        case CPU_ARM64_CRC32C:
                hwcap = getauxval(AT_HWCAP);
-               have_feature = (hwcap & HWCAP_CRC32) != 0;
+               have_feature = (hwcap & (HWCAP_PMULL | HWCAP_CRC32)) ==
+                              (HWCAP_PMULL | HWCAP_CRC32);
                break;
 #endif
        default: