On 5/17/26 22:29, James Hilliard wrote:
Add the common state needed by Octeon's selector-driven COP2 crypto
interfaces. This includes the selector constants and storage for the base
hash, AES, CRC, GFM, 3DES, KASUMI, and SNOW3G engines, plus the shared
selector-window mode used by overlapping hardware register banks.

Describe the shared HSH/SHA512, SHA3, SNOW3G, and ZUC selector window up
front so later engine patches only add their own selectors and state
instead of rewriting common comments.

Migrate the state in an Octeon-only subsection so non-Octeon CPU models do
not grow migration data. Later patches wire helpers and explicit selector
decode on top of this state.

Signed-off-by: James Hilliard <[email protected]>
---
Changes v7 -> v8:
   - Split COP2 crypto state and migration coverage out of the combined
     COP2 crypto core patch.
---
  target/mips/cpu.h            | 165 +++++++++++++++++++++++++++++++++++++++++++
  target/mips/system/machine.c |  37 ++++++++++
  2 files changed, 202 insertions(+)

diff --git a/target/mips/cpu.h b/target/mips/cpu.h
index 346713705a..1c552b8134 100644
--- a/target/mips/cpu.h
+++ b/target/mips/cpu.h
@@ -537,6 +537,169 @@ struct TCState {
  };
struct MIPSITUState;
+typedef enum MIPSOcteonSharedMode {
+    OCTEON_SHARED_MODE_NONE = 0,
+    OCTEON_SHARED_MODE_SHA512,
+    OCTEON_SHARED_MODE_SNOW3G,
+} MIPSOcteonSharedMode;
+
+typedef enum MIPSOcteonCop2Sel {

This enumeration shouldn't be required -- it's all decode.

+typedef struct MIPSOcteonCryptoState {
+    uint64_t des3_key[3];
+    uint64_t des3_iv;
+    uint64_t des3_result;
+    uint64_t hsh_iv[4];
+    uint64_t hsh_dat[8];
+    uint64_t hsh_ivw[8];
+    uint64_t hsh_datw[16];
+    uint64_t aes_iv[2];
+    uint64_t aes_key[4];
+    uint64_t aes_result[2];
+    uint64_t aes_input[2];
+    uint64_t gfm_mul[2];
+    uint64_t gfm_resinp[2];
+    uint64_t gfm_xor0;
+    uint64_t gfm_reflect_mul[2];
+    uint64_t gfm_reflect_resinp[2];
+    uint64_t gfm_reflect_xor0;
+    uint16_t gfm_poly;
+    uint8_t aes_keylen;
+    uint32_t shared_mode;

I guess you're using uint32_t instead of MIPSOcteonSharedMode for ease of 
migration?


r~

Reply via email to