[PATCH 2/3] hwf-arm: add ARMv9 SVE2 and optional Crypto Extension HW features

Tianjia Zhang tianjia.zhang at linux.alibaba.com
Wed Jul 20 10:25:36 CEST 2022


* doc/gcrypt.texi: Add "sve2, sveaes, svepmull, svesha3, svesm4" to
ARM hardware features list.
* src/g10lib.h (HWF_ARM_SVE2, HWF_ARM_SVEAES, HWF_ARM_SVEPMULL)
(HWF_ARM_SVESHA3, HWF_ARM_SVESM4): New.
* src/hwf-arm.c (arm_features): Add
"sve2, sveaes, svepmull, svesha3, svesm4".
* src/hwfeatures.c (hwflist): Add
"arm-sve2, arm-sveaes, arm-svepmull, arm-svesha3, arm-svesm4".
--

Signed-off-by: Tianjia Zhang <tianjia.zhang at linux.alibaba.com>
---
 doc/gcrypt.texi  |  5 +++++
 src/g10lib.h     |  5 +++++
 src/hwf-arm.c    | 21 +++++++++++++++++++++
 src/hwfeatures.c |  5 +++++
 4 files changed, 36 insertions(+)

diff --git a/doc/gcrypt.texi b/doc/gcrypt.texi
index 5e07926bdaf0..f2c1cc948d23 100644
--- a/doc/gcrypt.texi
+++ b/doc/gcrypt.texi
@@ -602,6 +602,11 @@ are
 @item arm-sm4
 @item arm-sha512
 @item arm-sve
+ at item arm-sve2
+ at item arm-sveaes
+ at item arm-svepmull
+ at item arm-svesha3
+ at item arm-svesm4
 @item ppc-vcrypto
 @item ppc-arch_3_00
 @item ppc-arch_2_07
diff --git a/src/g10lib.h b/src/g10lib.h
index 91d53ff37d96..8ba0a5c2aa0f 100644
--- a/src/g10lib.h
+++ b/src/g10lib.h
@@ -252,6 +252,11 @@ char **_gcry_strtokenize (const char *string, const char *delim);
 #define HWF_ARM_SM4             (1 << 7)
 #define HWF_ARM_SHA512          (1 << 8)
 #define HWF_ARM_SVE             (1 << 9)
+#define HWF_ARM_SVE2            (1 << 10)
+#define HWF_ARM_SVEAES          (1 << 11)
+#define HWF_ARM_SVEPMULL        (1 << 12)
+#define HWF_ARM_SVESHA3         (1 << 13)
+#define HWF_ARM_SVESM4          (1 << 14)
 
 #elif defined(HAVE_CPU_ARCH_PPC)
 
diff --git a/src/hwf-arm.c b/src/hwf-arm.c
index 3b6563190a9c..969cfde6b87a 100644
--- a/src/hwf-arm.c
+++ b/src/hwf-arm.c
@@ -153,6 +153,22 @@ static const struct feature_map_s arm_features[] =
 # define HWCAP_SVE    (1 << 22)
 #endif
 
+#ifndef HWCAP2_SVE2
+# define HWCAP2_SVE2        (1 << 1)
+#endif
+#ifndef HWCAP2_SVEAES
+# define HWCAP2_SVEAES      (1 << 2)
+#endif
+#ifndef HWCAP2_SVEPMULL
+# define HWCAP2_SVEPMULL    (1 << 3)
+#endif
+#ifndef HWCAP2_SVESHA3
+# define HWCAP2_SVESHA3     (1 << 5)
+#endif
+#ifndef HWCAP2_SVESM4
+# define HWCAP2_SVESM4      (1 << 6)
+#endif
+
 static const struct feature_map_s arm_features[] =
   {
 #ifdef ENABLE_NEON_SUPPORT
@@ -170,6 +186,11 @@ static const struct feature_map_s arm_features[] =
 #endif
 #ifdef ENABLE_SVE_SUPPORT
     { HWCAP_SVE, 0, " sve",  HWF_ARM_SVE },
+    { 0, HWCAP2_SVE2, " sve2",  HWF_ARM_SVE2 },
+    { 0, HWCAP2_SVEAES, " sveaes",  HWF_ARM_SVEAES },
+    { 0, HWCAP2_SVEPMULL, " svepmull",  HWF_ARM_SVEPMULL },
+    { 0, HWCAP2_SVESHA3, " svesha3",  HWF_ARM_SVESHA3 },
+    { 0, HWCAP2_SVESM4, " svesm4",  HWF_ARM_SVESM4 },
 #endif
   };
 
diff --git a/src/hwfeatures.c b/src/hwfeatures.c
index dec5efd3c196..b11cadefa9ef 100644
--- a/src/hwfeatures.c
+++ b/src/hwfeatures.c
@@ -75,6 +75,11 @@ static struct
     { HWF_ARM_SM4,             "arm-sm4" },
     { HWF_ARM_SHA512,          "arm-sha512" },
     { HWF_ARM_SVE,             "arm-sve" },
+    { HWF_ARM_SVE2,            "arm-sve2" },
+    { HWF_ARM_SVEAES,          "arm-sveaes" },
+    { HWF_ARM_SVEPMULL,        "arm-svepmull" },
+    { HWF_ARM_SVESHA3,         "arm-svesha3" },
+    { HWF_ARM_SVESM4,          "arm-svesm4" },
 #elif defined(HAVE_CPU_ARCH_PPC)
     { HWF_PPC_VCRYPTO,         "ppc-vcrypto" },
     { HWF_PPC_ARCH_3_00,       "ppc-arch_3_00" },
-- 
2.24.3 (Apple Git-128)




More information about the Gcrypt-devel mailing list