Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2222288/?format=api
{ "id": 2222288, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2222288/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260411070637.72421-6-james.hilliard1@gmail.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260411070637.72421-6-james.hilliard1@gmail.com>", "date": "2026-04-11T07:06:32", "name": "[6/9] target/mips: add Octeon SHA3 crypto support", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "b8d23e8bc784b8b5fafa171d3e5495370f49294a", "submitter": { "id": 66301, "url": "http://patchwork.ozlabs.org/api/1.1/people/66301/?format=api", "name": "James Hilliard", "email": "james.hilliard1@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260411070637.72421-6-james.hilliard1@gmail.com/mbox/", "series": [ { "id": 499531, "url": "http://patchwork.ozlabs.org/api/1.1/series/499531/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499531", "date": "2026-04-11T07:06:33", "name": "[1/9] linux-user/mips, target/mips: honor MIPS_FIXADE for unaligned accesses", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/499531/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2222288/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2222288/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=PhJvETFW;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4ft4XG3Bgxz1yGb\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 11 Apr 2026 17:08:46 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wBSQu-0001bB-8k; Sat, 11 Apr 2026 03:07:08 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <james.hilliard1@gmail.com>)\n id 1wBSQt-0001aO-6L\n for qemu-devel@nongnu.org; Sat, 11 Apr 2026 03:07:07 -0400", "from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <james.hilliard1@gmail.com>)\n id 1wBSQr-00010U-2J\n for qemu-devel@nongnu.org; Sat, 11 Apr 2026 03:07:06 -0400", "by mail-oa1-x2b.google.com with SMTP id\n 586e51a60fabf-4232323a7daso1595933fac.1\n for <qemu-devel@nongnu.org>; Sat, 11 Apr 2026 00:07:04 -0700 (PDT)", "from Mac.localdomain (71-218-253-186.hlrn.qwest.net.\n [71.218.253.186]) by smtp.gmail.com with ESMTPSA id\n 5614622812f47-478a0f1e841sm2651091b6e.5.2026.04.11.00.07.01\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Sat, 11 Apr 2026 00:07:02 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775891224; x=1776496024; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=BfUwVblsYiwbkfJcD68ywxdRtAmbn2hms1V2rUmc7wo=;\n b=PhJvETFWldyp5NIXnISTdXGKbP6K9TiVTYml96DCGUtAtrNzFMp6fw3eqA6Zc/mrBj\n pKI8Ad5irV3S+G3TiMVhZwhQoH1vojMn8htw+F6mL7o2cricp1NkcRF6NiIz0MQEJBmt\n /Cf3TAsFSD+GFMIq8/rob3QFeISsKBgk6ZlTyviIjNLf3h071RWf5naLFmWbVJP6pF82\n lmLUsqswISmo5yhyntBeStYu5J5ke1FITCOq3/nzP00fUef5Ttf17lou3UoT2Myt6vyd\n szhd8JP7DWwBK1JH428SVTg31Gmei1mIeadZRi0Q0JnyDXrQM2GyLAkrxc/r03cFLe0g\n wfDg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775891224; x=1776496024;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=BfUwVblsYiwbkfJcD68ywxdRtAmbn2hms1V2rUmc7wo=;\n b=tKrsYVsf8XRTNuvMDk2/A/VQ732Iu48q8UwUq3NWb/+4pYN+nFMWuAY/7AsR8wJoQ+\n DEIBjLAKwAmcMv3ShXNRtctLoL6bnYIoh4bKAYU6YwqbVJYXV4VR6MUH41HAdLhLfyV4\n 1k9zScxO1LXizvlxzCi/9cfYyPAxjXG51fUDUkXtnDvL6MjmOa4rKuaJ+YtK7gAX0bWM\n 69hmnLyx8YJ28xQ4S5OMYIn2QPU3d/fYFSiJpnQdOp3blWhJ+DU8Y/ytAbneQBUGrDht\n PMPIKdEwyZK7GGDfzX7WA1gJVI+eKypt0fAUjgUlUhNRwZdcXHmpaL57XAgjhczXZTD9\n aV3w==", "X-Gm-Message-State": "AOJu0YyMXSIOQKgZESkUVl/4WRseWwC+5wfKYUdrtG8XUa373L3fi2a7\n y7UMKMynnTu7OahGVAkOdDez2RQ1pBlYByU6Jjv1BgLQijYCMxpVdgOEWIeKRn4H5o0=", "X-Gm-Gg": "AeBDievUgrMEIpLfxAzrSePtSvNa1G4On4ILMCLPVz9odPO47/nqRonl0lEddA7hXV9\n HVCuUsrnEFmvGE8ySOGQNlGpNxBqstfOMbjLLqUWqckdz8lOf2hDwaqX5rvUAK9D4zOLem6W5D2\n cL5SbPQCUWF4mS6JhM4OFefhT2yy9uw+rOMIJ11iZ6XQIxOBkJkCOB1PfjZXzbdynrrULV21mql\n 9tBPq+MT2Kg9SOsiHvi+h4Pn7yM4f+vcS2TmSksuTLLGh1TZzznFKKMTIHyiVPmrM6/meKth4Zm\n SGrN858erzNnd9MG5luvFwW4bDrrNzx45pmstd9gACsndPq/nSl9Q7iOfcxrc79hoJ8CaDfeJNz\n Kq3yI+ppU/K2NOOkBXEEsSQwEfvqfxE+uIEwOAl5fH22A/GCV/UOGWg71wB7QlSUyiTKqkow8N+\n LA8JtW0b9Xy+6eRVGiJX+tWhhGYk9F7p84MaTJHbSsestw/f8viBWvJ6TcHEzUOImH0q0eM1WaG\n bbHM8IfrEz/CCtMsFII7lrMU8mH2IOphcPzIQjD+2AX7ddvgWKRXmep22rS/wb0440aDzQ=", "X-Received": "by 2002:a05:6808:4e83:b0:450:c602:751d with SMTP id\n 5614622812f47-4789f30a117mr2439542b6e.21.1775891223632;\n Sat, 11 Apr 2026 00:07:03 -0700 (PDT)", "From": "James Hilliard <james.hilliard1@gmail.com>", "To": "qemu-devel@nongnu.org", "Cc": "James Hilliard <james.hilliard1@gmail.com>,\n Laurent Vivier <laurent@vivier.eu>,\n Pierrick Bouvier <pierrick.bouvier@linaro.org>, =?utf-8?q?Philippe_Mathieu-?=\n\t=?utf-8?q?Daud=C3=A9?= <philmd@linaro.org>,\n Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>,\n Aleksandar Rikalo <arikalo@gmail.com>, Huacai Chen <chenhuacai@kernel.org>", "Subject": "[PATCH 6/9] target/mips: add Octeon SHA3 crypto support", "Date": "Sat, 11 Apr 2026 01:06:32 -0600", "Message-ID": "<20260411070637.72421-6-james.hilliard1@gmail.com>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260411070637.72421-1-james.hilliard1@gmail.com>", "References": "<20260411070637.72421-1-james.hilliard1@gmail.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2001:4860:4864:20::2b;\n envelope-from=james.hilliard1@gmail.com; helo=mail-oa1-x2b.google.com", "X-Spam_score_int": "-17", "X-Spam_score": "-1.8", "X-Spam_bar": "-", "X-Spam_report": "(-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Add the Octeon SHA3 register window and STARTOP selector.\n\nModel the dedicated 25-lane Keccak state and the Keccak-f[1600]\npermutation so the COP2 SHA3 interface follows the hardware behaviour.\n\nSigned-off-by: James Hilliard <james.hilliard1@gmail.com>\n---\n target/mips/cpu.h | 22 +++++\n target/mips/tcg/octeon_crypto.c | 155 ++++++++++++++++++++++++++++++++\n target/mips/tcg/translate.c | 30 +++++++\n 3 files changed, 207 insertions(+)", "diff": "diff --git a/target/mips/cpu.h b/target/mips/cpu.h\nindex 28b3e71793..dc5223e165 100644\n--- a/target/mips/cpu.h\n+++ b/target/mips/cpu.h\n@@ -541,6 +541,7 @@ typedef enum MIPSOcteonSharedMode {\n OCTEON_SHARED_MODE_NONE = 0,\n OCTEON_SHARED_MODE_SHA512,\n OCTEON_SHARED_MODE_SNOW3G,\n+ OCTEON_SHARED_MODE_SHA3,\n } MIPSOcteonSharedMode;\n \n typedef enum MIPSOcteonCop2Sel {\n@@ -645,6 +646,7 @@ typedef enum MIPSOcteonCop2Sel {\n OCTEON_COP2_SEL_HSH_DATW13,\n OCTEON_COP2_SEL_HSH_DATW14,\n OCTEON_COP2_SEL_HSH_DATW15,\n+ OCTEON_COP2_SEL_SHA3_DAT15_READ = 0x024f,\n OCTEON_COP2_SEL_HSH_IVW0 = 0x0250,\n OCTEON_COP2_SEL_HSH_IVW1,\n OCTEON_COP2_SEL_HSH_IVW2,\n@@ -671,6 +673,24 @@ typedef enum MIPSOcteonCop2Sel {\n OCTEON_COP2_SEL_GFM_RESINP1,\n OCTEON_COP2_SEL_GFM_XOR0,\n OCTEON_COP2_SEL_GFM_POLY = 0x025e,\n+ OCTEON_COP2_SEL_SHA3_XORDAT0 = 0x02c0,\n+ OCTEON_COP2_SEL_SHA3_XORDAT1,\n+ OCTEON_COP2_SEL_SHA3_XORDAT2,\n+ OCTEON_COP2_SEL_SHA3_XORDAT3,\n+ OCTEON_COP2_SEL_SHA3_XORDAT4,\n+ OCTEON_COP2_SEL_SHA3_XORDAT5,\n+ OCTEON_COP2_SEL_SHA3_XORDAT6,\n+ OCTEON_COP2_SEL_SHA3_XORDAT7,\n+ OCTEON_COP2_SEL_SHA3_XORDAT8,\n+ OCTEON_COP2_SEL_SHA3_XORDAT9,\n+ OCTEON_COP2_SEL_SHA3_XORDAT10,\n+ OCTEON_COP2_SEL_SHA3_XORDAT11,\n+ OCTEON_COP2_SEL_SHA3_XORDAT12,\n+ OCTEON_COP2_SEL_SHA3_XORDAT13,\n+ OCTEON_COP2_SEL_SHA3_XORDAT14,\n+ OCTEON_COP2_SEL_SHA3_XORDAT15,\n+ OCTEON_COP2_SEL_SHA3_XORDAT16,\n+ OCTEON_COP2_SEL_SHA3_XORDAT17,\n OCTEON_COP2_SEL_AES_ENC_CBC1 = 0x3109,\n OCTEON_COP2_SEL_AES_ENC1 = 0x310b,\n OCTEON_COP2_SEL_AES_DEC_CBC1 = 0x310d,\n@@ -683,6 +703,7 @@ typedef enum MIPSOcteonCop2Sel {\n OCTEON_COP2_SEL_SNOW3G_START = 0x404d,\n OCTEON_COP2_SEL_SNOW3G_MORE = 0x404e,\n OCTEON_COP2_SEL_HSH_STARTSHA256 = 0x404f,\n+ OCTEON_COP2_SEL_SHA3_STARTOP = 0x4052,\n OCTEON_COP2_SEL_GFM_XORMUL1_REFLECT = 0x405d,\n OCTEON_COP2_SEL_HSH_STARTSHA1 = 0x4057,\n OCTEON_COP2_SEL_HSH_STARTSHA512 = 0x424f,\n@@ -697,6 +718,7 @@ typedef struct MIPSOcteonCryptoState {\n uint64_t hash_block[8];\n uint64_t sha512_state[8];\n uint64_t sha512_block[16];\n+ uint64_t sha3_state[25];\n uint64_t aes_iv[2];\n uint64_t aes_key[4];\n uint64_t aes_result[2];\ndiff --git a/target/mips/tcg/octeon_crypto.c b/target/mips/tcg/octeon_crypto.c\nindex 976f6c7ddb..7dde536560 100644\n--- a/target/mips/tcg/octeon_crypto.c\n+++ b/target/mips/tcg/octeon_crypto.c\n@@ -490,6 +490,107 @@ static void octeon_sha512_transform(MIPSOcteonCryptoState *crypto)\n crypto->sha512_state[7] += h;\n }\n \n+static const uint64_t octeon_sha3_round_constants[24] = {\n+ 0x0000000000000001ULL, 0x0000000000008082ULL,\n+ 0x800000000000808aULL, 0x8000000080008000ULL,\n+ 0x000000000000808bULL, 0x0000000080000001ULL,\n+ 0x8000000080008081ULL, 0x8000000000008009ULL,\n+ 0x000000000000008aULL, 0x0000000000000088ULL,\n+ 0x0000000080008009ULL, 0x000000008000000aULL,\n+ 0x000000008000808bULL, 0x800000000000008bULL,\n+ 0x8000000000008089ULL, 0x8000000000008003ULL,\n+ 0x8000000000008002ULL, 0x8000000000000080ULL,\n+ 0x000000000000800aULL, 0x800000008000000aULL,\n+ 0x8000000080008081ULL, 0x8000000000008080ULL,\n+ 0x0000000080000001ULL, 0x8000000080008008ULL,\n+};\n+\n+static const uint8_t octeon_sha3_rotation_constants[24] = {\n+ 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14,\n+ 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44,\n+};\n+\n+static const uint8_t octeon_sha3_pi_lanes[24] = {\n+ 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4,\n+ 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1,\n+};\n+\n+static void octeon_sha3_permute(MIPSOcteonCryptoState *crypto)\n+{\n+ uint64_t *state = crypto->sha3_state;\n+\n+ for (int round = 0; round < 24; round++) {\n+ uint64_t bc[5];\n+ uint64_t temp;\n+\n+ for (int x = 0; x < 5; x++) {\n+ bc[x] = state[x] ^ state[5 + x] ^ state[10 + x] ^\n+ state[15 + x] ^ state[20 + x];\n+ }\n+ for (int x = 0; x < 5; x++) {\n+ temp = bc[(x + 4) % 5] ^ rol64(bc[(x + 1) % 5], 1);\n+ for (int y = 0; y < 25; y += 5) {\n+ state[y + x] ^= temp;\n+ }\n+ }\n+\n+ temp = state[1];\n+ for (int i = 0; i < 24; i++) {\n+ uint64_t next = state[octeon_sha3_pi_lanes[i]];\n+\n+ state[octeon_sha3_pi_lanes[i]] =\n+ rol64(temp, octeon_sha3_rotation_constants[i]);\n+ temp = next;\n+ }\n+\n+ for (int y = 0; y < 25; y += 5) {\n+ for (int x = 0; x < 5; x++) {\n+ bc[x] = state[y + x];\n+ }\n+ for (int x = 0; x < 5; x++) {\n+ state[y + x] = bc[x] ^ ((~bc[(x + 1) % 5]) & bc[(x + 2) % 5]);\n+ }\n+ }\n+\n+ state[0] ^= octeon_sha3_round_constants[round];\n+ }\n+}\n+\n+static int octeon_sha3_dat_pos_from_sel(uint32_t sel)\n+{\n+ if (sel >= OCTEON_COP2_SEL_HSH_DATW0 &&\n+ sel <= OCTEON_COP2_SEL_HSH_DATW14) {\n+ return sel - OCTEON_COP2_SEL_HSH_DATW0;\n+ }\n+ if (sel >= OCTEON_COP2_SEL_HSH_IVW0 &&\n+ sel <= OCTEON_COP2_SEL_HSH_IVW7) {\n+ return 16 + (sel - OCTEON_COP2_SEL_HSH_IVW0);\n+ }\n+\n+ switch (sel) {\n+ /*\n+ * SHA3_DAT15_READ aliases HSH_DATW15 at 0x024f, so a single case covers\n+ * both selector names.\n+ */\n+ case OCTEON_COP2_SEL_HSH_DATW15:\n+ case OCTEON_COP2_SEL_SHA3_DAT15_WRITE:\n+ return 15;\n+ case OCTEON_COP2_SEL_SHA3_DAT24:\n+ return 24;\n+ default:\n+ return -1;\n+ }\n+}\n+\n+static int octeon_sha3_xordat_pos_from_sel(uint32_t sel)\n+{\n+ if (sel >= OCTEON_COP2_SEL_SHA3_XORDAT0 &&\n+ sel <= OCTEON_COP2_SEL_SHA3_XORDAT17) {\n+ return sel - OCTEON_COP2_SEL_SHA3_XORDAT0;\n+ }\n+ return -1;\n+}\n+\n static const uint8_t octeon_snow3g_sr[256] = {\n 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,\n 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,\n@@ -1384,6 +1485,7 @@ static void octeon_gfm_mul(const uint64_t x[2], const uint64_t y[2],\n target_ulong helper_octeon_cop2_dmfc2(CPUMIPSState *env, uint32_t sel)\n {\n MIPSOcteonCryptoState *crypto = &env->octeon_crypto;\n+ int sha3_pos;\n \n if (crypto->shared_mode == OCTEON_SHARED_MODE_SNOW3G) {\n if (sel >= OCTEON_COP2_SEL_SNOW3G_LFSR0 &&\n@@ -1405,6 +1507,13 @@ target_ulong helper_octeon_cop2_dmfc2(CPUMIPSState *env, uint32_t sel)\n }\n }\n \n+ if (crypto->shared_mode == OCTEON_SHARED_MODE_SHA3) {\n+ sha3_pos = octeon_sha3_dat_pos_from_sel(sel);\n+ if (sha3_pos >= 0) {\n+ return crypto->sha3_state[sha3_pos];\n+ }\n+ }\n+\n switch (sel) {\n case OCTEON_COP2_SEL_3DES_KEY0:\n case OCTEON_COP2_SEL_3DES_KEY1:\n@@ -1446,7 +1555,16 @@ target_ulong helper_octeon_cop2_dmfc2(CPUMIPSState *env, uint32_t sel)\n case OCTEON_COP2_SEL_HSH_DATW5:\n case OCTEON_COP2_SEL_HSH_DATW6:\n case OCTEON_COP2_SEL_HSH_DATW7:\n+ case OCTEON_COP2_SEL_HSH_DATW8:\n+ case OCTEON_COP2_SEL_HSH_DATW9:\n+ case OCTEON_COP2_SEL_HSH_DATW10:\n+ case OCTEON_COP2_SEL_HSH_DATW11:\n+ case OCTEON_COP2_SEL_HSH_DATW12:\n+ case OCTEON_COP2_SEL_HSH_DATW13:\n+ case OCTEON_COP2_SEL_HSH_DATW14:\n return crypto->sha512_block[sel - OCTEON_COP2_SEL_HSH_DATW0];\n+ case OCTEON_COP2_SEL_HSH_DATW15:\n+ return crypto->sha512_block[15];\n case OCTEON_COP2_SEL_HSH_IVW0:\n case OCTEON_COP2_SEL_HSH_IVW1:\n case OCTEON_COP2_SEL_HSH_IVW2:\n@@ -1486,6 +1604,7 @@ void helper_octeon_cop2_dmtc2(CPUMIPSState *env, target_ulong value,\n {\n MIPSOcteonCryptoState *crypto = &env->octeon_crypto;\n uint64_t q = (uint64_t)value;\n+ int sha3_pos;\n \n switch (sel) {\n case OCTEON_COP2_SEL_3DES_KEY0:\n@@ -1600,6 +1719,7 @@ void helper_octeon_cop2_dmtc2(CPUMIPSState *env, target_ulong value,\n case OCTEON_COP2_SEL_HSH_DATW13:\n case OCTEON_COP2_SEL_HSH_DATW14:\n crypto->sha512_block[sel - OCTEON_COP2_SEL_HSH_DATW0] = q;\n+ crypto->sha3_state[sel - OCTEON_COP2_SEL_HSH_DATW0] = q;\n break;\n case OCTEON_COP2_SEL_HSH_DATW15:\n case OCTEON_COP2_SEL_HSH_STARTSHA512:\n@@ -1607,6 +1727,14 @@ void helper_octeon_cop2_dmtc2(CPUMIPSState *env, target_ulong value,\n octeon_set_shared_mode(crypto, OCTEON_SHARED_MODE_SHA512);\n octeon_sha512_transform(crypto);\n break;\n+ case OCTEON_COP2_SEL_SHA3_DAT15_WRITE:\n+ octeon_set_shared_mode(crypto, OCTEON_SHARED_MODE_SHA3);\n+ crypto->sha3_state[15] = q;\n+ break;\n+ case OCTEON_COP2_SEL_SHA3_DAT24:\n+ octeon_set_shared_mode(crypto, OCTEON_SHARED_MODE_SHA3);\n+ crypto->sha3_state[24] = q;\n+ break;\n case OCTEON_COP2_SEL_HSH_IVW0:\n case OCTEON_COP2_SEL_HSH_IVW1:\n case OCTEON_COP2_SEL_HSH_IVW2:\n@@ -1616,6 +1744,7 @@ void helper_octeon_cop2_dmtc2(CPUMIPSState *env, target_ulong value,\n case OCTEON_COP2_SEL_HSH_IVW6:\n case OCTEON_COP2_SEL_HSH_IVW7:\n crypto->sha512_state[sel - OCTEON_COP2_SEL_HSH_IVW0] = q;\n+ crypto->sha3_state[16 + (sel - OCTEON_COP2_SEL_HSH_IVW0)] = q;\n break;\n case OCTEON_COP2_SEL_GFM_MUL_REFLECT0:\n case OCTEON_COP2_SEL_GFM_MUL_REFLECT1:\n@@ -1667,6 +1796,32 @@ void helper_octeon_cop2_dmtc2(CPUMIPSState *env, target_ulong value,\n crypto->hash_block[7] = q;\n octeon_sha1_transform(crypto);\n break;\n+ case OCTEON_COP2_SEL_SHA3_XORDAT0:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT1:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT2:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT3:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT4:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT5:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT6:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT7:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT8:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT9:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT10:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT11:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT12:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT13:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT14:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT15:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT16:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT17:\n+ octeon_set_shared_mode(crypto, OCTEON_SHARED_MODE_SHA3);\n+ sha3_pos = octeon_sha3_xordat_pos_from_sel(sel);\n+ crypto->sha3_state[sha3_pos] ^= q;\n+ break;\n+ case OCTEON_COP2_SEL_SHA3_STARTOP:\n+ octeon_set_shared_mode(crypto, OCTEON_SHARED_MODE_SHA3);\n+ octeon_sha3_permute(crypto);\n+ break;\n case OCTEON_COP2_SEL_GFM_XORMUL1_REFLECT:\n octeon_gfm_mul_reflect(crypto, q);\n break;\ndiff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c\nindex c66cb63cfc..be380cab11 100644\n--- a/target/mips/tcg/translate.c\n+++ b/target/mips/tcg/translate.c\n@@ -9154,6 +9154,14 @@ static bool octeon_cop2_is_supported_dmfc2(uint16_t sel)\n case OCTEON_COP2_SEL_HSH_DATW5:\n case OCTEON_COP2_SEL_HSH_DATW6:\n case OCTEON_COP2_SEL_HSH_DATW7:\n+ case OCTEON_COP2_SEL_HSH_DATW8:\n+ case OCTEON_COP2_SEL_HSH_DATW9:\n+ case OCTEON_COP2_SEL_HSH_DATW10:\n+ case OCTEON_COP2_SEL_HSH_DATW11:\n+ case OCTEON_COP2_SEL_HSH_DATW12:\n+ case OCTEON_COP2_SEL_HSH_DATW13:\n+ case OCTEON_COP2_SEL_HSH_DATW14:\n+ case OCTEON_COP2_SEL_SHA3_DAT15_READ:\n case OCTEON_COP2_SEL_HSH_IV0:\n case OCTEON_COP2_SEL_HSH_IV1:\n case OCTEON_COP2_SEL_HSH_IV2:\n@@ -9167,6 +9175,7 @@ static bool octeon_cop2_is_supported_dmfc2(uint16_t sel)\n case OCTEON_COP2_SEL_HSH_IVW6:\n case OCTEON_COP2_SEL_HSH_IVW7:\n case OCTEON_COP2_SEL_AES_DAT0:\n+ case OCTEON_COP2_SEL_SHA3_DAT24:\n case OCTEON_COP2_SEL_GFM_MUL_REFLECT0:\n case OCTEON_COP2_SEL_GFM_MUL_REFLECT1:\n case OCTEON_COP2_SEL_GFM_RESINP_REFLECT0:\n@@ -9251,6 +9260,8 @@ static bool octeon_cop2_is_supported_dmtc2(uint16_t sel)\n case OCTEON_COP2_SEL_HSH_DATW13:\n case OCTEON_COP2_SEL_HSH_DATW14:\n case OCTEON_COP2_SEL_HSH_DATW15:\n+ case OCTEON_COP2_SEL_SHA3_DAT24:\n+ case OCTEON_COP2_SEL_SHA3_DAT15_WRITE:\n case OCTEON_COP2_SEL_HSH_IVW0:\n case OCTEON_COP2_SEL_HSH_IVW1:\n case OCTEON_COP2_SEL_HSH_IVW2:\n@@ -9268,11 +9279,30 @@ static bool octeon_cop2_is_supported_dmtc2(uint16_t sel)\n case OCTEON_COP2_SEL_GFM_RESINP1:\n case OCTEON_COP2_SEL_GFM_XOR0:\n case OCTEON_COP2_SEL_GFM_POLY:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT0:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT1:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT2:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT3:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT4:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT5:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT6:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT7:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT8:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT9:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT10:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT11:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT12:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT13:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT14:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT15:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT16:\n+ case OCTEON_COP2_SEL_SHA3_XORDAT17:\n case OCTEON_COP2_SEL_HSH_STARTSHA1_COMPAT:\n case OCTEON_COP2_SEL_HSH_STARTMD5:\n case OCTEON_COP2_SEL_SNOW3G_START:\n case OCTEON_COP2_SEL_SNOW3G_MORE:\n case OCTEON_COP2_SEL_HSH_STARTSHA256:\n+ case OCTEON_COP2_SEL_SHA3_STARTOP:\n case OCTEON_COP2_SEL_HSH_STARTSHA1:\n case OCTEON_COP2_SEL_GFM_XORMUL1_REFLECT:\n case OCTEON_COP2_SEL_HSH_STARTSHA512:\n", "prefixes": [ "6/9" ] }