Skip to contentSkip to conversation

Add RISC-V cryptography extensions standardisation

RFC PATCH In review Lawrence Hunter 5 participants 48 messages Jan 19, 2023 – Feb 8, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Add RISC-V cryptography extensions standardisation

This RFC introduces an implementation for the six instruction sets of the draft RISC-V cryptography extensions standardisation specification. Once the specification has been ratified we will submit these changes as a pull request email to this mailing list. Would this be prefered by instruction group or unified as in this RFC?

This patch set implements the instruction sets as per the 20221202 version of the specification (1).

Work performed by Dickon, Lawrence, Nazar, Kiran, and William from Codethink sponsored by SiFive, and Max Chou from SiFive.

1. https://github.com/riscv/riscv-crypto/releases

Dickon Hood (1):
target/riscv: Add vrol.[vv,vx] and vror.[vv,vx,vi] decoding,
translation and execution support

Kiran Ostrolenk (4):
target/riscv: Add vsha2ms.vv decoding, translation and execution
support
target/riscv: add zvksh cpu property
target/riscv: Add vsm3c.vi decoding, translation and execution support target/riscv: expose zvksh cpu property

Lawrence Hunter (16):
target/riscv: Add vclmul.vv decoding, translation and execution
support
target/riscv: Add vclmul.vx decoding, translation and execution
support
target/riscv: Add vclmulh.vv decoding, translation and execution
support
target/riscv: Add vclmulh.vx decoding, translation and execution
support
target/riscv: Add vaesef.vv decoding, translation and execution
support
target/riscv: Add vaesef.vs decoding, translation and execution
support
target/riscv: Add vaesdf.vv decoding, translation and execution
support
target/riscv: Add vaesdf.vs decoding, translation and execution
support
target/riscv: Add vaesdm.vv decoding, translation and execution
support
target/riscv: Add vaesdm.vs decoding, translation and execution
support
target/riscv: Add vaesz.vs decoding, translation and execution support target/riscv: Add vsha2c[hl].vv decoding, translation and execution
support
target/riscv: Add vsm3me.vv decoding, translation and execution
support
target/riscv: add zvkg cpu property
target/riscv: Add vghmac.vv decoding, translation and execution
support
target/riscv: expose zvkg cpu property

Max Chou (5):
crypto: Move SM4_SBOXWORD from target/riscv
crypto: Add SM4 constant parameter CK.
target/riscv: Add zvksed cfg property
target/riscv: Add Zvksed support
target/riscv: Expose Zvksed property

Nazar Kazakov (10):
target/riscv: add zvkb cpu property
target/riscv: Add vrev8.v decoding, translation and execution support target/riscv: Add vandn.[vv,vx,vi] decoding, translation and execution
support
target/riscv: expose zvkb cpu property
target/riscv: add zvkns cpu property
target/riscv: Add vaeskf1.vi decoding, translation and execution
support
target/riscv: Add vaeskf2.vi decoding, translation and execution
support
target/riscv: expose zvkns cpu property
target/riscv: add zvknh cpu properties
target/riscv: expose zvknh cpu properties

William Salmon (3):
target/riscv: Add vbrev8.v decoding, translation and execution support target/riscv: Add vaesem.vv decoding, translation and execution
support
target/riscv: Add vaesem.vs decoding, translation and execution
support

 crypto/sm4.c                                 |   10 +
 include/crypto/sm4.h                         |    8 +
 include/qemu/bitops.h                        |   32 +
 target/arm/crypto_helper.c                   |   10 +-
 target/riscv/cpu.c                           |   15 +
 target/riscv/cpu.h                           |    7 +
 target/riscv/crypto_helper.c                 |    1 +
 target/riscv/helper.h                        |   69 ++
 target/riscv/insn32.decode                   |   48 +
 target/riscv/insn_trans/trans_rvzvkb.c.inc   |  164 +++
 target/riscv/insn_trans/trans_rvzvkg.c.inc   |    8 +
 target/riscv/insn_trans/trans_rvzvknh.c.inc  |   47 +
 target/riscv/insn_trans/trans_rvzvkns.c.inc  |  121 +++
 target/riscv/insn_trans/trans_rvzvksed.c.inc |   38 +
 target/riscv/insn_trans/trans_rvzvksh.c.inc  |   20 +
 target/riscv/meson.build                     |    4 +-
 target/riscv/translate.c                     |    6 +
 target/riscv/vcrypto_helper.c                | 1013 ++++++++++++++++++
 target/riscv/vector_helper.c                 |  242 +----
 target/riscv/vector_internals.c              |   63 ++
 target/riscv/vector_internals.h              |  226 ++++
 21 files changed, 1902 insertions(+), 250 deletions(-)
 create mode 100644 target/riscv/insn_trans/trans_rvzvkb.c.inc
 create mode 100644 target/riscv/insn_trans/trans_rvzvkg.c.inc
 create mode 100644 target/riscv/insn_trans/trans_rvzvknh.c.inc
 create mode 100644 target/riscv/insn_trans/trans_rvzvkns.c.inc
 create mode 100644 target/riscv/insn_trans/trans_rvzvksed.c.inc
 create mode 100644 target/riscv/insn_trans/trans_rvzvksh.c.inc
 create mode 100644 target/riscv/vcrypto_helper.c
 create mode 100644 target/riscv/vector_internals.c
 create mode 100644 target/riscv/vector_internals.h
Signature · 1 line
2.39.1
#1 lore raw

RFC PATCH 1/39 target/riscv: add zvkb cpu property

From: Nazar Kazakov <[email protected]>

---
 target/riscv/cpu.c | 1 +
 target/riscv/cpu.h | 1 +
 2 files changed, 2 insertions(+)
target/riscv/cpu.c +1 -0
index cc75ca7667..ec1dbd923d 100644
@@ -100,6 +100,7 @@ static const struct isa_ext_data isa_edata_arr[] = {
     ISA_EXT_DATA_ENTRY(zkt, true, PRIV_VERSION_1_12_0, ext_zkt),
     ISA_EXT_DATA_ENTRY(zve32f, true, PRIV_VERSION_1_12_0, ext_zve32f),
     ISA_EXT_DATA_ENTRY(zve64f, true, PRIV_VERSION_1_12_0, ext_zve64f),
+    ISA_EXT_DATA_ENTRY(zvkb, true, PRIV_VERSION_1_12_0, ext_zvkb),
     ISA_EXT_DATA_ENTRY(zhinx, true, PRIV_VERSION_1_12_0, ext_zhinx),
     ISA_EXT_DATA_ENTRY(zhinxmin, true, PRIV_VERSION_1_12_0, ext_zhinxmin),
     ISA_EXT_DATA_ENTRY(smaia, true, PRIV_VERSION_1_12_0, ext_smaia),
target/riscv/cpu.h +1 -0
index f5609b62a2..d4824ad0bb 100644
@@ -461,6 +461,7 @@ struct RISCVCPUConfig {
     bool ext_zhinxmin;
     bool ext_zve32f;
     bool ext_zve64f;
+    bool ext_zvkb;
     bool ext_zmmul;
     bool ext_smaia;
     bool ext_ssaia;
Signature · 1 line
2.39.1
#2 lore raw

RFC PATCH 2/39 target/riscv: Add vclmul.vv decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                      |   3 +
 target/riscv/insn32.decode                 |   3 +
 target/riscv/insn_trans/trans_rvzvkb.c.inc |  41 +++++++
 target/riscv/meson.build                   |   4 +-
 target/riscv/translate.c                   |   1 +
 target/riscv/vcrypto_helper.c              |  23 ++++
 target/riscv/vector_helper.c               | 120 +--------------------
 target/riscv/vector_internals.c            |  39 +++++++
 target/riscv/vector_internals.h            | 116 ++++++++++++++++++++
 9 files changed, 230 insertions(+), 120 deletions(-)
 create mode 100644 target/riscv/insn_trans/trans_rvzvkb.c.inc
 create mode 100644 target/riscv/vcrypto_helper.c
 create mode 100644 target/riscv/vector_internals.c
 create mode 100644 target/riscv/vector_internals.h
target/riscv/helper.h +3 -0
index 227c7122ef..e9127c9ccb 100644
@@ -1136,3 +1136,6 @@ DEF_HELPER_FLAGS_1(aes64im, TCG_CALL_NO_RWG_SE, tl, tl)
 
 DEF_HELPER_FLAGS_3(sm4ed, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl)
 DEF_HELPER_FLAGS_3(sm4ks, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl)
+
+/* Vector crypto functions */
+DEF_HELPER_6(vclmul_vv, void, ptr, ptr, ptr, ptr, env, i32)
target/riscv/insn32.decode +3 -0
index b7e7613ea2..5ddee69d60 100644
@@ -890,3 +890,6 @@ sm3p1       00 01000 01001 ..... 001 ..... 0010011 @r2
 # *** RV32 Zksed Standard Extension ***
 sm4ed       .. 11000 ..... ..... 000 ..... 0110011 @k_aes
 sm4ks       .. 11010 ..... ..... 000 ..... 0110011 @k_aes
+
+# *** RV64 Zvkb vector crypto extension ***
+vclmul_vv       001100 . ..... ..... 010 ..... 1010111 @r_vm
target/riscv/insn_trans/trans_rvzvkb.c.inc new file +41 -0

41 lines not on this page · raw message

target/riscv/meson.build +3 -1
index ba25164d74..5313b01e5f 100644
@@ -15,10 +15,12 @@ riscv_ss.add(files(
   'gdbstub.c',
   'op_helper.c',
   'vector_helper.c',
+  'vector_internals.c',
   'bitmanip_helper.c',
   'translate.c',
   'm128_helper.c',
-  'crypto_helper.c'
+  'crypto_helper.c',
+  'vcrypto_helper.c'
 ))
 riscv_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('kvm-stub.c'))
 
target/riscv/translate.c +1 -0
index df38db7553..71684c10f3 100644
@@ -1063,6 +1063,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
 #include "insn_trans/trans_rvzawrs.c.inc"
 #include "insn_trans/trans_rvzfh.c.inc"
 #include "insn_trans/trans_rvk.c.inc"
+#include "insn_trans/trans_rvzvkb.c.inc"
 #include "insn_trans/trans_privileged.c.inc"
 #include "insn_trans/trans_svinval.c.inc"
 #include "insn_trans/trans_xventanacondops.c.inc"
target/riscv/vcrypto_helper.c new file +23 -0
new file mode 100644
index 0000000000..8a11e56754
@@ -0,0 +1,23 @@
+#include "qemu/osdep.h"
+#include "qemu/host-utils.h"
+#include "qemu/bitops.h"
+#include "cpu.h"
+#include "exec/memop.h"
+#include "exec/exec-all.h"
+#include "exec/helper-proto.h"
+#include "tcg/tcg-gvec-desc.h"
+#include "internals.h"
+#include "vector_internals.h"
+
+static void do_vclmul_vv(void *vd, void *vs1, void *vs2, int i)
+{
+    uint64_t result = 0;
+    for (int j = 63; j >= 0; j--) {
+        if ((((uint64_t *)vs1)[i] >> j) & 1) {
+            result ^= (((uint64_t *)vs2)[i] << j);
+        }
+    }
+    ((uint64_t *)vd)[i] = result;
+}
+
+GEN_VEXT_VV(vclmul_vv, 8)
target/riscv/vector_helper.c +1 -119

162 lines not on this page · raw message

target/riscv/vector_internals.c new file +39 -0
new file mode 100644
index 0000000000..a264797882
@@ -0,0 +1,39 @@
+#include "vector_internals.h"
+
+/* set agnostic elements to 1s */
+void vext_set_elems_1s(void *base, uint32_t is_agnostic, uint32_t cnt,
+                       uint32_t tot)
+{
+    if (is_agnostic == 0) {
+        /* policy undisturbed */
+        return;
+    }
+    if (tot - cnt == 0) {
+        return ;
+    }
+    memset(base + cnt, -1, tot - cnt);
+}
+
+void do_vext_vv(void *vd, void *v0, void *vs1, void *vs2,
+                CPURISCVState *env, uint32_t desc,
+                opivv2_fn *fn, uint32_t esz)
+{
+    uint32_t vm = vext_vm(desc);
+    uint32_t vl = env->vl;
+    uint32_t total_elems = vext_get_total_elems(env, desc, esz);
+    uint32_t vta = vext_vta(desc);
+    uint32_t vma = vext_vma(desc);
+    uint32_t i;
+
+    for (i = env->vstart; i < vl; i++) {
+        if (!vm && !vext_elem_mask(v0, i)) {
+            /* set masked-off elements to 1s */
+            vext_set_elems_1s(vd, vma, i * esz, (i + 1) * esz);
+            continue;
+        }
+        fn(vd, vs1, vs2, i);
+    }
+    env->vstart = 0;
+    /* set tail elements to 1s */
+    vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz);
+}
target/riscv/vector_internals.h new file +116 -0

116 lines not on this page · raw message

Signature · 1 line
2.39.1
#3 lore raw

RFC PATCH 3/39 target/riscv: Add vclmul.vx decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                      |  1 +
 target/riscv/insn32.decode                 |  1 +
 target/riscv/insn_trans/trans_rvzvkb.c.inc | 54 ++++++++++++++++++++++
 target/riscv/vcrypto_helper.c              | 12 +++++
 target/riscv/vector_helper.c               | 36 ---------------
 target/riscv/vector_internals.c            | 24 ++++++++++
 target/riscv/vector_internals.h            | 16 +++++++
 7 files changed, 108 insertions(+), 36 deletions(-)
target/riscv/helper.h +1 -0
index e9127c9ccb..6c786ef6f3 100644
@@ -1139,3 +1139,4 @@ DEF_HELPER_FLAGS_3(sm4ks, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl)
 
 /* Vector crypto functions */
 DEF_HELPER_6(vclmul_vv, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vclmul_vx, void, ptr, ptr, tl, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index 5ddee69d60..4a7421354d 100644
@@ -893,3 +893,4 @@ sm4ks       .. 11010 ..... ..... 000 ..... 0110011 @k_aes
 
 # *** RV64 Zvkb vector crypto extension ***
 vclmul_vv       001100 . ..... ..... 010 ..... 1010111 @r_vm
+vclmul_vx       001100 . ..... ..... 110 ..... 1010111 @r_vm
target/riscv/insn_trans/trans_rvzvkb.c.inc +54 -0

57 lines not on this page · raw message

target/riscv/vcrypto_helper.c +12 -0
index 8a11e56754..c453d348ad 100644
@@ -20,4 +20,16 @@ static void do_vclmul_vv(void *vd, void *vs1, void *vs2, int i)
     ((uint64_t *)vd)[i] = result;
 }
 
+static void do_vclmul_vx(void *vd, target_long rs1, void *vs2, int i)
+{
+    uint64_t result = 0;
+    for (int j = 63; j >= 0; j--) {
+        if ((rs1 >> j) & 1) {
+            result ^= (((uint64_t *)vs2)[i] << j);
+        }
+    }
+    ((uint64_t *)vd)[i] = result;
+}
+
 GEN_VEXT_VV(vclmul_vv, 8)
+GEN_VEXT_VX(vclmul_vx, 8)
target/riscv/vector_helper.c +0 -36
index def1b21414..ab470092f6 100644
@@ -747,8 +747,6 @@ GEN_VEXT_VV(vsub_vv_h, 2)
 GEN_VEXT_VV(vsub_vv_w, 4)
 GEN_VEXT_VV(vsub_vv_d, 8)
 
-typedef void opivx2_fn(void *vd, target_long s1, void *vs2, int i);
-
 /*
  * (T1)s1 gives the real operator type.
  * (TX1)(T1)s1 expands the operator type of widen or narrow operations.
@@ -773,40 +771,6 @@ RVVCALL(OPIVX2, vrsub_vx_h, OP_SSS_H, H2, H2, DO_RSUB)
 RVVCALL(OPIVX2, vrsub_vx_w, OP_SSS_W, H4, H4, DO_RSUB)
 RVVCALL(OPIVX2, vrsub_vx_d, OP_SSS_D, H8, H8, DO_RSUB)
 
-static void do_vext_vx(void *vd, void *v0, target_long s1, void *vs2,
-                       CPURISCVState *env, uint32_t desc,
-                       opivx2_fn fn, uint32_t esz)
-{
-    uint32_t vm = vext_vm(desc);
-    uint32_t vl = env->vl;
-    uint32_t total_elems = vext_get_total_elems(env, desc, esz);
-    uint32_t vta = vext_vta(desc);
-    uint32_t vma = vext_vma(desc);
-    uint32_t i;
-
-    for (i = env->vstart; i < vl; i++) {
-        if (!vm && !vext_elem_mask(v0, i)) {
-            /* set masked-off elements to 1s */
-            vext_set_elems_1s(vd, vma, i * esz, (i + 1) * esz);
-            continue;
-        }
-        fn(vd, s1, vs2, i);
-    }
-    env->vstart = 0;
-    /* set tail elements to 1s */
-    vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz);
-}
-
-/* generate the helpers for OPIVX */
-#define GEN_VEXT_VX(NAME, ESZ)                            \
-void HELPER(NAME)(void *vd, void *v0, target_ulong s1,    \
-                  void *vs2, CPURISCVState *env,          \
-                  uint32_t desc)                          \
-{                                                         \
-    do_vext_vx(vd, v0, s1, vs2, env, desc,                \
-               do_##NAME, ESZ);                           \
-}
-
 GEN_VEXT_VX(vadd_vx_b, 1)
 GEN_VEXT_VX(vadd_vx_h, 2)
 GEN_VEXT_VX(vadd_vx_w, 4)
target/riscv/vector_internals.c +24 -0
index a264797882..b23fa4dd74 100644
@@ -37,3 +37,27 @@ void do_vext_vv(void *vd, void *v0, void *vs1, void *vs2,
     /* set tail elements to 1s */
     vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz);
 }
+
+void do_vext_vx(void *vd, void *v0, target_long s1, void *vs2,
+                CPURISCVState *env, uint32_t desc,
+                opivx2_fn fn, uint32_t esz)
+{
+    uint32_t vm = vext_vm(desc);
+    uint32_t vl = env->vl;
+    uint32_t total_elems = vext_get_total_elems(env, desc, esz);
+    uint32_t vta = vext_vta(desc);
+    uint32_t vma = vext_vma(desc);
+    uint32_t i;
+
+    for (i = env->vstart; i < vl; i++) {
+        if (!vm && !vext_elem_mask(v0, i)) {
+            /* set masked-off elements to 1s */
+            vext_set_elems_1s(vd, vma, i * esz, (i + 1) * esz);
+            continue;
+        }
+        fn(vd, s1, vs2, i);
+    }
+    env->vstart = 0;
+    /* set tail elements to 1s */
+    vext_set_elems_1s(vd, vta, vl * esz, total_elems * esz);
+}
target/riscv/vector_internals.h +16 -0
index f61803acc0..49529d2379 100644
@@ -113,4 +113,20 @@ void HELPER(NAME)(void *vd, void *v0, void *vs1,          \
                do_##NAME, ESZ);                           \
 }
 
+typedef void opivx2_fn(void *vd, target_long s1, void *vs2, int i);
+
+void do_vext_vx(void *vd, void *v0, target_long s1, void *vs2,
+                CPURISCVState *env, uint32_t desc,
+                opivx2_fn fn, uint32_t esz);
+
+/* generate the helpers for OPIVX */
+#define GEN_VEXT_VX(NAME, ESZ)                            \
+void HELPER(NAME)(void *vd, void *v0, target_ulong s1,    \
+                  void *vs2, CPURISCVState *env,          \
+                  uint32_t desc)                          \
+{                                                         \
+    do_vext_vx(vd, v0, s1, vs2, env, desc,                \
+               do_##NAME, ESZ);                           \
+}
+
 #endif /* TARGET_RISCV_VECTOR_INTERNAL_H */
Signature · 1 line
2.39.1
#4 lore raw

RFC PATCH 4/39 target/riscv: Add vclmulh.vv decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                      |  1 +
 target/riscv/insn32.decode                 |  1 +
 target/riscv/insn_trans/trans_rvzvkb.c.inc |  1 +
 target/riscv/vcrypto_helper.c              | 12 ++++++++++++
 4 files changed, 15 insertions(+)
target/riscv/helper.h +1 -0
index 6c786ef6f3..a155272701 100644
@@ -1140,3 +1140,4 @@ DEF_HELPER_FLAGS_3(sm4ks, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl)
 /* Vector crypto functions */
 DEF_HELPER_6(vclmul_vv, void, ptr, ptr, ptr, ptr, env, i32)
 DEF_HELPER_6(vclmul_vx, void, ptr, ptr, tl, ptr, env, i32)
+DEF_HELPER_6(vclmulh_vv, void, ptr, ptr, ptr, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index 4a7421354d..e26ea1df08 100644
@@ -894,3 +894,4 @@ sm4ks       .. 11010 ..... ..... 000 ..... 0110011 @k_aes
 # *** RV64 Zvkb vector crypto extension ***
 vclmul_vv       001100 . ..... ..... 010 ..... 1010111 @r_vm
 vclmul_vx       001100 . ..... ..... 110 ..... 1010111 @r_vm
+vclmulh_vv      001101 . ..... ..... 010 ..... 1010111 @r_vm
target/riscv/insn_trans/trans_rvzvkb.c.inc +1 -0
index 6e8b81136c..19ce4c7431 100644
@@ -39,6 +39,7 @@ static bool vclmul_vv_check(DisasContext *s, arg_rmrr *a)
 }
 
 GEN_VV_MASKED_TRANS(vclmul_vv, vclmul_vv_check)
+GEN_VV_MASKED_TRANS(vclmulh_vv, vclmul_vv_check)
 
 #define GEN_VX_MASKED_TRANS(NAME, CHECK)                                \
 static bool trans_##NAME(DisasContext *s, arg_rmrr *a)                  \
target/riscv/vcrypto_helper.c +12 -0
index c453d348ad..022b941131 100644
@@ -31,5 +31,17 @@ static void do_vclmul_vx(void *vd, target_long rs1, void *vs2, int i)
     ((uint64_t *)vd)[i] = result;
 }
 
+static void do_vclmulh_vv(void *vd, void *vs1, void *vs2, int i)
+{
+    __uint128_t result = 0;
+    for (int j = 63; j >= 0; j--) {
+        if ((((uint64_t *)vs1)[i] >> j) & 1) {
+            result ^= (((__uint128_t)(((uint64_t *)vs2)[i])) << j);
+        }
+    }
+    ((uint64_t *)vd)[i] = (result >> 64);
+}
+
 GEN_VEXT_VV(vclmul_vv, 8)
 GEN_VEXT_VX(vclmul_vx, 8)
+GEN_VEXT_VV(vclmulh_vv, 8)
Signature · 1 line
2.39.1
#5 lore raw

RFC PATCH 5/39 target/riscv: Add vclmulh.vx decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                      |  1 +
 target/riscv/insn32.decode                 |  1 +
 target/riscv/insn_trans/trans_rvzvkb.c.inc |  1 +
 target/riscv/vcrypto_helper.c              | 12 ++++++++++++
 4 files changed, 15 insertions(+)
target/riscv/helper.h +1 -0
index a155272701..32f1179e29 100644
@@ -1141,3 +1141,4 @@ DEF_HELPER_FLAGS_3(sm4ks, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl)
 DEF_HELPER_6(vclmul_vv, void, ptr, ptr, ptr, ptr, env, i32)
 DEF_HELPER_6(vclmul_vx, void, ptr, ptr, tl, ptr, env, i32)
 DEF_HELPER_6(vclmulh_vv, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vclmulh_vx, void, ptr, ptr, tl, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index e26ea1df08..b4d88dd1cb 100644
@@ -895,3 +895,4 @@ sm4ks       .. 11010 ..... ..... 000 ..... 0110011 @k_aes
 vclmul_vv       001100 . ..... ..... 010 ..... 1010111 @r_vm
 vclmul_vx       001100 . ..... ..... 110 ..... 1010111 @r_vm
 vclmulh_vv      001101 . ..... ..... 010 ..... 1010111 @r_vm
+vclmulh_vx      001101 . ..... ..... 110 ..... 1010111 @r_vm
target/riscv/insn_trans/trans_rvzvkb.c.inc +1 -0
index 19ce4c7431..533141e559 100644
@@ -94,3 +94,4 @@ static bool vclmul_vx_check(DisasContext *s, arg_rmrr *a)
 }
 
 GEN_VX_MASKED_TRANS(vclmul_vx, vclmul_vx_check)
+GEN_VX_MASKED_TRANS(vclmulh_vx, vclmul_vx_check)
target/riscv/vcrypto_helper.c +12 -0
index 022b941131..46e2e510c5 100644
@@ -42,6 +42,18 @@ static void do_vclmulh_vv(void *vd, void *vs1, void *vs2, int i)
     ((uint64_t *)vd)[i] = (result >> 64);
 }
 
+static void do_vclmulh_vx(void *vd, target_long rs1, void *vs2, int i)
+{
+    __uint128_t result = 0;
+    for (int j = 63; j >= 0; j--) {
+        if ((rs1 >> j) & 1) {
+            result ^= (((__uint128_t)(((uint64_t *)vs2)[i])) << j);
+        }
+    }
+    ((uint64_t *)vd)[i] = (result >> 64);
+}
+
 GEN_VEXT_VV(vclmul_vv, 8)
 GEN_VEXT_VX(vclmul_vx, 8)
 GEN_VEXT_VV(vclmulh_vv, 8)
+GEN_VEXT_VX(vclmulh_vx, 8)
Signature · 1 line
2.39.1
#6 lore raw

RFC PATCH 6/39 target/riscv: Add vrol.[vv, vx] and vror.[vv, vx, vi] decoding, translation and execution support

In reply to Lawrence Hunter

From: Dickon Hood <[email protected]>

Add an initial implementation of the vrol.* and vror.* instructions, with mappings between the RISC-V instructions and their internal TCG accelerated implmentations.

There are some missing ror helpers, so I've bodged it by converting them to rols.

---
 target/riscv/helper.h                      | 20 ++++++++
 target/riscv/insn32.decode                 |  6 +++
 target/riscv/insn_trans/trans_rvzvkb.c.inc | 20 ++++++++
 target/riscv/vcrypto_helper.c              | 58 ++++++++++++++++++++++
 target/riscv/vector_helper.c               | 45 -----------------
 target/riscv/vector_internals.h            | 52 +++++++++++++++++++
 6 files changed, 156 insertions(+), 45 deletions(-)
target/riscv/helper.h +20 -0
index 32f1179e29..e5b6b3360f 100644
@@ -1142,3 +1142,23 @@ DEF_HELPER_6(vclmul_vv, void, ptr, ptr, ptr, ptr, env, i32)
 DEF_HELPER_6(vclmul_vx, void, ptr, ptr, tl, ptr, env, i32)
 DEF_HELPER_6(vclmulh_vv, void, ptr, ptr, ptr, ptr, env, i32)
 DEF_HELPER_6(vclmulh_vx, void, ptr, ptr, tl, ptr, env, i32)
+
+DEF_HELPER_6(vror_vv_b, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vror_vv_h, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vror_vv_w, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vror_vv_d, void, ptr, ptr, ptr, ptr, env, i32)
+
+DEF_HELPER_6(vror_vx_b, void, ptr, ptr, tl, ptr, env, i32)
+DEF_HELPER_6(vror_vx_h, void, ptr, ptr, tl, ptr, env, i32)
+DEF_HELPER_6(vror_vx_w, void, ptr, ptr, tl, ptr, env, i32)
+DEF_HELPER_6(vror_vx_d, void, ptr, ptr, tl, ptr, env, i32)
+
+DEF_HELPER_6(vrol_vv_b, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vrol_vv_h, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vrol_vv_w, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vrol_vv_d, void, ptr, ptr, ptr, ptr, env, i32)
+
+DEF_HELPER_6(vrol_vx_b, void, ptr, ptr, tl, ptr, env, i32)
+DEF_HELPER_6(vrol_vx_h, void, ptr, ptr, tl, ptr, env, i32)
+DEF_HELPER_6(vrol_vx_w, void, ptr, ptr, tl, ptr, env, i32)
+DEF_HELPER_6(vrol_vx_d, void, ptr, ptr, tl, ptr, env, i32)
target/riscv/insn32.decode +6 -0
index b4d88dd1cb..725f907ad1 100644
@@ -896,3 +896,9 @@ vclmul_vv       001100 . ..... ..... 010 ..... 1010111 @r_vm
 vclmul_vx       001100 . ..... ..... 110 ..... 1010111 @r_vm
 vclmulh_vv      001101 . ..... ..... 010 ..... 1010111 @r_vm
 vclmulh_vx      001101 . ..... ..... 110 ..... 1010111 @r_vm
+vrol_vv         010101 . ..... ..... 000 ..... 1010111 @r_vm
+vrol_vx         010101 . ..... ..... 100 ..... 1010111 @r_vm
+vror_vv         010100 . ..... ..... 000 ..... 1010111 @r_vm
+vror_vx         010100 . ..... ..... 100 ..... 1010111 @r_vm
+vror_vi         010100 . ..... ..... 011 ..... 1010111 @r_vm
+vror_vi2        010101 . ..... ..... 011 ..... 1010111 @r_vm
target/riscv/insn_trans/trans_rvzvkb.c.inc +20 -0
index 533141e559..d2a7a92d42 100644
@@ -95,3 +95,23 @@ static bool vclmul_vx_check(DisasContext *s, arg_rmrr *a)
 
 GEN_VX_MASKED_TRANS(vclmul_vx, vclmul_vx_check)
 GEN_VX_MASKED_TRANS(vclmulh_vx, vclmul_vx_check)
+
+GEN_OPIVV_TRANS(vror_vv, zvkb_vv_check)
+GEN_OPIVX_TRANS(vror_vx, zvkb_vx_check)
+GEN_OPIVV_TRANS(vrol_vv, zvkb_vv_check)
+GEN_OPIVX_TRANS(vrol_vx, zvkb_vx_check)
+
+GEN_OPIVI_TRANS(vror_vi, IMM_TRUNC_SEW, vror_vx, zvkb_vx_check)
+
+/*
+ * Immediates are 5b long, and we need six for the rotate-immediate.  The
+ * decision has been taken to remove the vrol.vi instruction -- you can
+ * emulate it with a ror, after all -- and use the bottom bit of the funct6
+ * part of the opcode to encode the extra bit.  I've chosen to implement it
+ * like this because it's easy and reasonably clean.
+ */
+static bool trans_vror_vi2(DisasContext *s, arg_rmrr *a)
+{
+    a->rs1 += 32;
+    return trans_vror_vi(s, a);
+}
target/riscv/vcrypto_helper.c +58 -0

61 lines not on this page · raw message

target/riscv/vector_helper.c +0 -45

74 lines not on this page · raw message

target/riscv/vector_internals.h +52 -0

73 lines not on this page · raw message

Signature · 1 line
2.39.1
#7 lore raw

RFC PATCH 7/39 target/riscv: Add vbrev8.v decoding, translation and execution support

In reply to Lawrence Hunter

From: William Salmon <[email protected]>

---
 include/qemu/bitops.h                      | 32 +++++++++++++++++
 target/riscv/helper.h                      |  5 +++
 target/riscv/insn32.decode                 |  1 +
 target/riscv/insn_trans/trans_rvzvkb.c.inc | 41 +++++++++++++++++++++
 target/riscv/vcrypto_helper.c              | 10 ++++++
 target/riscv/vector_helper.c               | 41 ---------------------
 target/riscv/vector_internals.h            | 42 ++++++++++++++++++++++
 7 files changed, 131 insertions(+), 41 deletions(-)
include/qemu/bitops.h +32 -0
index 03213ce952..dfce1cb10c 100644
@@ -618,4 +618,36 @@ static inline uint64_t half_unshuffle64(uint64_t x)
     return x;
 }
 
+static inline uint8_t reverse_bits_byte(uint8_t x)
+{
+    x = (((x & 0b10101010) >> 1) | ((x & 0b01010101) << 1));
+    x = (((x & 0b11001100) >> 2) | ((x & 0b00110011) << 2));
+    return ((x & 0b11110000) >> 4) | ((x & 0b00001111) << 4);
+}
+
+static inline uint16_t reverse_bits_byte_2(uint16_t x)
+{
+    return (uint16_t)reverse_bits_byte(x & 0xFF) | \
+       (uint16_t)reverse_bits_byte((x >> 8) & 0xFF) << 8;
+}
+
+static inline uint32_t reverse_bits_byte_4(uint32_t x)
+{
+    return (uint32_t)reverse_bits_byte(x & 0xFF) | \
+       (uint32_t)reverse_bits_byte((x >> 8) & 0xFF) << 8 | \
+       (uint32_t)reverse_bits_byte((x >> 16) & 0xFF) << 16 | \
+       (uint32_t)reverse_bits_byte((x >> 24) & 0xFF) << 24;
+}
+
+static inline uint64_t reverse_bits_byte_8(uint64_t x)
+{
+    return (uint64_t)reverse_bits_byte(x & 0xFF) | \
+       (uint64_t)reverse_bits_byte((x >> 8) & 0xFF) << 8 | \
+       (uint64_t)reverse_bits_byte((x >> 16) & 0xFF) << 16 | \
+       (uint64_t)reverse_bits_byte((x >> 24) & 0xFF) << 24 | \
+       (uint64_t)reverse_bits_byte((x >> 32) & 0xFF) << 32 | \
+       (uint64_t)reverse_bits_byte((x >> 40) & 0xFF) << 40 | \
+       (uint64_t)reverse_bits_byte((x >> 48) & 0xFF) << 48 | \
+       (uint64_t)reverse_bits_byte((x >> 56) & 0xFF) << 56;
+}
 #endif
target/riscv/helper.h +5 -0
index e5b6b3360f..c94627d8a4 100644
@@ -1162,3 +1162,8 @@ DEF_HELPER_6(vrol_vx_b, void, ptr, ptr, tl, ptr, env, i32)
 DEF_HELPER_6(vrol_vx_h, void, ptr, ptr, tl, ptr, env, i32)
 DEF_HELPER_6(vrol_vx_w, void, ptr, ptr, tl, ptr, env, i32)
 DEF_HELPER_6(vrol_vx_d, void, ptr, ptr, tl, ptr, env, i32)
+
+DEF_HELPER_5(vbrev8_v_b, void, ptr, ptr, ptr, env, i32)
+DEF_HELPER_5(vbrev8_v_h, void, ptr, ptr, ptr, env, i32)
+DEF_HELPER_5(vbrev8_v_w, void, ptr, ptr, ptr, env, i32)
+DEF_HELPER_5(vbrev8_v_d, void, ptr, ptr, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index 725f907ad1..782632a165 100644
@@ -902,3 +902,4 @@ vror_vv         010100 . ..... ..... 000 ..... 1010111 @r_vm
 vror_vx         010100 . ..... ..... 100 ..... 1010111 @r_vm
 vror_vi         010100 . ..... ..... 011 ..... 1010111 @r_vm
 vror_vi2        010101 . ..... ..... 011 ..... 1010111 @r_vm
+vbrev8_v        010010 . ..... 01000 010 ..... 1010111 @r2_vm
target/riscv/insn_trans/trans_rvzvkb.c.inc +41 -0

44 lines not on this page · raw message

target/riscv/vcrypto_helper.c +10 -0
index 7ec75c5589..303a656141 100644
@@ -1,6 +1,7 @@
 #include "qemu/osdep.h"
 #include "qemu/host-utils.h"
 #include "qemu/bitops.h"
+#include "qemu/bswap.h"
 #include "cpu.h"
 #include "exec/memop.h"
 #include "exec/exec-all.h"
@@ -115,3 +116,12 @@ GEN_VEXT_VX(vrol_vx_b, 1)
 GEN_VEXT_VX(vrol_vx_h, 2)
 GEN_VEXT_VX(vrol_vx_w, 4)
 GEN_VEXT_VX(vrol_vx_d, 8)
+
+RVVCALL(OPIVV1, vbrev8_v_b, OP_UU_B, H1, H1, reverse_bits_byte)
+RVVCALL(OPIVV1, vbrev8_v_h, OP_UU_H, H2, H2, reverse_bits_byte_2)
+RVVCALL(OPIVV1, vbrev8_v_w, OP_UU_W, H4, H4, reverse_bits_byte_4)
+RVVCALL(OPIVV1, vbrev8_v_d, OP_UU_D, H8, H8, reverse_bits_byte_8)
+GEN_VEXT_V(vbrev8_v_b, 1)
+GEN_VEXT_V(vbrev8_v_h, 2)
+GEN_VEXT_V(vbrev8_v_w, 4)
+GEN_VEXT_V(vbrev8_v_d, 8)
target/riscv/vector_helper.c +0 -41

53 lines not on this page · raw message

target/riscv/vector_internals.h +42 -0

54 lines not on this page · raw message

Signature · 1 line
2.39.1
#8 lore raw

RFC PATCH 8/39 target/riscv: Add vrev8.v decoding, translation and execution support

In reply to Lawrence Hunter

From: Nazar Kazakov <[email protected]>

---
 target/riscv/helper.h                      |  4 ++++
 target/riscv/insn32.decode                 |  1 +
 target/riscv/insn_trans/trans_rvzvkb.c.inc |  1 +
 target/riscv/vcrypto_helper.c              | 10 ++++++++++
 4 files changed, 16 insertions(+)
target/riscv/helper.h +4 -0
index c94627d8a4..c980d52828 100644
@@ -1163,6 +1163,10 @@ DEF_HELPER_6(vrol_vx_h, void, ptr, ptr, tl, ptr, env, i32)
 DEF_HELPER_6(vrol_vx_w, void, ptr, ptr, tl, ptr, env, i32)
 DEF_HELPER_6(vrol_vx_d, void, ptr, ptr, tl, ptr, env, i32)
 
+DEF_HELPER_5(vrev8_v_b, void, ptr, ptr, ptr, env, i32)
+DEF_HELPER_5(vrev8_v_h, void, ptr, ptr, ptr, env, i32)
+DEF_HELPER_5(vrev8_v_w, void, ptr, ptr, ptr, env, i32)
+DEF_HELPER_5(vrev8_v_d, void, ptr, ptr, ptr, env, i32)
 DEF_HELPER_5(vbrev8_v_b, void, ptr, ptr, ptr, env, i32)
 DEF_HELPER_5(vbrev8_v_h, void, ptr, ptr, ptr, env, i32)
 DEF_HELPER_5(vbrev8_v_w, void, ptr, ptr, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index 782632a165..342199abc0 100644
@@ -903,3 +903,4 @@ vror_vx         010100 . ..... ..... 100 ..... 1010111 @r_vm
 vror_vi         010100 . ..... ..... 011 ..... 1010111 @r_vm
 vror_vi2        010101 . ..... ..... 011 ..... 1010111 @r_vm
 vbrev8_v        010010 . ..... 01000 010 ..... 1010111 @r2_vm
+vrev8_v         010010 . ..... 01001 010 ..... 1010111 @r2_vm
target/riscv/insn_trans/trans_rvzvkb.c.inc +1 -0
index 50eee7c0a3..b0c8347ab1 100644
@@ -156,3 +156,4 @@ static bool vxrev8_check(DisasContext *s, arg_rmr *a)
 }
 
 GEN_OPIV_TRANS(vbrev8_v, vxrev8_check)
+GEN_OPIV_TRANS(vrev8_v, vxrev8_check)
target/riscv/vcrypto_helper.c +10 -0
index 303a656141..b09fe5fa2a 100644
@@ -125,3 +125,13 @@ GEN_VEXT_V(vbrev8_v_b, 1)
 GEN_VEXT_V(vbrev8_v_h, 2)
 GEN_VEXT_V(vbrev8_v_w, 4)
 GEN_VEXT_V(vbrev8_v_d, 8)
+
+#define DO_VREV8_B(a) (a)
+RVVCALL(OPIVV1, vrev8_v_b, OP_UU_B, H1, H1, DO_VREV8_B)
+RVVCALL(OPIVV1, vrev8_v_h, OP_UU_H, H2, H2, bswap16)
+RVVCALL(OPIVV1, vrev8_v_w, OP_UU_W, H4, H4, bswap32)
+RVVCALL(OPIVV1, vrev8_v_d, OP_UU_D, H8, H8, bswap64)
+GEN_VEXT_V(vrev8_v_b, 1)
+GEN_VEXT_V(vrev8_v_h, 2)
+GEN_VEXT_V(vrev8_v_w, 4)
+GEN_VEXT_V(vrev8_v_d, 8)
Signature · 1 line
2.39.1
#9 lore raw

RFC PATCH 9/39 target/riscv: Add vandn.[vv, vx, vi] decoding, translation and execution support

In reply to Lawrence Hunter

From: Nazar Kazakov <[email protected]>

---
 target/riscv/helper.h                      |  9 +++++++++
 target/riscv/insn32.decode                 |  3 +++
 target/riscv/insn_trans/trans_rvzvkb.c.inc |  5 +++++
 target/riscv/vcrypto_helper.c              | 19 +++++++++++++++++++
 4 files changed, 36 insertions(+)
target/riscv/helper.h +9 -0
index c980d52828..5de615ea78 100644
@@ -1171,3 +1171,12 @@ DEF_HELPER_5(vbrev8_v_b, void, ptr, ptr, ptr, env, i32)
 DEF_HELPER_5(vbrev8_v_h, void, ptr, ptr, ptr, env, i32)
 DEF_HELPER_5(vbrev8_v_w, void, ptr, ptr, ptr, env, i32)
 DEF_HELPER_5(vbrev8_v_d, void, ptr, ptr, ptr, env, i32)
+
+DEF_HELPER_6(vandn_vv_b, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vandn_vv_h, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vandn_vv_w, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vandn_vv_d, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vandn_vx_b, void, ptr, ptr, tl, ptr, env, i32)
+DEF_HELPER_6(vandn_vx_h, void, ptr, ptr, tl, ptr, env, i32)
+DEF_HELPER_6(vandn_vx_w, void, ptr, ptr, tl, ptr, env, i32)
+DEF_HELPER_6(vandn_vx_d, void, ptr, ptr, tl, ptr, env, i32)
target/riscv/insn32.decode +3 -0
index 342199abc0..d6f5e4d198 100644
@@ -904,3 +904,6 @@ vror_vi         010100 . ..... ..... 011 ..... 1010111 @r_vm
 vror_vi2        010101 . ..... ..... 011 ..... 1010111 @r_vm
 vbrev8_v        010010 . ..... 01000 010 ..... 1010111 @r2_vm
 vrev8_v         010010 . ..... 01001 010 ..... 1010111 @r2_vm
+vandn_vi        000001 . ..... ..... 011 ..... 1010111 @r_vm
+vandn_vv        000001 . ..... ..... 000 ..... 1010111 @r_vm
+vandn_vx        000001 . ..... ..... 100 ..... 1010111 @r_vm
target/riscv/insn_trans/trans_rvzvkb.c.inc +5 -0
index b0c8347ab1..9f75bb3d39 100644
@@ -147,6 +147,11 @@ static bool trans_##NAME(DisasContext *s, arg_rmr * a)                 \
     return false;                                                      \
 }
 
+
+GEN_OPIVV_TRANS(vandn_vv, zvkb_vv_check)
+GEN_OPIVX_TRANS(vandn_vx, zvkb_vx_check)
+GEN_OPIVI_TRANS(vandn_vi, IMM_SX, vandn_vx, zvkb_vx_check)
+
 static bool vxrev8_check(DisasContext *s, arg_rmr *a)
 {
     return require_rvv(s) &&
target/riscv/vcrypto_helper.c +19 -0
index b09fe5fa2a..900e68dfb0 100644
@@ -135,3 +135,22 @@ GEN_VEXT_V(vrev8_v_b, 1)
 GEN_VEXT_V(vrev8_v_h, 2)
 GEN_VEXT_V(vrev8_v_w, 4)
 GEN_VEXT_V(vrev8_v_d, 8)
+
+#define DO_ANDN(a, b) ((b) & ~(a))
+RVVCALL(OPIVV2, vandn_vv_b, OP_UUU_B, H1, H1, H1, DO_ANDN)
+RVVCALL(OPIVV2, vandn_vv_h, OP_UUU_H, H2, H2, H2, DO_ANDN)
+RVVCALL(OPIVV2, vandn_vv_w, OP_UUU_W, H4, H4, H4, DO_ANDN)
+RVVCALL(OPIVV2, vandn_vv_d, OP_UUU_D, H8, H8, H8, DO_ANDN)
+GEN_VEXT_VV(vandn_vv_b, 1)
+GEN_VEXT_VV(vandn_vv_h, 2)
+GEN_VEXT_VV(vandn_vv_w, 4)
+GEN_VEXT_VV(vandn_vv_d, 8)
+
+RVVCALL(OPIVX2, vandn_vx_b, OP_UUU_B, H1, H1, DO_ANDN)
+RVVCALL(OPIVX2, vandn_vx_h, OP_UUU_H, H2, H2, DO_ANDN)
+RVVCALL(OPIVX2, vandn_vx_w, OP_UUU_W, H4, H4, DO_ANDN)
+RVVCALL(OPIVX2, vandn_vx_d, OP_UUU_D, H8, H8, DO_ANDN)
+GEN_VEXT_VX(vandn_vx_b, 1)
+GEN_VEXT_VX(vandn_vx_h, 2)
+GEN_VEXT_VX(vandn_vx_w, 4)
+GEN_VEXT_VX(vandn_vx_d, 8)
Signature · 1 line
2.39.1
#10 lore raw

RFC PATCH 10/39 target/riscv: expose zvkb cpu property

In reply to Lawrence Hunter

From: Nazar Kazakov <[email protected]>

---
 target/riscv/cpu.c | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/cpu.c +2 -0
index ec1dbd923d..a504e68196 100644
@@ -1071,6 +1071,8 @@ static Property riscv_cpu_extensions[] = {
 
     DEFINE_PROP_BOOL("zmmul", RISCVCPU, cfg.ext_zmmul, false),
 
+    DEFINE_PROP_BOOL("zvkb", RISCVCPU, cfg.ext_zvkb, false),
+
     /* Vendor-specific custom extensions */
     DEFINE_PROP_BOOL("xventanacondops", RISCVCPU, cfg.ext_XVentanaCondOps, false),
 
Signature · 1 line
2.39.1
#11 lore raw

RFC PATCH 11/39 target/riscv: add zvkns cpu property

In reply to Lawrence Hunter

From: Nazar Kazakov <[email protected]>

---
 target/riscv/cpu.c | 1 +
 target/riscv/cpu.h | 1 +
 2 files changed, 2 insertions(+)
target/riscv/cpu.c +1 -0
index a504e68196..fb8bd5c779 100644
@@ -101,6 +101,7 @@ static const struct isa_ext_data isa_edata_arr[] = {
     ISA_EXT_DATA_ENTRY(zve32f, true, PRIV_VERSION_1_12_0, ext_zve32f),
     ISA_EXT_DATA_ENTRY(zve64f, true, PRIV_VERSION_1_12_0, ext_zve64f),
     ISA_EXT_DATA_ENTRY(zvkb, true, PRIV_VERSION_1_12_0, ext_zvkb),
+    ISA_EXT_DATA_ENTRY(zvkns, true, PRIV_VERSION_1_12_0, ext_zvkns),
     ISA_EXT_DATA_ENTRY(zhinx, true, PRIV_VERSION_1_12_0, ext_zhinx),
     ISA_EXT_DATA_ENTRY(zhinxmin, true, PRIV_VERSION_1_12_0, ext_zhinxmin),
     ISA_EXT_DATA_ENTRY(smaia, true, PRIV_VERSION_1_12_0, ext_smaia),
target/riscv/cpu.h +1 -0
index d4824ad0bb..56008ef9b9 100644
@@ -462,6 +462,7 @@ struct RISCVCPUConfig {
     bool ext_zve32f;
     bool ext_zve64f;
     bool ext_zvkb;
+    bool ext_zvkns;
     bool ext_zmmul;
     bool ext_smaia;
     bool ext_ssaia;
Signature · 1 line
2.39.1
#12 lore raw

RFC PATCH 12/39 target/riscv: Add vaesef.vv decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                       |  2 +
 target/riscv/insn32.decode                  |  4 ++
 target/riscv/insn_trans/trans_rvzvkns.c.inc | 42 ++++++++++++
 target/riscv/translate.c                    |  1 +
 target/riscv/vcrypto_helper.c               | 75 +++++++++++++++++++++
 5 files changed, 124 insertions(+)
 create mode 100644 target/riscv/insn_trans/trans_rvzvkns.c.inc
target/riscv/helper.h +2 -0
index 5de615ea78..bdfa63302e 100644
@@ -1180,3 +1180,5 @@ DEF_HELPER_6(vandn_vx_b, void, ptr, ptr, tl, ptr, env, i32)
 DEF_HELPER_6(vandn_vx_h, void, ptr, ptr, tl, ptr, env, i32)
 DEF_HELPER_6(vandn_vx_w, void, ptr, ptr, tl, ptr, env, i32)
 DEF_HELPER_6(vandn_vx_d, void, ptr, ptr, tl, ptr, env, i32)
+
+DEF_HELPER_4(vaesef_vv, void, ptr, ptr, env, i32)
target/riscv/insn32.decode +4 -0
index d6f5e4d198..fdaab9a189 100644
@@ -74,6 +74,7 @@
 @r_rm    .......   ..... ..... ... ..... ....... %rs2 %rs1 %rm %rd
 @r2_rm   .......   ..... ..... ... ..... ....... %rs1 %rm %rd
 @r2      .......   ..... ..... ... ..... ....... &r2 %rs1 %rd
+@r2_vm_1 ...... . ..... ..... ... ..... ....... &rmr vm=1 %rs2 %rd
 @r2_nfvm ... ... vm:1 ..... ..... ... ..... ....... &r2nfvm %nf %rs1 %rd
 @r2_vm   ...... vm:1 ..... ..... ... ..... ....... &rmr %rs2 %rd
 @r1_vm   ...... vm:1 ..... ..... ... ..... ....... %rd
@@ -907,3 +908,6 @@ vrev8_v         010010 . ..... 01001 010 ..... 1010111 @r2_vm
 vandn_vi        000001 . ..... ..... 011 ..... 1010111 @r_vm
 vandn_vv        000001 . ..... ..... 000 ..... 1010111 @r_vm
 vandn_vx        000001 . ..... ..... 100 ..... 1010111 @r_vm
+
+# *** RV64 Zvkns vector crypto extension ***
+vaesef_vv       101000 1 ..... 00011 010 ..... 1110111 @r2_vm_1
target/riscv/insn_trans/trans_rvzvkns.c.inc new file +42 -0

42 lines not on this page · raw message

target/riscv/translate.c +1 -0
index 71684c10f3..8d39743de2 100644
@@ -1064,6 +1064,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
 #include "insn_trans/trans_rvzfh.c.inc"
 #include "insn_trans/trans_rvk.c.inc"
 #include "insn_trans/trans_rvzvkb.c.inc"
+#include "insn_trans/trans_rvzvkns.c.inc"
 #include "insn_trans/trans_privileged.c.inc"
 #include "insn_trans/trans_svinval.c.inc"
 #include "insn_trans/trans_xventanacondops.c.inc"
target/riscv/vcrypto_helper.c +75 -0

84 lines not on this page · raw message

Signature · 1 line
2.39.1
#13 lore raw

RFC PATCH 13/39 target/riscv: Add vaesef.vs decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                       |  1 +
 target/riscv/insn32.decode                  |  1 +
 target/riscv/insn_trans/trans_rvzvkns.c.inc | 18 ++++++++++
 target/riscv/vcrypto_helper.c               | 38 +++++++++++++++++++++
 4 files changed, 58 insertions(+)
target/riscv/helper.h +1 -0
index bdfa63302e..42349837ef 100644
@@ -1182,3 +1182,4 @@ DEF_HELPER_6(vandn_vx_w, void, ptr, ptr, tl, ptr, env, i32)
 DEF_HELPER_6(vandn_vx_d, void, ptr, ptr, tl, ptr, env, i32)
 
 DEF_HELPER_4(vaesef_vv, void, ptr, ptr, env, i32)
+DEF_HELPER_4(vaesef_vs, void, ptr, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index fdaab9a189..0d65c2ea27 100644
@@ -911,3 +911,4 @@ vandn_vx        000001 . ..... ..... 100 ..... 1010111 @r_vm
 
 # *** RV64 Zvkns vector crypto extension ***
 vaesef_vv       101000 1 ..... 00011 010 ..... 1110111 @r2_vm_1
+vaesef_vs       101001 1 ..... 00011 010 ..... 1110111 @r2_vm_1
target/riscv/insn_trans/trans_rvzvkns.c.inc +18 -0
index f079425614..dc4310882d 100644
@@ -39,4 +39,22 @@ static bool vaes_check_vv(DisasContext *s, arg_rmr *a)
            require_align(a->rd, s->lmul) && require_align(a->rs2, s->lmul) &&
            s->vstart % 4 == 0 && s->sew == MO_32;
 }
+
+static bool vaes_check_overlap(DisasContext *s, int vd, int vs2)
+{
+    int8_t op_size = s->lmul <= 0 ? 1 : 1 << s->lmul;
+    return !is_overlapped(vd, op_size, vs2, op_size);
+}
+
+static bool vaes_check_vs(DisasContext *s, arg_rmr *a)
+{
+    return require_rvv(s) &&
+           vaes_check_overlap(s, a->rd, a->rs2) &&
+           s->cfg_ptr->ext_zvkns == true &&
+           vext_check_isa_ill(s) &&
+           require_align(a->rd, s->lmul) && require_align(a->rs2, s->lmul) &&
+           s->vstart % 4 == 0 && s->sew == MO_32;
+}
+
 GEN_V_UNMASKED_TRANS(vaesef_vv, vaes_check_vv)
+GEN_V_UNMASKED_TRANS(vaesef_vs, vaes_check_vs)
target/riscv/vcrypto_helper.c +38 -0
index 59d7d32a05..f59e090c03 100644
@@ -226,6 +226,44 @@ void HELPER(NAME)(void *vd_vptr, void *vs2_vptr, CPURISCVState *env,      \
     vext_set_elems_1s(vd, vta, vl * 4, total_elems * 4);                  \
 }
 
+#define GEN_ZVKNS_HELPER_VS(NAME, ...)                                    \
+void HELPER(NAME)(void *vd_vptr, void *vs2_vptr, CPURISCVState *env,      \
+                  uint32_t desc)                                          \
+{                                                                         \
+    uint64_t *vd = vd_vptr;                                               \
+    uint64_t *vs2 = vs2_vptr;                                             \
+    uint32_t vl = env->vl;                                                \
+    uint32_t total_elems = vext_get_total_elems(env, desc, 4);            \
+    uint32_t vta = vext_vta(desc);                                        \
+    if (env->vl % 4 != 0) {                                               \
+        riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC());     \
+    }                                                                     \
+    for (uint32_t i = env->vstart / 4; i < env->vl / 4; i++) {            \
+        uint64_t round_key[2] = {                                         \
+            cpu_to_le64(vs2[0]),                                          \
+            cpu_to_le64(vs2[1]),                                          \
+        };                                                                \
+        uint8_t round_state[4][4];                                        \
+        cpu_to_le64s(vd + i * 2 + 0);                                     \
+        cpu_to_le64s(vd + i * 2 + 1);                                     \
+        for (int j = 0; j < 16; j++) {                                    \
+            round_state[j / 4][j % 4] = ((uint8_t *)(vd + i * 2))[j];     \
+        }                                                                 \
+        __VA_ARGS__;                                                      \
+        for (int j = 0; j < 16; j++) {                                    \
+            ((uint8_t *)(vd + i * 2))[j] = round_state[j / 4][j % 4];     \
+        }                                                                 \
+        le64_to_cpus(vd + i * 2 + 0);                                     \
+        le64_to_cpus(vd + i * 2 + 1);                                     \
+    }                                                                     \
+    env->vstart = 0;                                                      \
+    /* set tail elements to 1s */                                         \
+    vext_set_elems_1s(vd, vta, vl * 4, total_elems * 4);                  \
+}
+
 GEN_ZVKNS_HELPER_VV(vaesef_vv, aes_sub_bytes(round_state);
                     aes_shift_bytes(round_state);
                     xor_round_key(round_state, (uint8_t *)round_key);)
+GEN_ZVKNS_HELPER_VS(vaesef_vs, aes_sub_bytes(round_state);
+                    aes_shift_bytes(round_state);
+                    xor_round_key(round_state, (uint8_t *)round_key);)
Signature · 1 line
2.39.1
#14 lore raw

RFC PATCH 14/39 target/riscv: Add vaesdf.vv decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                       |  1 +
 target/riscv/insn32.decode                  |  1 +
 target/riscv/insn_trans/trans_rvzvkns.c.inc |  1 +
 target/riscv/vcrypto_helper.c               | 31 +++++++++++++++++++++
 4 files changed, 34 insertions(+)
target/riscv/helper.h +1 -0
index 42349837ef..b7696cb6c4 100644
@@ -1183,3 +1183,4 @@ DEF_HELPER_6(vandn_vx_d, void, ptr, ptr, tl, ptr, env, i32)
 
 DEF_HELPER_4(vaesef_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesef_vs, void, ptr, ptr, env, i32)
+DEF_HELPER_4(vaesdf_vv, void, ptr, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index 0d65c2ea27..ca907dac85 100644
@@ -912,3 +912,4 @@ vandn_vx        000001 . ..... ..... 100 ..... 1010111 @r_vm
 # *** RV64 Zvkns vector crypto extension ***
 vaesef_vv       101000 1 ..... 00011 010 ..... 1110111 @r2_vm_1
 vaesef_vs       101001 1 ..... 00011 010 ..... 1110111 @r2_vm_1
+vaesdf_vv       101000 1 ..... 00001 010 ..... 1110111 @r2_vm_1
target/riscv/insn_trans/trans_rvzvkns.c.inc +1 -0
index dc4310882d..bd1f380a65 100644
@@ -58,3 +58,4 @@ static bool vaes_check_vs(DisasContext *s, arg_rmr *a)
 
 GEN_V_UNMASKED_TRANS(vaesef_vv, vaes_check_vv)
 GEN_V_UNMASKED_TRANS(vaesef_vs, vaes_check_vs)
+GEN_V_UNMASKED_TRANS(vaesdf_vv, vaes_check_vv)
target/riscv/vcrypto_helper.c +31 -0
index f59e090c03..24b5336fa7 100644
@@ -191,6 +191,34 @@ static inline void xor_round_key(uint8_t round_state[4][4], uint8_t *round_key)
     }
 }
 
+static inline void aes_inv_sub_bytes(uint8_t round_state[4][4])
+{
+    for (int j = 0; j < 16; j++) {
+        round_state[j / 4][j % 4] = AES_isbox[round_state[j / 4][j % 4]];
+    }
+}
+
+static inline void aes_inv_shift_bytes(uint8_t round_state[4][4])
+{
+    uint8_t temp;
+    temp = round_state[3][1];
+    round_state[3][1] = round_state[2][1];
+    round_state[2][1] = round_state[1][1];
+    round_state[1][1] = round_state[0][1];
+    round_state[0][1] = temp;
+    temp = round_state[0][2];
+    round_state[0][2] = round_state[2][2];
+    round_state[2][2] = temp;
+    temp = round_state[1][2];
+    round_state[1][2] = round_state[3][2];
+    round_state[3][2] = temp;
+    temp = round_state[0][3];
+    round_state[0][3] = round_state[1][3];
+    round_state[1][3] = round_state[2][3];
+    round_state[2][3] = round_state[3][3];
+    round_state[3][3] = temp;
+}
+
 #define GEN_ZVKNS_HELPER_VV(NAME, ...)                                    \
 void HELPER(NAME)(void *vd_vptr, void *vs2_vptr, CPURISCVState *env,      \
                   uint32_t desc)                                          \
@@ -267,3 +295,6 @@ GEN_ZVKNS_HELPER_VV(vaesef_vv, aes_sub_bytes(round_state);
 GEN_ZVKNS_HELPER_VS(vaesef_vs, aes_sub_bytes(round_state);
                     aes_shift_bytes(round_state);
                     xor_round_key(round_state, (uint8_t *)round_key);)
+GEN_ZVKNS_HELPER_VV(vaesdf_vv, aes_inv_shift_bytes(round_state);
+                    aes_inv_sub_bytes(round_state);
+                    xor_round_key(round_state, (uint8_t *)round_key);)
Signature · 1 line
2.39.1
#15 lore raw

RFC PATCH 15/39 target/riscv: Add vaesdf.vs decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                       | 1 +
 target/riscv/insn32.decode                  | 1 +
 target/riscv/insn_trans/trans_rvzvkns.c.inc | 1 +
 target/riscv/vcrypto_helper.c               | 3 +++
 4 files changed, 6 insertions(+)
target/riscv/helper.h +1 -0
index b7696cb6c4..020b9861cf 100644
@@ -1184,3 +1184,4 @@ DEF_HELPER_6(vandn_vx_d, void, ptr, ptr, tl, ptr, env, i32)
 DEF_HELPER_4(vaesef_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesef_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdf_vv, void, ptr, ptr, env, i32)
+DEF_HELPER_4(vaesdf_vs, void, ptr, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index ca907dac85..33e5883937 100644
@@ -913,3 +913,4 @@ vandn_vx        000001 . ..... ..... 100 ..... 1010111 @r_vm
 vaesef_vv       101000 1 ..... 00011 010 ..... 1110111 @r2_vm_1
 vaesef_vs       101001 1 ..... 00011 010 ..... 1110111 @r2_vm_1
 vaesdf_vv       101000 1 ..... 00001 010 ..... 1110111 @r2_vm_1
+vaesdf_vs       101001 1 ..... 00001 010 ..... 1110111 @r2_vm_1
target/riscv/insn_trans/trans_rvzvkns.c.inc +1 -0
index bd1f380a65..7dd61b879e 100644
@@ -59,3 +59,4 @@ static bool vaes_check_vs(DisasContext *s, arg_rmr *a)
 GEN_V_UNMASKED_TRANS(vaesef_vv, vaes_check_vv)
 GEN_V_UNMASKED_TRANS(vaesef_vs, vaes_check_vs)
 GEN_V_UNMASKED_TRANS(vaesdf_vv, vaes_check_vv)
+GEN_V_UNMASKED_TRANS(vaesdf_vs, vaes_check_vs)
target/riscv/vcrypto_helper.c +3 -0
index 24b5336fa7..d3ba5e9cb8 100644
@@ -298,3 +298,6 @@ GEN_ZVKNS_HELPER_VS(vaesef_vs, aes_sub_bytes(round_state);
 GEN_ZVKNS_HELPER_VV(vaesdf_vv, aes_inv_shift_bytes(round_state);
                     aes_inv_sub_bytes(round_state);
                     xor_round_key(round_state, (uint8_t *)round_key);)
+GEN_ZVKNS_HELPER_VS(vaesdf_vs, aes_inv_shift_bytes(round_state);
+                    aes_inv_sub_bytes(round_state);
+                    xor_round_key(round_state, (uint8_t *)round_key);)
Signature · 1 line
2.39.1
#16 lore raw

RFC PATCH 16/39 target/riscv: Add vaesdm.vv decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                       |  1 +
 target/riscv/insn32.decode                  |  1 +
 target/riscv/insn_trans/trans_rvzvkns.c.inc |  1 +
 target/riscv/vcrypto_helper.c               | 36 +++++++++++++++++++++
 4 files changed, 39 insertions(+)
target/riscv/helper.h +1 -0
index 020b9861cf..328a026039 100644
@@ -1185,3 +1185,4 @@ DEF_HELPER_4(vaesef_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesef_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdf_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdf_vs, void, ptr, ptr, env, i32)
+DEF_HELPER_4(vaesdm_vv, void, ptr, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index 33e5883937..e5f3af999d 100644
@@ -914,3 +914,4 @@ vaesef_vv       101000 1 ..... 00011 010 ..... 1110111 @r2_vm_1
 vaesef_vs       101001 1 ..... 00011 010 ..... 1110111 @r2_vm_1
 vaesdf_vv       101000 1 ..... 00001 010 ..... 1110111 @r2_vm_1
 vaesdf_vs       101001 1 ..... 00001 010 ..... 1110111 @r2_vm_1
+vaesdm_vv       101000 1 ..... 00000 010 ..... 1110111 @r2_vm_1
target/riscv/insn_trans/trans_rvzvkns.c.inc +1 -0
index 7dd61b879e..21ef836fb2 100644
@@ -60,3 +60,4 @@ GEN_V_UNMASKED_TRANS(vaesef_vv, vaes_check_vv)
 GEN_V_UNMASKED_TRANS(vaesef_vs, vaes_check_vs)
 GEN_V_UNMASKED_TRANS(vaesdf_vv, vaes_check_vv)
 GEN_V_UNMASKED_TRANS(vaesdf_vs, vaes_check_vs)
+GEN_V_UNMASKED_TRANS(vaesdm_vv, vaes_check_vv)
target/riscv/vcrypto_helper.c +36 -0
index d3ba5e9cb8..bac21b5623 100644
@@ -219,6 +219,38 @@ static inline void aes_inv_shift_bytes(uint8_t round_state[4][4])
     round_state[3][3] = temp;
 }
 
+static inline uint8_t xtime(uint8_t x)
+{
+    return (x << 1) ^ (((x >> 7) & 1) * 0x1b);
+}
+
+static inline uint8_t multiply(uint8_t x, uint8_t y)
+{
+    return (((y & 1) * x) ^ ((y >> 1 & 1) * xtime(x)) ^
+            ((y >> 2 & 1) * xtime(xtime(x))) ^
+            ((y >> 3 & 1) * xtime(xtime(xtime(x)))) ^
+            ((y >> 4 & 1) * xtime(xtime(xtime(xtime(x))))));
+}
+
+static inline void aes_inv_mix_cols(uint8_t round_state[4][4])
+{
+    uint8_t a, b, c, d;
+    for (int j = 0; j < 4; ++j) {
+        a = round_state[j][0];
+        b = round_state[j][1];
+        c = round_state[j][2];
+        d = round_state[j][3];
+        round_state[j][0] = multiply(a, 0x0e) ^ multiply(b, 0x0b) ^
+                            multiply(c, 0x0d) ^ multiply(d, 0x09);
+        round_state[j][1] = multiply(a, 0x09) ^ multiply(b, 0x0e) ^
+                            multiply(c, 0x0b) ^ multiply(d, 0x0d);
+        round_state[j][2] = multiply(a, 0x0d) ^ multiply(b, 0x09) ^
+                            multiply(c, 0x0e) ^ multiply(d, 0x0b);
+        round_state[j][3] = multiply(a, 0x0b) ^ multiply(b, 0x0d) ^
+                            multiply(c, 0x09) ^ multiply(d, 0x0e);
+    }
+}
+
 #define GEN_ZVKNS_HELPER_VV(NAME, ...)                                    \
 void HELPER(NAME)(void *vd_vptr, void *vs2_vptr, CPURISCVState *env,      \
                   uint32_t desc)                                          \
@@ -301,3 +333,7 @@ GEN_ZVKNS_HELPER_VV(vaesdf_vv, aes_inv_shift_bytes(round_state);
 GEN_ZVKNS_HELPER_VS(vaesdf_vs, aes_inv_shift_bytes(round_state);
                     aes_inv_sub_bytes(round_state);
                     xor_round_key(round_state, (uint8_t *)round_key);)
+GEN_ZVKNS_HELPER_VV(vaesdm_vv, aes_inv_shift_bytes(round_state);
+                    aes_inv_sub_bytes(round_state);
+                    xor_round_key(round_state, (uint8_t *)round_key);
+                    aes_inv_mix_cols(round_state);)
Signature · 1 line
2.39.1
#17 lore raw

RFC PATCH 17/39 target/riscv: Add vaesdm.vs decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                       | 1 +
 target/riscv/insn32.decode                  | 1 +
 target/riscv/insn_trans/trans_rvzvkns.c.inc | 1 +
 target/riscv/vcrypto_helper.c               | 4 ++++
 4 files changed, 7 insertions(+)
target/riscv/helper.h +1 -0
index 328a026039..9895bf5712 100644
@@ -1186,3 +1186,4 @@ DEF_HELPER_4(vaesef_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdf_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdf_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdm_vv, void, ptr, ptr, env, i32)
+DEF_HELPER_4(vaesdm_vs, void, ptr, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index e5f3af999d..753039e954 100644
@@ -915,3 +915,4 @@ vaesef_vs       101001 1 ..... 00011 010 ..... 1110111 @r2_vm_1
 vaesdf_vv       101000 1 ..... 00001 010 ..... 1110111 @r2_vm_1
 vaesdf_vs       101001 1 ..... 00001 010 ..... 1110111 @r2_vm_1
 vaesdm_vv       101000 1 ..... 00000 010 ..... 1110111 @r2_vm_1
+vaesdm_vs       101001 1 ..... 00000 010 ..... 1110111 @r2_vm_1
target/riscv/insn_trans/trans_rvzvkns.c.inc +1 -0
index 21ef836fb2..2c70227f8b 100644
@@ -61,3 +61,4 @@ GEN_V_UNMASKED_TRANS(vaesef_vs, vaes_check_vs)
 GEN_V_UNMASKED_TRANS(vaesdf_vv, vaes_check_vv)
 GEN_V_UNMASKED_TRANS(vaesdf_vs, vaes_check_vs)
 GEN_V_UNMASKED_TRANS(vaesdm_vv, vaes_check_vv)
+GEN_V_UNMASKED_TRANS(vaesdm_vs, vaes_check_vs)
target/riscv/vcrypto_helper.c +4 -0
index bac21b5623..699bf25bbd 100644
@@ -337,3 +337,7 @@ GEN_ZVKNS_HELPER_VV(vaesdm_vv, aes_inv_shift_bytes(round_state);
                     aes_inv_sub_bytes(round_state);
                     xor_round_key(round_state, (uint8_t *)round_key);
                     aes_inv_mix_cols(round_state);)
+GEN_ZVKNS_HELPER_VS(vaesdm_vs, aes_inv_shift_bytes(round_state);
+                    aes_inv_sub_bytes(round_state);
+                    xor_round_key(round_state, (uint8_t *)round_key);
+                    aes_inv_mix_cols(round_state);)
Signature · 1 line
2.39.1
#18 lore raw

RFC PATCH 18/39 target/riscv: Add vaesz.vs decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                       | 1 +
 target/riscv/insn32.decode                  | 1 +
 target/riscv/insn_trans/trans_rvzvkns.c.inc | 5 +++--
 target/riscv/vcrypto_helper.c               | 2 ++
 4 files changed, 7 insertions(+), 2 deletions(-)
target/riscv/helper.h +1 -0
index 9895bf5712..def126a59b 100644
@@ -1187,3 +1187,4 @@ DEF_HELPER_4(vaesdf_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdf_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdm_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdm_vs, void, ptr, ptr, env, i32)
+DEF_HELPER_4(vaesz_vs, void, ptr, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index 753039e954..b4ddc2586c 100644
@@ -916,3 +916,4 @@ vaesdf_vv       101000 1 ..... 00001 010 ..... 1110111 @r2_vm_1
 vaesdf_vs       101001 1 ..... 00001 010 ..... 1110111 @r2_vm_1
 vaesdm_vv       101000 1 ..... 00000 010 ..... 1110111 @r2_vm_1
 vaesdm_vs       101001 1 ..... 00000 010 ..... 1110111 @r2_vm_1
+vaesz_vs        101001 1 ..... 00111 010 ..... 1110111 @r2_vm_1
target/riscv/insn_trans/trans_rvzvkns.c.inc +3 -2
index 2c70227f8b..145b13bc8c 100644
@@ -43,7 +43,7 @@ static bool vaes_check_vv(DisasContext *s, arg_rmr *a)
 static bool vaes_check_overlap(DisasContext *s, int vd, int vs2)
 {
     int8_t op_size = s->lmul <= 0 ? 1 : 1 << s->lmul;
-    return !is_overlapped(vd, op_size, vs2, op_size);
+    return !is_overlapped(vd, op_size, vs2, 1);
 }
 
 static bool vaes_check_vs(DisasContext *s, arg_rmr *a)
@@ -52,7 +52,7 @@ static bool vaes_check_vs(DisasContext *s, arg_rmr *a)
            vaes_check_overlap(s, a->rd, a->rs2) &&
            s->cfg_ptr->ext_zvkns == true &&
            vext_check_isa_ill(s) &&
-           require_align(a->rd, s->lmul) && require_align(a->rs2, s->lmul) &&
+           require_align(a->rd, s->lmul) &&
            s->vstart % 4 == 0 && s->sew == MO_32;
 }
 
@@ -62,3 +62,4 @@ GEN_V_UNMASKED_TRANS(vaesdf_vv, vaes_check_vv)
 GEN_V_UNMASKED_TRANS(vaesdf_vs, vaes_check_vs)
 GEN_V_UNMASKED_TRANS(vaesdm_vv, vaes_check_vv)
 GEN_V_UNMASKED_TRANS(vaesdm_vs, vaes_check_vs)
+GEN_V_UNMASKED_TRANS(vaesz_vs, vaes_check_vs)
target/riscv/vcrypto_helper.c +2 -0
index 699bf25bbd..39e2498b7d 100644
@@ -341,3 +341,5 @@ GEN_ZVKNS_HELPER_VS(vaesdm_vs, aes_inv_shift_bytes(round_state);
                     aes_inv_sub_bytes(round_state);
                     xor_round_key(round_state, (uint8_t *)round_key);
                     aes_inv_mix_cols(round_state);)
+GEN_ZVKNS_HELPER_VS(vaesz_vs,
+                    xor_round_key(round_state, (uint8_t *)round_key);)
Signature · 1 line
2.39.1
#19 lore raw

RFC PATCH 19/39 target/riscv: Add vaesem.vv decoding, translation and execution support

In reply to Lawrence Hunter

From: William Salmon <[email protected]>

---
 target/riscv/helper.h                       |  1 +
 target/riscv/insn32.decode                  |  1 +
 target/riscv/insn_trans/trans_rvzvkns.c.inc |  1 +
 target/riscv/vcrypto_helper.c               | 17 +++++++++++++++++
 4 files changed, 20 insertions(+)
target/riscv/helper.h +1 -0
index def126a59b..4bfc9a3387 100644
@@ -1185,6 +1185,7 @@ DEF_HELPER_4(vaesef_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesef_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdf_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdf_vs, void, ptr, ptr, env, i32)
+DEF_HELPER_4(vaesem_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdm_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdm_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesz_vs, void, ptr, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index b4ddc2586c..f31414f72c 100644
@@ -914,6 +914,7 @@ vaesef_vv       101000 1 ..... 00011 010 ..... 1110111 @r2_vm_1
 vaesef_vs       101001 1 ..... 00011 010 ..... 1110111 @r2_vm_1
 vaesdf_vv       101000 1 ..... 00001 010 ..... 1110111 @r2_vm_1
 vaesdf_vs       101001 1 ..... 00001 010 ..... 1110111 @r2_vm_1
+vaesem_vv       101000 1 ..... 00010 010 ..... 1110111 @r2_vm_1
 vaesdm_vv       101000 1 ..... 00000 010 ..... 1110111 @r2_vm_1
 vaesdm_vs       101001 1 ..... 00000 010 ..... 1110111 @r2_vm_1
 vaesz_vs        101001 1 ..... 00111 010 ..... 1110111 @r2_vm_1
target/riscv/insn_trans/trans_rvzvkns.c.inc +1 -0
index 145b13bc8c..2e0523ec62 100644
@@ -63,3 +63,4 @@ GEN_V_UNMASKED_TRANS(vaesdf_vs, vaes_check_vs)
 GEN_V_UNMASKED_TRANS(vaesdm_vv, vaes_check_vv)
 GEN_V_UNMASKED_TRANS(vaesdm_vs, vaes_check_vs)
 GEN_V_UNMASKED_TRANS(vaesz_vs, vaes_check_vs)
+GEN_V_UNMASKED_TRANS(vaesem_vv, vaes_check_vv)
target/riscv/vcrypto_helper.c +17 -0
index 39e2498b7d..a1d66a64aa 100644
@@ -251,6 +251,20 @@ static inline void aes_inv_mix_cols(uint8_t round_state[4][4])
     }
 }
 
+static inline void aes_mix_cols(uint8_t round_state[4][4])
+{
+    uint8_t a, b;
+    for (int j = 0; j < 4; ++j) {
+        a = round_state[j][0];
+        b = round_state[j][0] ^ round_state[j][1] ^ round_state[j][2] ^
+            round_state[j][3];
+        round_state[j][0] ^= xtime(round_state[j][0] ^ round_state[j][1]) ^ b;
+        round_state[j][1] ^= xtime(round_state[j][1] ^ round_state[j][2]) ^ b;
+        round_state[j][2] ^= xtime(round_state[j][2] ^ round_state[j][3]) ^ b;
+        round_state[j][3] ^= xtime(round_state[j][3] ^ a) ^ b;
+    }
+}
+
 #define GEN_ZVKNS_HELPER_VV(NAME, ...)                                    \
 void HELPER(NAME)(void *vd_vptr, void *vs2_vptr, CPURISCVState *env,      \
                   uint32_t desc)                                          \
@@ -333,6 +347,9 @@ GEN_ZVKNS_HELPER_VV(vaesdf_vv, aes_inv_shift_bytes(round_state);
 GEN_ZVKNS_HELPER_VS(vaesdf_vs, aes_inv_shift_bytes(round_state);
                     aes_inv_sub_bytes(round_state);
                     xor_round_key(round_state, (uint8_t *)round_key);)
+GEN_ZVKNS_HELPER_VV(vaesem_vv, aes_shift_bytes(round_state);
+                    aes_sub_bytes(round_state); aes_mix_cols(round_state);
+                    xor_round_key(round_state, (uint8_t *)round_key);)
 GEN_ZVKNS_HELPER_VV(vaesdm_vv, aes_inv_shift_bytes(round_state);
                     aes_inv_sub_bytes(round_state);
                     xor_round_key(round_state, (uint8_t *)round_key);
Signature · 1 line
2.39.1
#20 lore raw

RFC PATCH 20/39 target/riscv: Add vaesem.vs decoding, translation and execution support

In reply to Lawrence Hunter

From: William Salmon <[email protected]>

---
 target/riscv/helper.h                       | 1 +
 target/riscv/insn32.decode                  | 1 +
 target/riscv/insn_trans/trans_rvzvkns.c.inc | 1 +
 target/riscv/vcrypto_helper.c               | 3 +++
 4 files changed, 6 insertions(+)
target/riscv/helper.h +1 -0
index 4bfc9a3387..85981f2cad 100644
@@ -1186,6 +1186,7 @@ DEF_HELPER_4(vaesef_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdf_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdf_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesem_vv, void, ptr, ptr, env, i32)
+DEF_HELPER_4(vaesem_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdm_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdm_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesz_vs, void, ptr, ptr, env, i32)
target/riscv/insn32.decode +1 -0
index f31414f72c..cc91ca8794 100644
@@ -915,6 +915,7 @@ vaesef_vs       101001 1 ..... 00011 010 ..... 1110111 @r2_vm_1
 vaesdf_vv       101000 1 ..... 00001 010 ..... 1110111 @r2_vm_1
 vaesdf_vs       101001 1 ..... 00001 010 ..... 1110111 @r2_vm_1
 vaesem_vv       101000 1 ..... 00010 010 ..... 1110111 @r2_vm_1
+vaesem_vs       101001 1 ..... 00010 010 ..... 1110111 @r2_vm_1
 vaesdm_vv       101000 1 ..... 00000 010 ..... 1110111 @r2_vm_1
 vaesdm_vs       101001 1 ..... 00000 010 ..... 1110111 @r2_vm_1
 vaesz_vs        101001 1 ..... 00111 010 ..... 1110111 @r2_vm_1
target/riscv/insn_trans/trans_rvzvkns.c.inc +1 -0
index 2e0523ec62..fae48d63dc 100644
@@ -64,3 +64,4 @@ GEN_V_UNMASKED_TRANS(vaesdm_vv, vaes_check_vv)
 GEN_V_UNMASKED_TRANS(vaesdm_vs, vaes_check_vs)
 GEN_V_UNMASKED_TRANS(vaesz_vs, vaes_check_vs)
 GEN_V_UNMASKED_TRANS(vaesem_vv, vaes_check_vv)
+GEN_V_UNMASKED_TRANS(vaesem_vs, vaes_check_vs)
target/riscv/vcrypto_helper.c +3 -0
index a1d66a64aa..883739f4ac 100644
@@ -350,6 +350,9 @@ GEN_ZVKNS_HELPER_VS(vaesdf_vs, aes_inv_shift_bytes(round_state);
 GEN_ZVKNS_HELPER_VV(vaesem_vv, aes_shift_bytes(round_state);
                     aes_sub_bytes(round_state); aes_mix_cols(round_state);
                     xor_round_key(round_state, (uint8_t *)round_key);)
+GEN_ZVKNS_HELPER_VS(vaesem_vs, aes_shift_bytes(round_state);
+                    aes_sub_bytes(round_state); aes_mix_cols(round_state);
+                    xor_round_key(round_state, (uint8_t *)round_key);)
 GEN_ZVKNS_HELPER_VV(vaesdm_vv, aes_inv_shift_bytes(round_state);
                     aes_inv_sub_bytes(round_state);
                     xor_round_key(round_state, (uint8_t *)round_key);
Signature · 1 line
2.39.1
#21 lore raw

RFC PATCH 21/39 target/riscv: Add vaeskf1.vi decoding, translation and execution support

In reply to Lawrence Hunter

From: Nazar Kazakov <[email protected]>

---
 target/riscv/helper.h                       |  1 +
 target/riscv/insn32.decode                  |  1 +
 target/riscv/insn_trans/trans_rvzvkns.c.inc | 45 +++++++++++++++++++++
 target/riscv/vcrypto_helper.c               | 42 +++++++++++++++++++
 4 files changed, 89 insertions(+)
target/riscv/helper.h +1 -0
index 85981f2cad..2ac02dde01 100644
@@ -1190,3 +1190,4 @@ DEF_HELPER_4(vaesem_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdm_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdm_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesz_vs, void, ptr, ptr, env, i32)
+DEF_HELPER_5(vaeskf1_vi, void, ptr, ptr, i32, env, i32)
target/riscv/insn32.decode +1 -0
index cc91ca8794..325e2401c8 100644
@@ -919,3 +919,4 @@ vaesem_vs       101001 1 ..... 00010 010 ..... 1110111 @r2_vm_1
 vaesdm_vv       101000 1 ..... 00000 010 ..... 1110111 @r2_vm_1
 vaesdm_vs       101001 1 ..... 00000 010 ..... 1110111 @r2_vm_1
 vaesz_vs        101001 1 ..... 00111 010 ..... 1110111 @r2_vm_1
+vaeskf1_vi      100010 1 ..... ..... 010 ..... 1110111 @r_vm_1
target/riscv/insn_trans/trans_rvzvkns.c.inc +45 -0

48 lines not on this page · raw message

target/riscv/vcrypto_helper.c +42 -0

45 lines not on this page · raw message

Signature · 1 line
2.39.1
#22 lore raw

RFC PATCH 22/39 target/riscv: Add vaeskf2.vi decoding, translation and execution support

In reply to Lawrence Hunter

From: Nazar Kazakov <[email protected]>

---
 target/riscv/helper.h                       |  1 +
 target/riscv/insn32.decode                  |  1 +
 target/riscv/insn_trans/trans_rvzvkns.c.inc |  9 ++++
 target/riscv/vcrypto_helper.c               | 56 +++++++++++++++++++++
 4 files changed, 67 insertions(+)
target/riscv/helper.h +1 -0
index 2ac02dde01..312f59bb38 100644
@@ -1191,3 +1191,4 @@ DEF_HELPER_4(vaesdm_vv, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesdm_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesz_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_5(vaeskf1_vi, void, ptr, ptr, i32, env, i32)
+DEF_HELPER_5(vaeskf2_vi, void, ptr, ptr, i32, env, i32)
target/riscv/insn32.decode +1 -0
index 325e2401c8..1eed0a6b26 100644
@@ -920,3 +920,4 @@ vaesdm_vv       101000 1 ..... 00000 010 ..... 1110111 @r2_vm_1
 vaesdm_vs       101001 1 ..... 00000 010 ..... 1110111 @r2_vm_1
 vaesz_vs        101001 1 ..... 00111 010 ..... 1110111 @r2_vm_1
 vaeskf1_vi      100010 1 ..... ..... 010 ..... 1110111 @r_vm_1
+vaeskf2_vi      101010 1 ..... ..... 010 ..... 1110111 @r_vm_1
target/riscv/insn_trans/trans_rvzvkns.c.inc +9 -0
index 62c3cd83e7..0abb7811b7 100644
@@ -109,4 +109,13 @@ static bool vaeskf1_check(DisasContext *s, arg_vaeskf1_vi * a)
            a->rs1 >= 1 && a->rs1 <= 10;
 }
 
+static bool vaeskf2_check(DisasContext *s, arg_vaeskf2_vi *a)
+{
+    return require_rvv(s) && s->cfg_ptr->ext_zvkns == true &&
+           vext_check_isa_ill(s) && s->vstart % 4 == 0 && s->sew == MO_32 &&
+           require_align(a->rd, s->lmul) && require_align(a->rs2, s->lmul) &&
+           a->rs1 >= 2 && a->rs1 <= 14;
+}
+
 GEN_VI_UNMASKED_TRANS(vaeskf1_vi, vaeskf1_check)
+GEN_VI_UNMASKED_TRANS(vaeskf2_vi, vaeskf2_check)
target/riscv/vcrypto_helper.c +56 -0

59 lines not on this page · raw message

Signature · 1 line
2.39.1
#23 lore raw

RFC PATCH 23/39 target/riscv: expose zvkns cpu property

In reply to Lawrence Hunter

From: Nazar Kazakov <[email protected]>

---
 target/riscv/cpu.c | 1 +
 1 file changed, 1 insertion(+)
target/riscv/cpu.c +1 -0
index fb8bd5c779..660af57038 100644
@@ -1073,6 +1073,7 @@ static Property riscv_cpu_extensions[] = {
     DEFINE_PROP_BOOL("zmmul", RISCVCPU, cfg.ext_zmmul, false),
 
     DEFINE_PROP_BOOL("zvkb", RISCVCPU, cfg.ext_zvkb, false),
+    DEFINE_PROP_BOOL("zvkns", RISCVCPU, cfg.ext_zvkns, false),
 
     /* Vendor-specific custom extensions */
     DEFINE_PROP_BOOL("xventanacondops", RISCVCPU, cfg.ext_XVentanaCondOps, false),
Signature · 1 line
2.39.1
#24 lore raw

RFC PATCH 24/39 target/riscv: add zvknh cpu properties

In reply to Lawrence Hunter

From: Nazar Kazakov <[email protected]>

---
 target/riscv/cpu.c | 2 ++
 target/riscv/cpu.h | 2 ++
 2 files changed, 4 insertions(+)
target/riscv/cpu.c +2 -0
index 660af57038..50bc96be5c 100644
@@ -101,6 +101,8 @@ static const struct isa_ext_data isa_edata_arr[] = {
     ISA_EXT_DATA_ENTRY(zve32f, true, PRIV_VERSION_1_12_0, ext_zve32f),
     ISA_EXT_DATA_ENTRY(zve64f, true, PRIV_VERSION_1_12_0, ext_zve64f),
     ISA_EXT_DATA_ENTRY(zvkb, true, PRIV_VERSION_1_12_0, ext_zvkb),
+    ISA_EXT_DATA_ENTRY(zvknha, true, PRIV_VERSION_1_12_0, ext_zvknha),
+    ISA_EXT_DATA_ENTRY(zvknhb, true, PRIV_VERSION_1_12_0, ext_zvknhb),
     ISA_EXT_DATA_ENTRY(zvkns, true, PRIV_VERSION_1_12_0, ext_zvkns),
     ISA_EXT_DATA_ENTRY(zhinx, true, PRIV_VERSION_1_12_0, ext_zhinx),
     ISA_EXT_DATA_ENTRY(zhinxmin, true, PRIV_VERSION_1_12_0, ext_zhinxmin),
target/riscv/cpu.h +2 -0
index 56008ef9b9..ebee902806 100644
@@ -462,6 +462,8 @@ struct RISCVCPUConfig {
     bool ext_zve32f;
     bool ext_zve64f;
     bool ext_zvkb;
+    bool ext_zvknha;
+    bool ext_zvknhb;
     bool ext_zvkns;
     bool ext_zmmul;
     bool ext_smaia;
Signature · 1 line
2.39.1
#25 lore raw

RFC PATCH 25/39 target/riscv: Add vsha2ms.vv decoding, translation and execution support

In reply to Lawrence Hunter

From: Kiran Ostrolenk <[email protected]>

---
 target/riscv/helper.h                       |  2 +
 target/riscv/insn32.decode                  |  3 +
 target/riscv/insn_trans/trans_rvzvknh.c.inc | 45 ++++++++++++
 target/riscv/translate.c                    |  1 +
 target/riscv/vcrypto_helper.c               | 80 +++++++++++++++++++++
 5 files changed, 131 insertions(+)
 create mode 100644 target/riscv/insn_trans/trans_rvzvknh.c.inc
target/riscv/helper.h +2 -0
index 312f59bb38..6e7777c879 100644
@@ -1192,3 +1192,5 @@ DEF_HELPER_4(vaesdm_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_4(vaesz_vs, void, ptr, ptr, env, i32)
 DEF_HELPER_5(vaeskf1_vi, void, ptr, ptr, i32, env, i32)
 DEF_HELPER_5(vaeskf2_vi, void, ptr, ptr, i32, env, i32)
+
+DEF_HELPER_5(vsha2ms_vv, void, ptr, ptr, ptr, env, i32)
target/riscv/insn32.decode +3 -0
index 1eed0a6b26..57fbd63d91 100644
@@ -921,3 +921,6 @@ vaesdm_vs       101001 1 ..... 00000 010 ..... 1110111 @r2_vm_1
 vaesz_vs        101001 1 ..... 00111 010 ..... 1110111 @r2_vm_1
 vaeskf1_vi      100010 1 ..... ..... 010 ..... 1110111 @r_vm_1
 vaeskf2_vi      101010 1 ..... ..... 010 ..... 1110111 @r_vm_1
+
+# *** RV64 Zvknh vector crypto extension ***
+vsha2ms_vv      101101 1 ..... ..... 010 ..... 1110111 @r_vm_1
target/riscv/insn_trans/trans_rvzvknh.c.inc new file +45 -0

45 lines not on this page · raw message

target/riscv/translate.c +1 -0
index 8d39743de2..924a89de9f 100644
@@ -1065,6 +1065,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
 #include "insn_trans/trans_rvk.c.inc"
 #include "insn_trans/trans_rvzvkb.c.inc"
 #include "insn_trans/trans_rvzvkns.c.inc"
+#include "insn_trans/trans_rvzvknh.c.inc"
 #include "insn_trans/trans_privileged.c.inc"
 #include "insn_trans/trans_svinval.c.inc"
 #include "insn_trans/trans_xventanacondops.c.inc"
target/riscv/vcrypto_helper.c +80 -0

83 lines not on this page · raw message

Signature · 1 line
2.39.1
#26 lore raw

RFC PATCH 26/39 target/riscv: Add vsha2c[hl].vv decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                       |   2 +
 target/riscv/insn32.decode                  |   2 +
 target/riscv/insn_trans/trans_rvzvknh.c.inc |   2 +
 target/riscv/vcrypto_helper.c               | 153 ++++++++++++++++++++
 4 files changed, 159 insertions(+)
target/riscv/helper.h +2 -0
index 6e7777c879..911270c387 100644
@@ -1194,3 +1194,5 @@ DEF_HELPER_5(vaeskf1_vi, void, ptr, ptr, i32, env, i32)
 DEF_HELPER_5(vaeskf2_vi, void, ptr, ptr, i32, env, i32)
 
 DEF_HELPER_5(vsha2ms_vv, void, ptr, ptr, ptr, env, i32)
+DEF_HELPER_5(vsha2ch_vv, void, ptr, ptr, ptr, env, i32)
+DEF_HELPER_5(vsha2cl_vv, void, ptr, ptr, ptr, env, i32)
target/riscv/insn32.decode +2 -0
index 57fbd63d91..2387bc179c 100644
@@ -924,3 +924,5 @@ vaeskf2_vi      101010 1 ..... ..... 010 ..... 1110111 @r_vm_1
 
 # *** RV64 Zvknh vector crypto extension ***
 vsha2ms_vv      101101 1 ..... ..... 010 ..... 1110111 @r_vm_1
+vsha2ch_vv      101110 1 ..... ..... 010 ..... 1110111 @r_vm_1
+vsha2cl_vv      101111 1 ..... ..... 010 ..... 1110111 @r_vm_1
target/riscv/insn_trans/trans_rvzvknh.c.inc +2 -0
index ff30400100..4d4d26eae5 100644
@@ -43,3 +43,5 @@ static bool vsha_check(DisasContext *s, arg_rmrr *a)
 }
 
 GEN_VV_UNMASKED_TRANS(vsha2ms_vv, vsha_check)
+GEN_VV_UNMASKED_TRANS(vsha2cl_vv, vsha_check)
+GEN_VV_UNMASKED_TRANS(vsha2ch_vv, vsha_check)
target/riscv/vcrypto_helper.c +153 -0

156 lines not on this page · raw message

Signature · 1 line
2.39.1
#27 lore raw

RFC PATCH 27/39 target/riscv: expose zvknh cpu properties

In reply to Lawrence Hunter

From: Nazar Kazakov <[email protected]>

---
 target/riscv/cpu.c | 2 ++
 1 file changed, 2 insertions(+)
target/riscv/cpu.c +2 -0
index 50bc96be5c..09d9686baf 100644
@@ -1075,6 +1075,8 @@ static Property riscv_cpu_extensions[] = {
     DEFINE_PROP_BOOL("zmmul", RISCVCPU, cfg.ext_zmmul, false),
 
     DEFINE_PROP_BOOL("zvkb", RISCVCPU, cfg.ext_zvkb, false),
+    DEFINE_PROP_BOOL("zvknha", RISCVCPU, cfg.ext_zvknha, false),
+    DEFINE_PROP_BOOL("zvknhb", RISCVCPU, cfg.ext_zvknhb, false),
     DEFINE_PROP_BOOL("zvkns", RISCVCPU, cfg.ext_zvkns, false),
 
     /* Vendor-specific custom extensions */
Signature · 1 line
2.39.1
#28 lore raw

RFC PATCH 28/39 target/riscv: add zvksh cpu property

In reply to Lawrence Hunter

From: Kiran Ostrolenk <[email protected]>

---
 target/riscv/cpu.c | 1 +
 target/riscv/cpu.h | 1 +
 2 files changed, 2 insertions(+)
target/riscv/cpu.c +1 -0
index 09d9686baf..a21f1d43d4 100644
@@ -104,6 +104,7 @@ static const struct isa_ext_data isa_edata_arr[] = {
     ISA_EXT_DATA_ENTRY(zvknha, true, PRIV_VERSION_1_12_0, ext_zvknha),
     ISA_EXT_DATA_ENTRY(zvknhb, true, PRIV_VERSION_1_12_0, ext_zvknhb),
     ISA_EXT_DATA_ENTRY(zvkns, true, PRIV_VERSION_1_12_0, ext_zvkns),
+    ISA_EXT_DATA_ENTRY(zvksh, true, PRIV_VERSION_1_12_0, ext_zvksh),
     ISA_EXT_DATA_ENTRY(zhinx, true, PRIV_VERSION_1_12_0, ext_zhinx),
     ISA_EXT_DATA_ENTRY(zhinxmin, true, PRIV_VERSION_1_12_0, ext_zhinxmin),
     ISA_EXT_DATA_ENTRY(smaia, true, PRIV_VERSION_1_12_0, ext_smaia),
target/riscv/cpu.h +1 -0
index ebee902806..92624bfc57 100644
@@ -465,6 +465,7 @@ struct RISCVCPUConfig {
     bool ext_zvknha;
     bool ext_zvknhb;
     bool ext_zvkns;
+    bool ext_zvksh;
     bool ext_zmmul;
     bool ext_smaia;
     bool ext_ssaia;
Signature · 1 line
2.39.1
#29 lore raw

RFC PATCH 29/39 target/riscv: Add vsm3me.vv decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                       |  2 +
 target/riscv/insn32.decode                  |  3 ++
 target/riscv/insn_trans/trans_rvzvksh.c.inc | 12 ++++++
 target/riscv/translate.c                    |  1 +
 target/riscv/vcrypto_helper.c               | 43 +++++++++++++++++++++
 5 files changed, 61 insertions(+)
 create mode 100644 target/riscv/insn_trans/trans_rvzvksh.c.inc
target/riscv/helper.h +2 -0
index 911270c387..36e0d8eff3 100644
@@ -1196,3 +1196,5 @@ DEF_HELPER_5(vaeskf2_vi, void, ptr, ptr, i32, env, i32)
 DEF_HELPER_5(vsha2ms_vv, void, ptr, ptr, ptr, env, i32)
 DEF_HELPER_5(vsha2ch_vv, void, ptr, ptr, ptr, env, i32)
 DEF_HELPER_5(vsha2cl_vv, void, ptr, ptr, ptr, env, i32)
+
+DEF_HELPER_5(vsm3me_vv, void, ptr, ptr, ptr, env, i32)
target/riscv/insn32.decode +3 -0
index 2387bc179c..671614e354 100644
@@ -926,3 +926,6 @@ vaeskf2_vi      101010 1 ..... ..... 010 ..... 1110111 @r_vm_1
 vsha2ms_vv      101101 1 ..... ..... 010 ..... 1110111 @r_vm_1
 vsha2ch_vv      101110 1 ..... ..... 010 ..... 1110111 @r_vm_1
 vsha2cl_vv      101111 1 ..... ..... 010 ..... 1110111 @r_vm_1
+
+# *** RV64 Zvksh vector crypto extensions ***
+vsm3me_vv       100000 1 ..... ..... 010 ..... 1110111 @r_vm_1
target/riscv/insn_trans/trans_rvzvksh.c.inc new file +12 -0
new file mode 100644
index 0000000000..2956618d7e
@@ -0,0 +1,12 @@
+static inline bool vsm3_check(DisasContext *s)
+{
+    return s->cfg_ptr->ext_zvksh == true && require_rvv(s) &&
+           vext_check_isa_ill(s) && s->vstart % 8 == 0 && s->sew == MO_32;
+}
+
+static inline bool vsm3me_check(DisasContext *s, arg_rmrr *a)
+{
+    return vsm3_check(s) && vext_check_sss(s, a->rd, a->rs1, a->rs2, a->vm);
+}
+
+GEN_VV_UNMASKED_TRANS(vsm3me_vv, vsm3me_check)
target/riscv/translate.c +1 -0
index 924a89de9f..9ca2cec23a 100644
@@ -1066,6 +1066,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
 #include "insn_trans/trans_rvzvkb.c.inc"
 #include "insn_trans/trans_rvzvkns.c.inc"
 #include "insn_trans/trans_rvzvknh.c.inc"
+#include "insn_trans/trans_rvzvksh.c.inc"
 #include "insn_trans/trans_privileged.c.inc"
 #include "insn_trans/trans_svinval.c.inc"
 #include "insn_trans/trans_xventanacondops.c.inc"
target/riscv/vcrypto_helper.c +43 -0

46 lines not on this page · raw message

Signature · 1 line
2.39.1
#30 lore raw

RFC PATCH 30/39 target/riscv: Add vsm3c.vi decoding, translation and execution support

In reply to Lawrence Hunter

From: Kiran Ostrolenk <[email protected]>

---
 target/riscv/helper.h                       |  1 +
 target/riscv/insn32.decode                  |  1 +
 target/riscv/insn_trans/trans_rvzvksh.c.inc |  8 ++
 target/riscv/vcrypto_helper.c               | 90 +++++++++++++++++++++
 4 files changed, 100 insertions(+)
target/riscv/helper.h +1 -0
index 36e0d8eff3..a82103ead9 100644
@@ -1198,3 +1198,4 @@ DEF_HELPER_5(vsha2ch_vv, void, ptr, ptr, ptr, env, i32)
 DEF_HELPER_5(vsha2cl_vv, void, ptr, ptr, ptr, env, i32)
 
 DEF_HELPER_5(vsm3me_vv, void, ptr, ptr, ptr, env, i32)
+DEF_HELPER_5(vsm3c_vi, void, ptr, ptr, i32, env, i32)
target/riscv/insn32.decode +1 -0
index 671614e354..4a50114e92 100644
@@ -929,3 +929,4 @@ vsha2cl_vv      101111 1 ..... ..... 010 ..... 1110111 @r_vm_1
 
 # *** RV64 Zvksh vector crypto extensions ***
 vsm3me_vv       100000 1 ..... ..... 010 ..... 1110111 @r_vm_1
+vsm3c_vi        101011 1 ..... ..... 010 ..... 1110111 @r_vm_1
target/riscv/insn_trans/trans_rvzvksh.c.inc +8 -0
index 2956618d7e..e9b8f9a23f 100644
@@ -9,4 +9,12 @@ static inline bool vsm3me_check(DisasContext *s, arg_rmrr *a)
     return vsm3_check(s) && vext_check_sss(s, a->rd, a->rs1, a->rs2, a->vm);
 }
 
+
+static inline bool vsm3c_check(DisasContext *s, arg_rmrr *a)
+{
+    return vsm3_check(s) && a->rs1 < 32 &&
+           vext_check_ss(s, a->rd, a->rs2, a->vm);
+}
+
 GEN_VV_UNMASKED_TRANS(vsm3me_vv, vsm3me_check)
+GEN_VI_UNMASKED_TRANS(vsm3c_vi, vsm3c_check)
target/riscv/vcrypto_helper.c +90 -0

93 lines not on this page · raw message

Signature · 1 line
2.39.1
#31 lore raw

RFC PATCH 31/39 target/riscv: expose zvksh cpu property

In reply to Lawrence Hunter

From: Kiran Ostrolenk <[email protected]>

---
 target/riscv/cpu.c | 1 +
 1 file changed, 1 insertion(+)
target/riscv/cpu.c +1 -0
index a21f1d43d4..c0c2d70abf 100644
@@ -1079,6 +1079,7 @@ static Property riscv_cpu_extensions[] = {
     DEFINE_PROP_BOOL("zvknha", RISCVCPU, cfg.ext_zvknha, false),
     DEFINE_PROP_BOOL("zvknhb", RISCVCPU, cfg.ext_zvknhb, false),
     DEFINE_PROP_BOOL("zvkns", RISCVCPU, cfg.ext_zvkns, false),
+    DEFINE_PROP_BOOL("zvksh", RISCVCPU, cfg.ext_zvksh, false),
 
     /* Vendor-specific custom extensions */
     DEFINE_PROP_BOOL("xventanacondops", RISCVCPU, cfg.ext_XVentanaCondOps, false),
Signature · 1 line
2.39.1
#32 lore raw

RFC PATCH 32/39 target/riscv: add zvkg cpu property

In reply to Lawrence Hunter
---
 target/riscv/cpu.c | 1 +
 target/riscv/cpu.h | 1 +
 2 files changed, 2 insertions(+)
target/riscv/cpu.c +1 -0
index c0c2d70abf..8045a7cec0 100644
@@ -101,6 +101,7 @@ static const struct isa_ext_data isa_edata_arr[] = {
     ISA_EXT_DATA_ENTRY(zve32f, true, PRIV_VERSION_1_12_0, ext_zve32f),
     ISA_EXT_DATA_ENTRY(zve64f, true, PRIV_VERSION_1_12_0, ext_zve64f),
     ISA_EXT_DATA_ENTRY(zvkb, true, PRIV_VERSION_1_12_0, ext_zvkb),
+    ISA_EXT_DATA_ENTRY(zvkg, true, PRIV_VERSION_1_12_0, ext_zvkg),
     ISA_EXT_DATA_ENTRY(zvknha, true, PRIV_VERSION_1_12_0, ext_zvknha),
     ISA_EXT_DATA_ENTRY(zvknhb, true, PRIV_VERSION_1_12_0, ext_zvknhb),
     ISA_EXT_DATA_ENTRY(zvkns, true, PRIV_VERSION_1_12_0, ext_zvkns),
target/riscv/cpu.h +1 -0
index 92624bfc57..b3b1174d74 100644
@@ -462,6 +462,7 @@ struct RISCVCPUConfig {
     bool ext_zve32f;
     bool ext_zve64f;
     bool ext_zvkb;
+    bool ext_zvkg;
     bool ext_zvknha;
     bool ext_zvknhb;
     bool ext_zvkns;
Signature · 1 line
2.39.1
#33 lore raw

RFC PATCH 33/39 target/riscv: Add vghmac.vv decoding, translation and execution support

In reply to Lawrence Hunter
---
 target/riscv/helper.h                      |  2 +
 target/riscv/insn32.decode                 |  3 ++
 target/riscv/insn_trans/trans_rvzvkg.c.inc |  8 ++++
 target/riscv/translate.c                   |  1 +
 target/riscv/vcrypto_helper.c              | 45 ++++++++++++++++++++++
 5 files changed, 59 insertions(+)
 create mode 100644 target/riscv/insn_trans/trans_rvzvkg.c.inc
target/riscv/helper.h +2 -0
index a82103ead9..6272294d50 100644
@@ -1199,3 +1199,5 @@ DEF_HELPER_5(vsha2cl_vv, void, ptr, ptr, ptr, env, i32)
 
 DEF_HELPER_5(vsm3me_vv, void, ptr, ptr, ptr, env, i32)
 DEF_HELPER_5(vsm3c_vi, void, ptr, ptr, i32, env, i32)
+
+DEF_HELPER_5(vghmac_vv, void, ptr, ptr, ptr, env, i32)
target/riscv/insn32.decode +3 -0
index 4a50114e92..ff044f8288 100644
@@ -930,3 +930,6 @@ vsha2cl_vv      101111 1 ..... ..... 010 ..... 1110111 @r_vm_1
 # *** RV64 Zvksh vector crypto extensions ***
 vsm3me_vv       100000 1 ..... ..... 010 ..... 1110111 @r_vm_1
 vsm3c_vi        101011 1 ..... ..... 010 ..... 1110111 @r_vm_1
+
+# *** RV64 Zvkg vector crypto extension ***
+vghmac_vv       101100 1 ..... ..... 010 ..... 1110111 @r_vm_1
target/riscv/insn_trans/trans_rvzvkg.c.inc new file +8 -0
new file mode 100644
index 0000000000..576f5d39c4
@@ -0,0 +1,8 @@
+static bool vghmac_check(DisasContext *s, arg_rmrr *a)
+{
+    return opivv_check(s, a) &&
+           s->vstart % 4 == 0 &&
+           s->sew == MO_32;
+}
+
+GEN_VV_UNMASKED_TRANS(vghmac_vv, vghmac_check)
target/riscv/translate.c +1 -0
index 9ca2cec23a..0bc1c9db65 100644
@@ -1067,6 +1067,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
 #include "insn_trans/trans_rvzvkns.c.inc"
 #include "insn_trans/trans_rvzvknh.c.inc"
 #include "insn_trans/trans_rvzvksh.c.inc"
+#include "insn_trans/trans_rvzvkg.c.inc"
 #include "insn_trans/trans_privileged.c.inc"
 #include "insn_trans/trans_svinval.c.inc"
 #include "insn_trans/trans_xventanacondops.c.inc"
target/riscv/vcrypto_helper.c +45 -0

48 lines not on this page · raw message

Signature · 1 line
2.39.1
#34 lore raw

RFC PATCH 34/39 target/riscv: expose zvkg cpu property

In reply to Lawrence Hunter
---
 target/riscv/cpu.c | 1 +
 1 file changed, 1 insertion(+)
target/riscv/cpu.c +1 -0
index 8045a7cec0..4bd404faa0 100644
@@ -1077,6 +1077,7 @@ static Property riscv_cpu_extensions[] = {
     DEFINE_PROP_BOOL("zmmul", RISCVCPU, cfg.ext_zmmul, false),
 
     DEFINE_PROP_BOOL("zvkb", RISCVCPU, cfg.ext_zvkb, false),
+    DEFINE_PROP_BOOL("zvkg", RISCVCPU, cfg.ext_zvkg, false),
     DEFINE_PROP_BOOL("zvknha", RISCVCPU, cfg.ext_zvknha, false),
     DEFINE_PROP_BOOL("zvknhb", RISCVCPU, cfg.ext_zvknhb, false),
     DEFINE_PROP_BOOL("zvkns", RISCVCPU, cfg.ext_zvkns, false),
Signature · 1 line
2.39.1
#35 lore raw

RFC PATCH 35/39 crypto: Move SM4_SBOXWORD from target/riscv

In reply to Lawrence Hunter

From: Max Chou <[email protected]>

- Share SM4_SBOXWORD between target/riscv and target/arm.

---
 include/crypto/sm4.h       |  7 +++++++
 target/arm/crypto_helper.c | 10 ++--------
 2 files changed, 9 insertions(+), 8 deletions(-)
include/crypto/sm4.h +7 -0
index 9bd3ebc62e..33478562a4 100644
@@ -1,6 +1,13 @@
 #ifndef QEMU_SM4_H
 #define QEMU_SM4_H
 
+#define SM4_SBOXWORD(WORD) ( \
+    sm4_sbox[((WORD) >> 24) & 0xff] << 24 | \
+    sm4_sbox[((WORD) >> 16) & 0xff] << 16 | \
+    sm4_sbox[((WORD) >>  8) & 0xff] <<  8 | \
+    sm4_sbox[((WORD) >>  0) & 0xff] <<  0   \
+)
+
 extern const uint8_t sm4_sbox[256];
 
 #endif
target/arm/crypto_helper.c +2 -8
index d28690321f..4e97af9879 100644
@@ -707,10 +707,7 @@ static void do_crypto_sm4e(uint64_t *rd, uint64_t *rn, uint64_t *rm)
             CR_ST_WORD(d, (i + 3) % 4) ^
             CR_ST_WORD(n, i);
 
-        t = sm4_sbox[t & 0xff] |
-            sm4_sbox[(t >> 8) & 0xff] << 8 |
-            sm4_sbox[(t >> 16) & 0xff] << 16 |
-            sm4_sbox[(t >> 24) & 0xff] << 24;
+        t = SM4_SBOXWORD(t);
 
         CR_ST_WORD(d, i) ^= t ^ rol32(t, 2) ^ rol32(t, 10) ^ rol32(t, 18) ^
                             rol32(t, 24);
@@ -744,10 +741,7 @@ static void do_crypto_sm4ekey(uint64_t *rd, uint64_t *rn, uint64_t *rm)
             CR_ST_WORD(d, (i + 3) % 4) ^
             CR_ST_WORD(m, i);
 
-        t = sm4_sbox[t & 0xff] |
-            sm4_sbox[(t >> 8) & 0xff] << 8 |
-            sm4_sbox[(t >> 16) & 0xff] << 16 |
-            sm4_sbox[(t >> 24) & 0xff] << 24;
+        t = SM4_SBOXWORD(t);
 
         CR_ST_WORD(d, i) ^= t ^ rol32(t, 13) ^ rol32(t, 23);
     }
Signature · 1 line
2.39.1
#36 lore raw

RFC PATCH 36/39 crypto: Add SM4 constant parameter CK.

In reply to Lawrence Hunter

From: Max Chou <[email protected]>

---
 crypto/sm4.c         | 10 ++++++++++
 include/crypto/sm4.h |  1 +
 2 files changed, 11 insertions(+)
crypto/sm4.c +10 -0
index 9f0cd452c7..2987306cf7 100644
@@ -47,3 +47,13 @@ uint8_t const sm4_sbox[] = {
     0x79, 0xee, 0x5f, 0x3e, 0xd7, 0xcb, 0x39, 0x48,
 };
 
+uint32_t const sm4_ck[] = {
+    0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269,
+    0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
+    0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
+    0x50575e65, 0x6c737a81, 0x888f969d, 0xa4abb2b9,
+    0xc0c7ced5, 0xdce3eaf1, 0xf8ff060d, 0x141b2229,
+    0x30373e45, 0x4c535a61, 0x686f767d, 0x848b9299,
+    0xa0a7aeb5, 0xbcc3cad1, 0xd8dfe6ed, 0xf4fb0209,
+    0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279
+};
include/crypto/sm4.h +1 -0
index 33478562a4..d0df6e473c 100644
@@ -9,5 +9,6 @@
 )
 
 extern const uint8_t sm4_sbox[256];
+extern const uint32_t sm4_ck[32];
 
 #endif
Signature · 1 line
2.39.1
#37 lore raw

RFC PATCH 37/39 target/riscv: Add zvksed cfg property

In reply to Lawrence Hunter

From: Max Chou <[email protected]>

---
 target/riscv/cpu.c | 1 +
 target/riscv/cpu.h | 1 +
 2 files changed, 2 insertions(+)
target/riscv/cpu.c +1 -0
index 4bd404faa0..d298c9bbfb 100644
@@ -105,6 +105,7 @@ static const struct isa_ext_data isa_edata_arr[] = {
     ISA_EXT_DATA_ENTRY(zvknha, true, PRIV_VERSION_1_12_0, ext_zvknha),
     ISA_EXT_DATA_ENTRY(zvknhb, true, PRIV_VERSION_1_12_0, ext_zvknhb),
     ISA_EXT_DATA_ENTRY(zvkns, true, PRIV_VERSION_1_12_0, ext_zvkns),
+    ISA_EXT_DATA_ENTRY(zvksed, true, PRIV_VERSION_1_12_0, ext_zvksed),
     ISA_EXT_DATA_ENTRY(zvksh, true, PRIV_VERSION_1_12_0, ext_zvksh),
     ISA_EXT_DATA_ENTRY(zhinx, true, PRIV_VERSION_1_12_0, ext_zhinx),
     ISA_EXT_DATA_ENTRY(zhinxmin, true, PRIV_VERSION_1_12_0, ext_zhinxmin),
target/riscv/cpu.h +1 -0
index b3b1174d74..89e9fd61da 100644
@@ -466,6 +466,7 @@ struct RISCVCPUConfig {
     bool ext_zvknha;
     bool ext_zvknhb;
     bool ext_zvkns;
+    bool ext_zvksed;
     bool ext_zvksh;
     bool ext_zmmul;
     bool ext_smaia;
Signature · 1 line
2.39.1
#38 lore raw

RFC PATCH 38/39 target/riscv: Add Zvksed support

In reply to Lawrence Hunter

From: Max Chou <[email protected]>

- add vsm4k, vsm4r instructions

[[email protected]: Moved SM4 functions from crypto_helper.c to vcrypto_helper.c] [[email protected]: Added alignment checks, refactored code to use macros, and minor style changes]

---
 target/riscv/crypto_helper.c                 |   1 +
 target/riscv/helper.h                        |   4 +
 target/riscv/insn32.decode                   |   5 +
 target/riscv/insn_trans/trans_rvzvksed.c.inc |  38 +++++
 target/riscv/translate.c                     |   1 +
 target/riscv/vcrypto_helper.c                | 139 +++++++++++++++++++
 6 files changed, 188 insertions(+)
 create mode 100644 target/riscv/insn_trans/trans_rvzvksed.c.inc
target/riscv/crypto_helper.c +1 -0
index 2ef30281b1..760ce22570 100644
@@ -23,6 +23,7 @@
 #include "exec/helper-proto.h"
 #include "crypto/aes.h"
 #include "crypto/sm4.h"
+#include "vector_internals.h"
 
 #define AES_XTIME(a) \
     ((a << 1) ^ ((a & 0x80) ? 0x1b : 0))
target/riscv/helper.h +4 -0
index 6272294d50..07fad2568c 100644
@@ -1201,3 +1201,7 @@ DEF_HELPER_5(vsm3me_vv, void, ptr, ptr, ptr, env, i32)
 DEF_HELPER_5(vsm3c_vi, void, ptr, ptr, i32, env, i32)
 
 DEF_HELPER_5(vghmac_vv, void, ptr, ptr, ptr, env, i32)
+
+DEF_HELPER_5(vsm4k_vi, void, ptr, ptr, i32, env, i32)
+DEF_HELPER_4(vsm4r_vv, void, ptr, ptr, env, i32)
+DEF_HELPER_4(vsm4r_vs, void, ptr, ptr, env, i32)
target/riscv/insn32.decode +5 -0
index ff044f8288..3e83884f43 100644
@@ -933,3 +933,8 @@ vsm3c_vi        101011 1 ..... ..... 010 ..... 1110111 @r_vm_1
 
 # *** RV64 Zvkg vector crypto extension ***
 vghmac_vv       101100 1 ..... ..... 010 ..... 1110111 @r_vm_1
+
+# *** RV64 Zvksed Standart Extension ***
+vsm4k_vi        100001 1 ..... ..... 010 ..... 1110111 @r_vm_1
+vsm4r_vv        101000 1 ..... 10000 010 ..... 1110111 @r2_vm_1
+vsm4r_vs        101001 1 ..... 10000 010 ..... 1110111 @r2_vm_1
target/riscv/insn_trans/trans_rvzvksed.c.inc new file +38 -0
new file mode 100644
index 0000000000..1740f57c0a
@@ -0,0 +1,38 @@
+#define ZVKSED_EGS 4
+
+static bool zvksed_check(DisasContext *s)
+{
+    return require_rvv(s) &&
+           s->cfg_ptr->ext_zvksed == true &&
+           vext_check_isa_ill(s) &&
+           s->vstart % ZVKSED_EGS == 0 &&
+           s->sew == MO_32;
+}
+
+static bool vsm4k_vi_check(DisasContext *s, arg_rmrr *a)
+{
+    return zvksed_check(s) &&
+           require_align(a->rd, s->lmul) &&
+           require_align(a->rs2, s->lmul) &&
+           a->rs1 >= 0 && a->rs1 <= 7;
+}
+
+GEN_VI_UNMASKED_TRANS(vsm4k_vi, vsm4k_vi_check)
+
+static bool vsm4r_vv_check(DisasContext *s, arg_rmr *a)
+{
+    return zvksed_check(s) &&
+           require_align(a->rd, s->lmul) &&
+           require_align(a->rs2, s->lmul);
+}
+
+GEN_V_UNMASKED_TRANS(vsm4r_vv, vsm4r_vv_check)
+
+static bool vsm4r_vs_check(DisasContext *s, arg_rmr *a)
+{
+    return zvksed_check(s) &&
+           !is_overlapped(a->rd, 1 << MAX(s->lmul, 0), a->rs2, 1) &&
+           require_align(a->rd, s->lmul);
+}
+
+GEN_V_UNMASKED_TRANS(vsm4r_vs, vsm4r_vs_check)
target/riscv/translate.c +1 -0
index 0bc1c9db65..2ffb1827c5 100644
@@ -1068,6 +1068,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
 #include "insn_trans/trans_rvzvknh.c.inc"
 #include "insn_trans/trans_rvzvksh.c.inc"
 #include "insn_trans/trans_rvzvkg.c.inc"
+#include "insn_trans/trans_rvzvksed.c.inc"
 #include "insn_trans/trans_privileged.c.inc"
 #include "insn_trans/trans_svinval.c.inc"
 #include "insn_trans/trans_xventanacondops.c.inc"
target/riscv/vcrypto_helper.c +139 -0

148 lines not on this page · raw message

Signature · 1 line
2.39.1
#39 lore raw

RFC PATCH 39/39 target/riscv: Expose Zvksed property

In reply to Lawrence Hunter

From: Max Chou <[email protected]>

---
 target/riscv/cpu.c | 1 +
 1 file changed, 1 insertion(+)
target/riscv/cpu.c +1 -0
index d298c9bbfb..0a707a4415 100644
@@ -1082,6 +1082,7 @@ static Property riscv_cpu_extensions[] = {
     DEFINE_PROP_BOOL("zvknha", RISCVCPU, cfg.ext_zvknha, false),
     DEFINE_PROP_BOOL("zvknhb", RISCVCPU, cfg.ext_zvknhb, false),
     DEFINE_PROP_BOOL("zvkns", RISCVCPU, cfg.ext_zvkns, false),
+    DEFINE_PROP_BOOL("zvksed", RISCVCPU, cfg.ext_zvksed, false),
     DEFINE_PROP_BOOL("zvksh", RISCVCPU, cfg.ext_zvksh, false),
 
     /* Vendor-specific custom extensions */
Signature · 1 line
2.39.1
#40 lore raw
In reply to Lawrence Hunter

Hi Lawrence,

The spec says that:

"With the exception of Zvknhb, each of these Vector Crypto Extensions can be build on any base
Vector Extension, embedded (Zve*) or application ("V"). Zvknhb requires ELEN=64 and therefore
cannot be implemented on a Zve32* base.
While the Zvkb extension can be built on an Zve32* base, the vclmul[h] instructions will not be
supported in such a case as they require SEW=64."

So I guess we also need to add the checks for each Vector Crypto CPU property in riscv_cpu_realize()
to check whether either "V" or "Zve*" extension is enabled or disabled, based on the restrictions defined in the spec.

Regards,
Frank Chang

Quoted 123 lines · Lawrence Hunter

This RFC introduces an implementation for the six instruction sets of the draft RISC-V cryptography extensions standardisation specification. Once the specification has been ratified we will submit these changes as a pull request email to this mailing list. Would this be prefered by instruction group or unified as in this RFC?

This patch set implements the instruction sets as per the 20221202 version of the specification (1).

Work performed by Dickon, Lawrence, Nazar, Kiran, and William from Codethink
sponsored by SiFive, and Max Chou from SiFive.

1. https://github.com/riscv/riscv-crypto/releases

Dickon Hood (1):
target/riscv: Add vrol.[vv,vx] and vror.[vv,vx,vi] decoding,
translation and execution support

Kiran Ostrolenk (4):
target/riscv: Add vsha2ms.vv decoding, translation and execution
support
target/riscv: add zvksh cpu property
target/riscv: Add vsm3c.vi decoding, translation and execution support target/riscv: expose zvksh cpu property

Lawrence Hunter (16):
target/riscv: Add vclmul.vv decoding, translation and execution
support
target/riscv: Add vclmul.vx decoding, translation and execution
support
target/riscv: Add vclmulh.vv decoding, translation and execution
support
target/riscv: Add vclmulh.vx decoding, translation and execution
support
target/riscv: Add vaesef.vv decoding, translation and execution
support
target/riscv: Add vaesef.vs decoding, translation and execution
support
target/riscv: Add vaesdf.vv decoding, translation and execution
support
target/riscv: Add vaesdf.vs decoding, translation and execution
support
target/riscv: Add vaesdm.vv decoding, translation and execution
support
target/riscv: Add vaesdm.vs decoding, translation and execution
support
target/riscv: Add vaesz.vs decoding, translation and execution support target/riscv: Add vsha2c[hl].vv decoding, translation and execution
support
target/riscv: Add vsm3me.vv decoding, translation and execution
support
target/riscv: add zvkg cpu property
target/riscv: Add vghmac.vv decoding, translation and execution
support
target/riscv: expose zvkg cpu property

Max Chou (5):
crypto: Move SM4_SBOXWORD from target/riscv
crypto: Add SM4 constant parameter CK.
target/riscv: Add zvksed cfg property
target/riscv: Add Zvksed support
target/riscv: Expose Zvksed property

Nazar Kazakov (10):
target/riscv: add zvkb cpu property
target/riscv: Add vrev8.v decoding, translation and execution support target/riscv: Add vandn.[vv,vx,vi] decoding, translation and execution
support
target/riscv: expose zvkb cpu property
target/riscv: add zvkns cpu property
target/riscv: Add vaeskf1.vi decoding, translation and execution
support
target/riscv: Add vaeskf2.vi decoding, translation and execution
support
target/riscv: expose zvkns cpu property
target/riscv: add zvknh cpu properties
target/riscv: expose zvknh cpu properties

William Salmon (3):
target/riscv: Add vbrev8.v decoding, translation and execution support target/riscv: Add vaesem.vv decoding, translation and execution
support
target/riscv: Add vaesem.vs decoding, translation and execution
support

 crypto/sm4.c                                 |   10 +
 include/crypto/sm4.h                         |    8 +
 include/qemu/bitops.h                        |   32 +
 target/arm/crypto_helper.c                   |   10 +-
 target/riscv/cpu.c                           |   15 +
 target/riscv/cpu.h                           |    7 +
 target/riscv/crypto_helper.c                 |    1 +
 target/riscv/helper.h                        |   69 ++
 target/riscv/insn32.decode                   |   48 +
 target/riscv/insn_trans/trans_rvzvkb.c.inc   |  164 +++
 target/riscv/insn_trans/trans_rvzvkg.c.inc   |    8 +
 target/riscv/insn_trans/trans_rvzvknh.c.inc  |   47 +
 target/riscv/insn_trans/trans_rvzvkns.c.inc  |  121 +++
 target/riscv/insn_trans/trans_rvzvksed.c.inc |   38 +
 target/riscv/insn_trans/trans_rvzvksh.c.inc  |   20 +
 target/riscv/meson.build                     |    4 +-
 target/riscv/translate.c                     |    6 +
 target/riscv/vcrypto_helper.c                | 1013 ++++++++++++++++++
 target/riscv/vector_helper.c                 |  242 +----
 target/riscv/vector_internals.c              |   63 ++
 target/riscv/vector_internals.h              |  226 ++++
 21 files changed, 1902 insertions(+), 250 deletions(-)
 create mode 100644 target/riscv/insn_trans/trans_rvzvkb.c.inc
 create mode 100644 target/riscv/insn_trans/trans_rvzvkg.c.inc
 create mode 100644 target/riscv/insn_trans/trans_rvzvknh.c.inc
 create mode 100644 target/riscv/insn_trans/trans_rvzvkns.c.inc
 create mode 100644 target/riscv/insn_trans/trans_rvzvksed.c.inc
 create mode 100644 target/riscv/insn_trans/trans_rvzvksh.c.inc
 create mode 100644 target/riscv/vcrypto_helper.c
 create mode 100644 target/riscv/vector_internals.c
 create mode 100644 target/riscv/vector_internals.h

--
2.39.1

#41 lore raw

cover Add RISC-V cryptography extensions standardisation

In reply to Lawrence Hunter

Follow up for add RISC-V vector cryptography extensions standardisation
RFC: we've not received any comments and would like to move this series towards getting merged. Does anyone have time to review it, and should we look at resubmitting for merging soon?

---------- Forwarded Message ---------

From: Lawrence Hunter <[email protected]>
Subject: [RFC PATCH 00/39] Add RISC-V cryptography extensions standardisation
Date: Jan 19 2023, at 2:34 pm
To: [email protected]
Cc: [email protected], [email protected], Lawrence Hunter <[email protected]>

Quoted 122 lines

This RFC introduces an implementation for the six instruction sets of the draft RISC-V cryptography extensions standardisation specification. Once the specification has been ratified we will submit these changes as a pull request email to this mailing list. Would this be prefered by instruction group or unified as in this RFC?

This patch set implements the instruction sets as per the 20221202 version of the specification (1).

Work performed by Dickon, Lawrence, Nazar, Kiran, and William from Codethink sponsored by SiFive, and Max Chou from SiFive.

1. https://github.com/riscv/riscv-crypto/releases

Dickon Hood (1):
target/riscv: Add vrol.[vv,vx] and vror.[vv,vx,vi] decoding,
translation and execution support

Kiran Ostrolenk (4):
target/riscv: Add vsha2ms.vv decoding, translation and execution
support
target/riscv: add zvksh cpu property
target/riscv: Add vsm3c.vi decoding, translation and execution support target/riscv: expose zvksh cpu property

Lawrence Hunter (16):
target/riscv: Add vclmul.vv decoding, translation and execution
support
target/riscv: Add vclmul.vx decoding, translation and execution
support
target/riscv: Add vclmulh.vv decoding, translation and execution
support
target/riscv: Add vclmulh.vx decoding, translation and execution
support
target/riscv: Add vaesef.vv decoding, translation and execution
support
target/riscv: Add vaesef.vs decoding, translation and execution
support
target/riscv: Add vaesdf.vv decoding, translation and execution
support
target/riscv: Add vaesdf.vs decoding, translation and execution
support
target/riscv: Add vaesdm.vv decoding, translation and execution
support
target/riscv: Add vaesdm.vs decoding, translation and execution
support
target/riscv: Add vaesz.vs decoding, translation and execution support target/riscv: Add vsha2c[hl].vv decoding, translation and execution
support
target/riscv: Add vsm3me.vv decoding, translation and execution
support
target/riscv: add zvkg cpu property
target/riscv: Add vghmac.vv decoding, translation and execution
support
target/riscv: expose zvkg cpu property

Max Chou (5):
crypto: Move SM4_SBOXWORD from target/riscv
crypto: Add SM4 constant parameter CK.
target/riscv: Add zvksed cfg property
target/riscv: Add Zvksed support
target/riscv: Expose Zvksed property

Nazar Kazakov (10):
target/riscv: add zvkb cpu property
target/riscv: Add vrev8.v decoding, translation and execution support target/riscv: Add vandn.[vv,vx,vi] decoding, translation and execution
support
target/riscv: expose zvkb cpu property
target/riscv: add zvkns cpu property
target/riscv: Add vaeskf1.vi decoding, translation and execution
support
target/riscv: Add vaeskf2.vi decoding, translation and execution
support
target/riscv: expose zvkns cpu property
target/riscv: add zvknh cpu properties
target/riscv: expose zvknh cpu properties

William Salmon (3):
target/riscv: Add vbrev8.v decoding, translation and execution support target/riscv: Add vaesem.vv decoding, translation and execution
support
target/riscv: Add vaesem.vs decoding, translation and execution
support

crypto/sm4.c                                 |   10 +
include/crypto/sm4.h                         |    8 +
include/qemu/bitops.h                        |   32 +
target/arm/crypto_helper.c                   |   10 +-
target/riscv/cpu.c                           |   15 +
target/riscv/cpu.h                           |    7 +
target/riscv/crypto_helper.c                 |    1 +
target/riscv/helper.h                        |   69 ++
target/riscv/insn32.decode                   |   48 +
target/riscv/insn_trans/trans_rvzvkb.c.inc   |  164 +++
target/riscv/insn_trans/trans_rvzvkg.c.inc   |    8 +
target/riscv/insn_trans/trans_rvzvknh.c.inc  |   47 +
target/riscv/insn_trans/trans_rvzvkns.c.inc  |  121 +++
target/riscv/insn_trans/trans_rvzvksed.c.inc |   38 +
target/riscv/insn_trans/trans_rvzvksh.c.inc  |   20 +
target/riscv/meson.build                     |    4 +-
target/riscv/translate.c                     |    6 +
target/riscv/vcrypto_helper.c                | 1013 ++++++++++++++++++
target/riscv/vector_helper.c                 |  242 +----
target/riscv/vector_internals.c              |   63 ++
target/riscv/vector_internals.h              |  226 ++++
21 files changed, 1902 insertions(+), 250 deletions(-)

create mode 100644 target/riscv/insn_trans/trans_rvzvkb.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkg.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvknh.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkns.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksed.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksh.c.inc create mode 100644 target/riscv/vcrypto_helper.c create mode 100644 target/riscv/vector_internals.c create mode 100644 target/riscv/vector_internals.h

Signature · 1 line
2.39.1
#42 lore raw

Lawrence,

we‘ll review, as we‘ve also been developing a similar series and have the know how readily available. Seems like you beat us to submitting it ;-)

I’ll make sure reviews go up by next week.

Philipp.

Quoted 140 lines · Lawrence Hunter

Follow up for add RISC-V vector cryptography extensions standardisation
RFC: we've not received any comments and would like to move this series towards getting merged. Does anyone have time to review it, and should we look at resubmitting for merging soon?

---------- Forwarded Message ---------

From: Lawrence Hunter <[email protected]>
Subject: [RFC PATCH 00/39] Add RISC-V cryptography extensions standardisation
Date: Jan 19 2023, at 2:34 pm
To: [email protected]
Cc: [email protected], [email protected], Lawrence Hunter < [email protected]>

Quoted 10 lines

This RFC introduces an implementation for the six instruction sets of the draft RISC-V cryptography extensions standardisation specification. Once the specification has been ratified we will submit these changes as a pull request email to this mailing list. Would this be prefered by instruction group or unified as in this RFC?

This patch set implements the instruction sets as per the 20221202 version of the specification (1).

Work performed by Dickon, Lawrence, Nazar, Kiran, and William from

Codethink

Quoted 112 lines

sponsored by SiFive, and Max Chou from SiFive.

1. https://github.com/riscv/riscv-crypto/releases

Dickon Hood (1):
target/riscv: Add vrol.[vv,vx] and vror.[vv,vx,vi] decoding,
translation and execution support

Kiran Ostrolenk (4):
target/riscv: Add vsha2ms.vv decoding, translation and execution
support
target/riscv: add zvksh cpu property
target/riscv: Add vsm3c.vi decoding, translation and execution support target/riscv: expose zvksh cpu property

Lawrence Hunter (16):
target/riscv: Add vclmul.vv decoding, translation and execution
support
target/riscv: Add vclmul.vx decoding, translation and execution
support
target/riscv: Add vclmulh.vv decoding, translation and execution
support
target/riscv: Add vclmulh.vx decoding, translation and execution
support
target/riscv: Add vaesef.vv decoding, translation and execution
support
target/riscv: Add vaesef.vs decoding, translation and execution
support
target/riscv: Add vaesdf.vv decoding, translation and execution
support
target/riscv: Add vaesdf.vs decoding, translation and execution
support
target/riscv: Add vaesdm.vv decoding, translation and execution
support
target/riscv: Add vaesdm.vs decoding, translation and execution
support
target/riscv: Add vaesz.vs decoding, translation and execution support target/riscv: Add vsha2c[hl].vv decoding, translation and execution
support
target/riscv: Add vsm3me.vv decoding, translation and execution
support
target/riscv: add zvkg cpu property
target/riscv: Add vghmac.vv decoding, translation and execution
support
target/riscv: expose zvkg cpu property

Max Chou (5):
crypto: Move SM4_SBOXWORD from target/riscv
crypto: Add SM4 constant parameter CK.
target/riscv: Add zvksed cfg property
target/riscv: Add Zvksed support
target/riscv: Expose Zvksed property

Nazar Kazakov (10):
target/riscv: add zvkb cpu property
target/riscv: Add vrev8.v decoding, translation and execution support target/riscv: Add vandn.[vv,vx,vi] decoding, translation and execution
support
target/riscv: expose zvkb cpu property
target/riscv: add zvkns cpu property
target/riscv: Add vaeskf1.vi decoding, translation and execution
support
target/riscv: Add vaeskf2.vi decoding, translation and execution
support
target/riscv: expose zvkns cpu property
target/riscv: add zvknh cpu properties
target/riscv: expose zvknh cpu properties

William Salmon (3):
target/riscv: Add vbrev8.v decoding, translation and execution support target/riscv: Add vaesem.vv decoding, translation and execution
support
target/riscv: Add vaesem.vs decoding, translation and execution
support

crypto/sm4.c                                 |   10 +
include/crypto/sm4.h                         |    8 +
include/qemu/bitops.h                        |   32 +
target/arm/crypto_helper.c                   |   10 +-
target/riscv/cpu.c                           |   15 +
target/riscv/cpu.h                           |    7 +
target/riscv/crypto_helper.c                 |    1 +
target/riscv/helper.h                        |   69 ++
target/riscv/insn32.decode                   |   48 +
target/riscv/insn_trans/trans_rvzvkb.c.inc   |  164 +++
target/riscv/insn_trans/trans_rvzvkg.c.inc   |    8 +
target/riscv/insn_trans/trans_rvzvknh.c.inc  |   47 +
target/riscv/insn_trans/trans_rvzvkns.c.inc  |  121 +++
target/riscv/insn_trans/trans_rvzvksed.c.inc |   38 +
target/riscv/insn_trans/trans_rvzvksh.c.inc  |   20 +
target/riscv/meson.build                     |    4 +-
target/riscv/translate.c                     |    6 +
target/riscv/vcrypto_helper.c                | 1013 ++++++++++++++++++
target/riscv/vector_helper.c                 |  242 +----
target/riscv/vector_internals.c              |   63 ++
target/riscv/vector_internals.h              |  226 ++++
21 files changed, 1902 insertions(+), 250 deletions(-)

create mode 100644 target/riscv/insn_trans/trans_rvzvkb.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkg.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvknh.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkns.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksed.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksh.c.inc create mode 100644 target/riscv/vcrypto_helper.c create mode 100644 target/riscv/vector_internals.c create mode 100644 target/riscv/vector_internals.h

--
2.39.1

#43 lore raw
In reply to Lawrence Hunter
Quoted 7 lines · Lawrence Hunter

Follow up for add RISC-V vector cryptography extensions standardisation
RFC: we've not received any comments and would like to move this series
towards getting merged. Does anyone have time to review it, and should
we look at resubmitting for merging soon?

Hello,

This series never made it to the QEMU list. It looks like it was never sent to the general qemu-devel mailing list.

When submitting patches can you please follow the steps here:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#submitting-your-patches

It's important that all patches are sent to the qemu-devel mailing list (that's actually much more important then the RISC-V mailing list).

Alistair

Quoted 144 lines

---------- Forwarded Message ---------

From: Lawrence Hunter <[email protected]>
Subject: [RFC PATCH 00/39] Add RISC-V cryptography extensions standardisation
Date: Jan 19 2023, at 2:34 pm
To: [email protected]
Cc: [email protected], [email protected], Lawrence Hunter <[email protected]>

Quoted 132 lines

This RFC introduces an implementation for the six instruction sets of the draft RISC-V cryptography extensions standardisation specification. Once the specification has been ratified we will submit
these changes as a pull request email to this mailing list. Would this
be prefered by instruction group or unified as in this RFC?

This patch set implements the instruction sets as per the 20221202 version of the specification (1).

Work performed by Dickon, Lawrence, Nazar, Kiran, and William from Codethink
sponsored by SiFive, and Max Chou from SiFive.

1. https://github.com/riscv/riscv-crypto/releases

Dickon Hood (1):
 target/riscv: Add vrol.[vv,vx] and vror.[vv,vx,vi] decoding, translation and execution support

Kiran Ostrolenk (4):
 target/riscv: Add vsha2ms.vv decoding, translation and execution support
 target/riscv: add zvksh cpu property
 target/riscv: Add vsm3c.vi decoding, translation and execution support
 target/riscv: expose zvksh cpu property

Lawrence Hunter (16):
 target/riscv: Add vclmul.vv decoding, translation and execution support
 target/riscv: Add vclmul.vx decoding, translation and execution support
 target/riscv: Add vclmulh.vv decoding, translation and execution support
 target/riscv: Add vclmulh.vx decoding, translation and execution support
 target/riscv: Add vaesef.vv decoding, translation and execution support
 target/riscv: Add vaesef.vs decoding, translation and execution support
 target/riscv: Add vaesdf.vv decoding, translation and execution support
 target/riscv: Add vaesdf.vs decoding, translation and execution support
 target/riscv: Add vaesdm.vv decoding, translation and execution support
 target/riscv: Add vaesdm.vs decoding, translation and execution support
 target/riscv: Add vaesz.vs decoding, translation and execution support
 target/riscv: Add vsha2c[hl].vv decoding, translation and execution
   support
 target/riscv: Add vsm3me.vv decoding, translation and execution support
 target/riscv: add zvkg cpu property
 target/riscv: Add vghmac.vv decoding, translation and execution support
 target/riscv: expose zvkg cpu property

Max Chou (5):
 crypto: Move SM4_SBOXWORD from target/riscv
 crypto: Add SM4 constant parameter CK.
 target/riscv: Add zvksed cfg property
 target/riscv: Add Zvksed support
 target/riscv: Expose Zvksed property

Nazar Kazakov (10):
 target/riscv: add zvkb cpu property
 target/riscv: Add vrev8.v decoding, translation and execution support
 target/riscv: Add vandn.[vv,vx,vi] decoding, translation and execution
   support
 target/riscv: expose zvkb cpu property
 target/riscv: add zvkns cpu property
 target/riscv: Add vaeskf1.vi decoding, translation and execution support
 target/riscv: Add vaeskf2.vi decoding, translation and execution support
 target/riscv: expose zvkns cpu property
 target/riscv: add zvknh cpu properties
 target/riscv: expose zvknh cpu properties

William Salmon (3):
 target/riscv: Add vbrev8.v decoding, translation and execution support
 target/riscv: Add vaesem.vv decoding, translation and execution support
 target/riscv: Add vaesem.vs decoding, translation and execution support

crypto/sm4.c                                 |   10 + include/crypto/sm4.h                         |    8 + include/qemu/bitops.h                        |   32 + target/arm/crypto_helper.c                   |   10 +- target/riscv/cpu.c                           |   15 + target/riscv/cpu.h                           |    7 + target/riscv/crypto_helper.c                 |    1 + target/riscv/helper.h                        |   69 ++ target/riscv/insn32.decode                   |   48 + target/riscv/insn_trans/trans_rvzvkb.c.inc   |  164 +++ target/riscv/insn_trans/trans_rvzvkg.c.inc   |    8 + target/riscv/insn_trans/trans_rvzvknh.c.inc  |   47 + target/riscv/insn_trans/trans_rvzvkns.c.inc  |  121 +++ target/riscv/insn_trans/trans_rvzvksed.c.inc |   38 + target/riscv/insn_trans/trans_rvzvksh.c.inc  |   20 + target/riscv/meson.build                     |    4 +- target/riscv/translate.c                     |    6 + target/riscv/vcrypto_helper.c                | 1013
++++++++++++++++++
target/riscv/vector_helper.c                 |  242 +---- target/riscv/vector_internals.c              |   63 ++ target/riscv/vector_internals.h              |  226 ++++

21 files changed, 1902 insertions(+), 250 deletions(-)

create mode 100644 target/riscv/insn_trans/trans_rvzvkb.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkg.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvknh.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkns.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksed.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksh.c.inc create mode 100644 target/riscv/vcrypto_helper.c create mode 100644 target/riscv/vector_internals.c create mode 100644 target/riscv/vector_internals.h

Signature · 1 line
2.39.1
#44 lore raw
Quoted 9 lines · Alistair Francis
Quoted 7 lines · Lawrence Hunter

Follow up for add RISC-V vector cryptography extensions standardisation
RFC: we've not received any comments and would like to move this series
towards getting merged. Does anyone have time to review it, and should
we look at resubmitting for merging soon?

Quoted 5 lines

Hello,

This series never made it to the QEMU list. It looks like it was never sent to the general qemu-devel mailing list.

This has so far been more than a little painful for our review, as we can't just pull the patches down from patchwork to use our regular test-and-review flow.
Should we wait until the resubmission for our review?

Note that the current series is not in-sync with the latest specification. We'll try to point out the specific deviations (we have a tree that we've been keeping in sync with the changes to the spec since mid-December) in our reviews.

Cheers,
Philipp.

Quoted 155 lines

When submitting patches can you please follow the steps here:

https://www.qemu.org/docs/master/devel/submitting-a-patch.html#submitting-your-patches

It's important that all patches are sent to the qemu-devel mailing list (that's actually much more important then the RISC-V mailing list).

Alistair

Quoted 144 lines

---------- Forwarded Message ---------

From: Lawrence Hunter <[email protected]>
Subject: [RFC PATCH 00/39] Add RISC-V cryptography extensions standardisation
Date: Jan 19 2023, at 2:34 pm
To: [email protected]
Cc: [email protected], [email protected], Lawrence Hunter <[email protected]>

Quoted 132 lines

This RFC introduces an implementation for the six instruction sets of the draft RISC-V cryptography extensions standardisation specification. Once the specification has been ratified we will submit
these changes as a pull request email to this mailing list. Would this
be prefered by instruction group or unified as in this RFC?

This patch set implements the instruction sets as per the 20221202 version of the specification (1).

Work performed by Dickon, Lawrence, Nazar, Kiran, and William from Codethink
sponsored by SiFive, and Max Chou from SiFive.

1. https://github.com/riscv/riscv-crypto/releases

Dickon Hood (1):
target/riscv: Add vrol.[vv,vx] and vror.[vv,vx,vi] decoding,
translation and execution support

Kiran Ostrolenk (4):
target/riscv: Add vsha2ms.vv decoding, translation and execution
support
target/riscv: add zvksh cpu property
target/riscv: Add vsm3c.vi decoding, translation and execution
support
target/riscv: expose zvksh cpu property

Lawrence Hunter (16):
target/riscv: Add vclmul.vv decoding, translation and execution
support
target/riscv: Add vclmul.vx decoding, translation and execution
support
target/riscv: Add vclmulh.vv decoding, translation and execution
support
target/riscv: Add vclmulh.vx decoding, translation and execution
support
target/riscv: Add vaesef.vv decoding, translation and execution
support
target/riscv: Add vaesef.vs decoding, translation and execution
support
target/riscv: Add vaesdf.vv decoding, translation and execution
support
target/riscv: Add vaesdf.vs decoding, translation and execution
support
target/riscv: Add vaesdm.vv decoding, translation and execution
support
target/riscv: Add vaesdm.vs decoding, translation and execution
support
target/riscv: Add vaesz.vs decoding, translation and execution
support
target/riscv: Add vsha2c[hl].vv decoding, translation and
execution
support
target/riscv: Add vsm3me.vv decoding, translation and execution
support
target/riscv: add zvkg cpu property
target/riscv: Add vghmac.vv decoding, translation and execution
support
target/riscv: expose zvkg cpu property

Max Chou (5):
crypto: Move SM4_SBOXWORD from target/riscv
crypto: Add SM4 constant parameter CK.
target/riscv: Add zvksed cfg property
target/riscv: Add Zvksed support
target/riscv: Expose Zvksed property

Nazar Kazakov (10):
target/riscv: add zvkb cpu property
target/riscv: Add vrev8.v decoding, translation and execution
support
target/riscv: Add vandn.[vv,vx,vi] decoding, translation and
execution
support
target/riscv: expose zvkb cpu property
target/riscv: add zvkns cpu property
target/riscv: Add vaeskf1.vi decoding, translation and execution
support
target/riscv: Add vaeskf2.vi decoding, translation and execution
support
target/riscv: expose zvkns cpu property
target/riscv: add zvknh cpu properties
target/riscv: expose zvknh cpu properties

William Salmon (3):
target/riscv: Add vbrev8.v decoding, translation and execution
support
target/riscv: Add vaesem.vv decoding, translation and execution
support
target/riscv: Add vaesem.vs decoding, translation and execution
support

crypto/sm4.c                                 |   10 +
include/crypto/sm4.h                         |    8 +
include/qemu/bitops.h                        |   32 +
target/arm/crypto_helper.c                   |   10 +-
target/riscv/cpu.c                           |   15 +
target/riscv/cpu.h                           |    7 +
target/riscv/crypto_helper.c                 |    1 +
target/riscv/helper.h                        |   69 ++
target/riscv/insn32.decode                   |   48 +
target/riscv/insn_trans/trans_rvzvkb.c.inc   |  164 +++
target/riscv/insn_trans/trans_rvzvkg.c.inc   |    8 +
target/riscv/insn_trans/trans_rvzvknh.c.inc  |   47 +
target/riscv/insn_trans/trans_rvzvkns.c.inc  |  121 +++
target/riscv/insn_trans/trans_rvzvksed.c.inc |   38 +
target/riscv/insn_trans/trans_rvzvksh.c.inc  |   20 +
target/riscv/meson.build                     |    4 +-
target/riscv/translate.c                     |    6 +
target/riscv/vcrypto_helper.c                | 1013
++++++++++++++++++
target/riscv/vector_helper.c                 |  242 +----
target/riscv/vector_internals.c              |   63 ++
target/riscv/vector_internals.h              |  226 ++++
21 files changed, 1902 insertions(+), 250 deletions(-)

create mode 100644 target/riscv/insn_trans/trans_rvzvkb.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkg.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvknh.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkns.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksed.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksh.c.inc create mode 100644 target/riscv/vcrypto_helper.c create mode 100644 target/riscv/vector_internals.c create mode 100644 target/riscv/vector_internals.h

--
2.39.1

#45 lore raw
Quoted 21 lines · Philipp Tomsich
Quoted 9 lines · Alistair Francis
Quoted 7 lines · Lawrence Hunter

Follow up for add RISC-V vector cryptography extensions standardisation
RFC: we've not received any comments and would like to move this series
towards getting merged. Does anyone have time to review it, and should
we look at resubmitting for merging soon?

Quoted 6 lines

Hello,

This series never made it to the QEMU list. It looks like it was never
sent to the general qemu-devel mailing list.

Quoted 4 lines

This has so far been more than a little painful for our review, as we can't just pull the patches down from patchwork to use our regular test-and-review flow.
Should we wait until the resubmission for our review?

Up to you. It won't be merged unless it has been sent to the general mailing list, so you can either get a head start or just wait.

Quoted 3 lines

Note that the current series is not in-sync with the latest specification.

It's only an RFC, so for now that's ok as it won't be merged anyway.

Alistair

Quoted 182 lines

We'll try to point out the specific deviations (we have a tree that we've been keeping in sync with the changes to the spec since mid- December) in our reviews.

Cheers,
Philipp.

Quoted 175 lines

When submitting patches can you please follow the steps here:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#submitting-your-patches

It's important that all patches are sent to the qemu-devel mailing list
(that's actually much more important then the RISC-V mailing list).

Alistair

Quoted 165 lines

---------- Forwarded Message ---------

From: Lawrence Hunter <[email protected]>
Subject: [RFC PATCH 00/39] Add RISC-V cryptography extensions standardisation
Date: Jan 19 2023, at 2:34 pm
To: [email protected]
Cc: [email protected], [email protected], Lawrence Hunter <[email protected]>

Quoted 153 lines

This RFC introduces an implementation for the six instruction sets
of the draft RISC-V cryptography extensions standardisation specification. Once the specification has been ratified we will submit
these changes as a pull request email to this mailing list. Would
this
be prefered by instruction group or unified as in this RFC?

This patch set implements the instruction sets as per the 20221202
version of the specification (1).

Work performed by Dickon, Lawrence, Nazar, Kiran, and William from
Codethink
sponsored by SiFive, and Max Chou from SiFive.

1. https://github.com/riscv/riscv-crypto/releases

Dickon Hood (1):
 target/riscv: Add vrol.[vv,vx] and vror.[vv,vx,vi] decoding, translation and execution support

Kiran Ostrolenk (4):
 target/riscv: Add vsha2ms.vv decoding, translation and execution
   support
 target/riscv: add zvksh cpu property
 target/riscv: Add vsm3c.vi decoding, translation and execution support
 target/riscv: expose zvksh cpu property

Lawrence Hunter (16):
 target/riscv: Add vclmul.vv decoding, translation and execution
   support
 target/riscv: Add vclmul.vx decoding, translation and execution
   support
 target/riscv: Add vclmulh.vv decoding, translation and execution
   support
 target/riscv: Add vclmulh.vx decoding, translation and execution
   support
 target/riscv: Add vaesef.vv decoding, translation and execution
   support
 target/riscv: Add vaesef.vs decoding, translation and execution
   support
 target/riscv: Add vaesdf.vv decoding, translation and execution
   support
 target/riscv: Add vaesdf.vs decoding, translation and execution
   support
 target/riscv: Add vaesdm.vv decoding, translation and execution
   support
 target/riscv: Add vaesdm.vs decoding, translation and execution
   support
 target/riscv: Add vaesz.vs decoding, translation and execution support
 target/riscv: Add vsha2c[hl].vv decoding, translation and execution
   support
 target/riscv: Add vsm3me.vv decoding, translation and execution
   support
 target/riscv: add zvkg cpu property
 target/riscv: Add vghmac.vv decoding, translation and execution
   support
 target/riscv: expose zvkg cpu property

Max Chou (5):
 crypto: Move SM4_SBOXWORD from target/riscv
 crypto: Add SM4 constant parameter CK.
 target/riscv: Add zvksed cfg property
 target/riscv: Add Zvksed support
 target/riscv: Expose Zvksed property

Nazar Kazakov (10):
 target/riscv: add zvkb cpu property
 target/riscv: Add vrev8.v decoding, translation and execution support
 target/riscv: Add vandn.[vv,vx,vi] decoding, translation and execution
   support
 target/riscv: expose zvkb cpu property target/riscv: add zvkns cpu property
 target/riscv: Add vaeskf1.vi decoding, translation and execution
   support
 target/riscv: Add vaeskf2.vi decoding, translation and execution
   support
 target/riscv: expose zvkns cpu property target/riscv: add zvknh cpu properties target/riscv: expose zvknh cpu properties

William Salmon (3):
 target/riscv: Add vbrev8.v decoding, translation and execution support
 target/riscv: Add vaesem.vv decoding, translation and execution
   support
 target/riscv: Add vaesem.vs decoding, translation and execution
   support

crypto/sm4.c                                 |   10 + include/crypto/sm4.h                         |    8 + include/qemu/bitops.h                        |   32 + target/arm/crypto_helper.c                   |   10 +- target/riscv/cpu.c                           |   15 + target/riscv/cpu.h                           |    7 + target/riscv/crypto_helper.c                 |    1 + target/riscv/helper.h                        |   69 ++ target/riscv/insn32.decode                   |   48 + target/riscv/insn_trans/trans_rvzvkb.c.inc   |  164 +++ target/riscv/insn_trans/trans_rvzvkg.c.inc   |    8 + target/riscv/insn_trans/trans_rvzvknh.c.inc  |   47 + target/riscv/insn_trans/trans_rvzvkns.c.inc  |  121 +++ target/riscv/insn_trans/trans_rvzvksed.c.inc |   38 + target/riscv/insn_trans/trans_rvzvksh.c.inc  |   20 + target/riscv/meson.build                     |    4 +- target/riscv/translate.c                     |    6 + target/riscv/vcrypto_helper.c                | 1013
++++++++++++++++++
target/riscv/vector_helper.c                 |  242 +---- target/riscv/vector_internals.c              |   63 ++ target/riscv/vector_internals.h              |  226 ++++

21 files changed, 1902 insertions(+), 250 deletions(-)

create mode 100644 target/riscv/insn_trans/trans_rvzvkb.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkg.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvknh.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkns.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksed.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksh.c.inc create mode 100644 target/riscv/vcrypto_helper.c create mode 100644 target/riscv/vector_internals.c create mode 100644 target/riscv/vector_internals.h

Signature · 1 line
2.39.1
#46 lore raw
Quoted 22 lines · Alistair Francis
Quoted 21 lines · Philipp Tomsich
Quoted 15 lines · Alistair Francis
Quoted 7 lines · Lawrence Hunter

Follow up for add RISC-V vector cryptography extensions standardisation
RFC: we've not received any comments and would like to move this series
towards getting merged. Does anyone have time to review it, and should
we look at resubmitting for merging soon?

Hello,

This series never made it to the QEMU list. It looks like it was never
sent to the general qemu-devel mailing list.

Quoted 4 lines
Quoted 4 lines

This has so far been more than a little painful for our review, as we can't just pull the patches down from patchwork to use our regular test-and-review flow.
Should we wait until the resubmission for our review?

We have pushed a branch 'rfc-zvk-19-01-23' with our commits based on a fairly recent master. Hopefully this will ease the review process.

https://github.com/CodethinkLabs/qemu-ct.git

Quoted 194 lines

Up to you. It won't be merged unless it has been sent to the general mailing list, so you can either get a head start or just wait.

Quoted 3 lines

Note that the current series is not in-sync with the latest specification.

It's only an RFC, so for now that's ok as it won't be merged anyway.

Alistair

Quoted 182 lines

We'll try to point out the specific deviations (we have a tree that we've been keeping in sync with the changes to the spec since mid- December) in our reviews.

Cheers,
Philipp.

Quoted 175 lines

When submitting patches can you please follow the steps here:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#submitting-your-patches

It's important that all patches are sent to the qemu-devel mailing list
(that's actually much more important then the RISC-V mailing list).

Alistair

Quoted 165 lines

---------- Forwarded Message ---------

From: Lawrence Hunter <[email protected]>
Subject: [RFC PATCH 00/39] Add RISC-V cryptography extensions standardisation
Date: Jan 19 2023, at 2:34 pm
To: [email protected]
Cc: [email protected], [email protected], Lawrence Hunter <[email protected]>

Quoted 153 lines

This RFC introduces an implementation for the six instruction sets
of the draft RISC-V cryptography extensions standardisation specification. Once the specification has been ratified we will submit
these changes as a pull request email to this mailing list. Would
this
be prefered by instruction group or unified as in this RFC?

This patch set implements the instruction sets as per the 20221202
version of the specification (1).

Work performed by Dickon, Lawrence, Nazar, Kiran, and William from
Codethink
sponsored by SiFive, and Max Chou from SiFive.

1. https://github.com/riscv/riscv-crypto/releases

Dickon Hood (1):
 target/riscv: Add vrol.[vv,vx] and vror.[vv,vx,vi] decoding, translation and execution support

Kiran Ostrolenk (4):
 target/riscv: Add vsha2ms.vv decoding, translation and execution
   support
 target/riscv: add zvksh cpu property
 target/riscv: Add vsm3c.vi decoding, translation and execution support
 target/riscv: expose zvksh cpu property

Lawrence Hunter (16):
 target/riscv: Add vclmul.vv decoding, translation and execution
   support
 target/riscv: Add vclmul.vx decoding, translation and execution
   support
 target/riscv: Add vclmulh.vv decoding, translation and execution
   support
 target/riscv: Add vclmulh.vx decoding, translation and execution
   support
 target/riscv: Add vaesef.vv decoding, translation and execution
   support
 target/riscv: Add vaesef.vs decoding, translation and execution
   support
 target/riscv: Add vaesdf.vv decoding, translation and execution
   support
 target/riscv: Add vaesdf.vs decoding, translation and execution
   support
 target/riscv: Add vaesdm.vv decoding, translation and execution
   support
 target/riscv: Add vaesdm.vs decoding, translation and execution
   support
 target/riscv: Add vaesz.vs decoding, translation and execution support
 target/riscv: Add vsha2c[hl].vv decoding, translation and execution
   support
 target/riscv: Add vsm3me.vv decoding, translation and execution
   support
 target/riscv: add zvkg cpu property
 target/riscv: Add vghmac.vv decoding, translation and execution
   support
 target/riscv: expose zvkg cpu property

Max Chou (5):
 crypto: Move SM4_SBOXWORD from target/riscv
 crypto: Add SM4 constant parameter CK.
 target/riscv: Add zvksed cfg property
 target/riscv: Add Zvksed support
 target/riscv: Expose Zvksed property

Nazar Kazakov (10):
 target/riscv: add zvkb cpu property
 target/riscv: Add vrev8.v decoding, translation and execution support
 target/riscv: Add vandn.[vv,vx,vi] decoding, translation and execution
   support
 target/riscv: expose zvkb cpu property target/riscv: add zvkns cpu property
 target/riscv: Add vaeskf1.vi decoding, translation and execution
   support
 target/riscv: Add vaeskf2.vi decoding, translation and execution
   support
 target/riscv: expose zvkns cpu property target/riscv: add zvknh cpu properties target/riscv: expose zvknh cpu properties

William Salmon (3):
 target/riscv: Add vbrev8.v decoding, translation and execution support
 target/riscv: Add vaesem.vv decoding, translation and execution
   support
 target/riscv: Add vaesem.vs decoding, translation and execution
   support

crypto/sm4.c                                 |   10 + include/crypto/sm4.h                         |    8 + include/qemu/bitops.h                        |   32 + target/arm/crypto_helper.c                   |   10 +- target/riscv/cpu.c                           |   15 + target/riscv/cpu.h                           |    7 + target/riscv/crypto_helper.c                 |    1 + target/riscv/helper.h                        |   69 ++ target/riscv/insn32.decode                   |   48 + target/riscv/insn_trans/trans_rvzvkb.c.inc   |  164 +++ target/riscv/insn_trans/trans_rvzvkg.c.inc   |    8 + target/riscv/insn_trans/trans_rvzvknh.c.inc  |   47 + target/riscv/insn_trans/trans_rvzvkns.c.inc  |  121 +++ target/riscv/insn_trans/trans_rvzvksed.c.inc |   38 + target/riscv/insn_trans/trans_rvzvksh.c.inc  |   20 + target/riscv/meson.build                     |    4 +- target/riscv/translate.c                     |    6 + target/riscv/vcrypto_helper.c                | 1013
++++++++++++++++++
target/riscv/vector_helper.c                 |  242 +---- target/riscv/vector_internals.c              |   63 ++ target/riscv/vector_internals.h              |  226 ++++

21 files changed, 1902 insertions(+), 250 deletions(-)

create mode 100644 target/riscv/insn_trans/trans_rvzvkb.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkg.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvknh.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkns.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksed.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksh.c.inc create mode 100644 target/riscv/vcrypto_helper.c create mode 100644 target/riscv/vector_internals.c create mode 100644 target/riscv/vector_internals.h

--
2.39.1

maintainer
#47 lore raw
Quoted 30 lines · On Mon, 30 Jan 2023 03:38:13 PST (-0800), [email protected] wrote:
Quoted 22 lines · Alistair Francis
Quoted 21 lines · Philipp Tomsich
Quoted 15 lines · Alistair Francis
Quoted 7 lines · Lawrence Hunter

Follow up for add RISC-V vector cryptography extensions standardisation
RFC: we've not received any comments and would like to move this series
towards getting merged. Does anyone have time to review it, and should
we look at resubmitting for merging soon?

Hello,

This series never made it to the QEMU list. It looks like it was never
sent to the general qemu-devel mailing list.

Quoted 4 lines
Quoted 4 lines

This has so far been more than a little painful for our review, as we can't just pull the patches down from patchwork to use our regular test-and-review flow.
Should we wait until the resubmission for our review?

Quoted 4 lines

We have pushed a branch 'rfc-zvk-19-01-23' with our commits based on a fairly recent master. Hopefully this will ease the review process.

https://github.com/CodethinkLabs/qemu-ct.git

That's frequently helpful too, but the standard practice in QEMU is to always CC qemu-devel, even if you're aiming at another list too (like qemu-riscv, for example). It's different than Linux, and IIUC it's there to make some of the automation work.

Quoted 195 lines
Quoted 195 lines

Up to you. It won't be merged unless it has been sent to the general mailing list, so you can either get a head start or just wait.

Quoted 3 lines

Note that the current series is not in-sync with the latest specification.

It's only an RFC, so for now that's ok as it won't be merged anyway.

Alistair

Quoted 182 lines

We'll try to point out the specific deviations (we have a tree that we've been keeping in sync with the changes to the spec since mid- December) in our reviews.

Cheers,
Philipp.

Quoted 175 lines

When submitting patches can you please follow the steps here:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#submitting-your-patches

It's important that all patches are sent to the qemu-devel mailing list
(that's actually much more important then the RISC-V mailing list).

Alistair

Quoted 165 lines

---------- Forwarded Message ---------

From: Lawrence Hunter <[email protected]>
Subject: [RFC PATCH 00/39] Add RISC-V cryptography extensions standardisation
Date: Jan 19 2023, at 2:34 pm
To: [email protected]
Cc: [email protected], [email protected], Lawrence Hunter <[email protected]>

Quoted 153 lines

This RFC introduces an implementation for the six instruction sets
of the draft RISC-V cryptography extensions standardisation specification. Once the specification has been ratified we will submit
these changes as a pull request email to this mailing list. Would
this
be prefered by instruction group or unified as in this RFC?

This patch set implements the instruction sets as per the 20221202
version of the specification (1).

Work performed by Dickon, Lawrence, Nazar, Kiran, and William from
Codethink
sponsored by SiFive, and Max Chou from SiFive.

1. https://github.com/riscv/riscv-crypto/releases

Dickon Hood (1):
 target/riscv: Add vrol.[vv,vx] and vror.[vv,vx,vi] decoding, translation and execution support

Kiran Ostrolenk (4):
 target/riscv: Add vsha2ms.vv decoding, translation and execution
   support
 target/riscv: add zvksh cpu property
 target/riscv: Add vsm3c.vi decoding, translation and execution support
 target/riscv: expose zvksh cpu property

Lawrence Hunter (16):
 target/riscv: Add vclmul.vv decoding, translation and execution
   support
 target/riscv: Add vclmul.vx decoding, translation and execution
   support
 target/riscv: Add vclmulh.vv decoding, translation and execution
   support
 target/riscv: Add vclmulh.vx decoding, translation and execution
   support
 target/riscv: Add vaesef.vv decoding, translation and execution
   support
 target/riscv: Add vaesef.vs decoding, translation and execution
   support
 target/riscv: Add vaesdf.vv decoding, translation and execution
   support
 target/riscv: Add vaesdf.vs decoding, translation and execution
   support
 target/riscv: Add vaesdm.vv decoding, translation and execution
   support
 target/riscv: Add vaesdm.vs decoding, translation and execution
   support
 target/riscv: Add vaesz.vs decoding, translation and execution support
 target/riscv: Add vsha2c[hl].vv decoding, translation and execution
   support
 target/riscv: Add vsm3me.vv decoding, translation and execution
   support
 target/riscv: add zvkg cpu property
 target/riscv: Add vghmac.vv decoding, translation and execution
   support
 target/riscv: expose zvkg cpu property

Max Chou (5):
 crypto: Move SM4_SBOXWORD from target/riscv
 crypto: Add SM4 constant parameter CK.
 target/riscv: Add zvksed cfg property
 target/riscv: Add Zvksed support
 target/riscv: Expose Zvksed property

Nazar Kazakov (10):
 target/riscv: add zvkb cpu property
 target/riscv: Add vrev8.v decoding, translation and execution support
 target/riscv: Add vandn.[vv,vx,vi] decoding, translation and execution
   support
 target/riscv: expose zvkb cpu property target/riscv: add zvkns cpu property
 target/riscv: Add vaeskf1.vi decoding, translation and execution
   support
 target/riscv: Add vaeskf2.vi decoding, translation and execution
   support
 target/riscv: expose zvkns cpu property target/riscv: add zvknh cpu properties target/riscv: expose zvknh cpu properties

William Salmon (3):
 target/riscv: Add vbrev8.v decoding, translation and execution support
 target/riscv: Add vaesem.vv decoding, translation and execution
   support
 target/riscv: Add vaesem.vs decoding, translation and execution
   support

crypto/sm4.c                                 |   10 + include/crypto/sm4.h                         |    8 + include/qemu/bitops.h                        |   32 + target/arm/crypto_helper.c                   |   10 +- target/riscv/cpu.c                           |   15 + target/riscv/cpu.h                           |    7 + target/riscv/crypto_helper.c                 |    1 + target/riscv/helper.h                        |   69 ++ target/riscv/insn32.decode                   |   48 + target/riscv/insn_trans/trans_rvzvkb.c.inc   |  164 +++ target/riscv/insn_trans/trans_rvzvkg.c.inc   |    8 + target/riscv/insn_trans/trans_rvzvknh.c.inc  |   47 + target/riscv/insn_trans/trans_rvzvkns.c.inc  |  121 +++ target/riscv/insn_trans/trans_rvzvksed.c.inc |   38 + target/riscv/insn_trans/trans_rvzvksh.c.inc  |   20 + target/riscv/meson.build                     |    4 +- target/riscv/translate.c                     |    6 + target/riscv/vcrypto_helper.c                | 1013
++++++++++++++++++
target/riscv/vector_helper.c                 |  242 +---- target/riscv/vector_internals.c              |   63 ++ target/riscv/vector_internals.h              |  226 ++++

21 files changed, 1902 insertions(+), 250 deletions(-)

create mode 100644 target/riscv/insn_trans/trans_rvzvkb.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkg.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvknh.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvkns.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksed.c.inc create mode 100644 target/riscv/insn_trans/trans_rvzvksh.c.inc create mode 100644 target/riscv/vcrypto_helper.c create mode 100644 target/riscv/vector_internals.c create mode 100644 target/riscv/vector_internals.h

--
2.39.1