From patchwork Fri Jun 9 02:23:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 690871 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp598558wru; Thu, 8 Jun 2023 19:29:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4EHdz9YWcu1qsQAdOFkhLPQJBKT4ltoxfzWP9KYShOWHK0fIw22g5vy5hHnNrNMDCJHexG X-Received: by 2002:ad4:5964:0:b0:616:4e24:ff28 with SMTP id eq4-20020ad45964000000b006164e24ff28mr430632qvb.0.1686277772691; Thu, 08 Jun 2023 19:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686277772; cv=none; d=google.com; s=arc-20160816; b=RgsuHsnAMoCO6EIV72WR6pNivw0sN8fLECqsz/wqUcET/N7gRBr0rO+E0EBakHk0mh rIjZ9YlRRlaXjV3TD7Mmly1L/PhFP9t9eZPF3eApXCuGck2N0cYrcRdkA/skL4b+j2j9 11ljGMrAR+dVBPeHr0/IRjp8PybRettJFEciBS9SXZ9MZjV9Y9qkOl7q5VbIxjAaKTdw gfZYXEZVrmuxjcGEu8J09yrsMcc79bpL5gf76qapMm1lfQnj3OkpJlG0mQqJslyVGNjn 7c3/YdYMLvHOufs7jrvvFw1yIrIIyQCcQcpww6WLcqx94z953t3gN+EOOqLbHhbEaHpN gUNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D0I8unuNO+OjgsLA/5Ao4N4ndudI6wjx6PBNe+Du5WM=; b=TiuQDcvoT1zKHb831s0UnTmXSAtsvmIdgj+n3Jsjq+czGjd+igXQdKBGKBGLxvHosu A0lXYCEX13QlxhcJpVVr2S45VZvM3au3EIn+aul7SY6gPzSt12MGUSNyBE0gSJpKiQib r/dFRqa6KU5J9VeztjcPZ92vmJTZpjzVa5Xa0fz4uLBqDz7WWM6jK2yBo/mVM0n96qRT cmvW34dbeRzi84HpDxLT41o2zCAyv7zkJvUs/j8HWFYyUp8WYd5bwDG23DE+QQcLofBt 8ObXrsohnAcDHm07lNyzxZCt615oayrv32zHjZXpmTClwYEpkwdUxKksthwnf0wY1Rs9 2I9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ich6EZwR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jq14-20020ad45fce000000b0062b62df2af3si1669404qvb.589.2023.06.08.19.29.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Jun 2023 19:29:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ich6EZwR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7RpE-0005or-BJ; Thu, 08 Jun 2023 22:26:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7RoE-00034p-Tx for qemu-devel@nongnu.org; Thu, 08 Jun 2023 22:25:04 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7Rng-0005kP-7u for qemu-devel@nongnu.org; Thu, 08 Jun 2023 22:25:02 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-655d1fc8ad8so1068905b3a.1 for ; Thu, 08 Jun 2023 19:24:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686277467; x=1688869467; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D0I8unuNO+OjgsLA/5Ao4N4ndudI6wjx6PBNe+Du5WM=; b=Ich6EZwRkdpG8fEHOiDbeIHJTpvbXVwajTCODoplBZdnYuGe7aoOhI8ZuRvaYZl6Mq xEmZNWdG7jttOLj7+MIzkWQUXs3+3xioqvSy5v9lHYZOVe1fMa/Q650esYtaXHtNgAHC z0fZhhJ3IBjofSYLmqrma/gA9PMV6KXunil7lbc/UETmraSwryzhTpIQM7OEAk/or+sR n7i8HRuAHeMW2iQAuobdpbrtDQ3IjsqY/4oUPczGgFNo6kB/tWeSKR5VBo5LfCUcUw8Z teGi0JtFS1DxtGY844Ry5EQYkO2vhafrm3sI6L/HXWJ/ZdCsF2oKSoGnoq3kB8Z5Zk6I oIxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686277467; x=1688869467; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D0I8unuNO+OjgsLA/5Ao4N4ndudI6wjx6PBNe+Du5WM=; b=TMxMW8rrtT3VK1F8MFrxbW+n0fmBBd6lTJGVgpjR8lQc6W+DZSnnNvJj8gd5QOJygh FCYtmVOBfiL6aQGX8WLHf43Eqgul0eJRigb7uXe4HFbiANCcqmCeKYpgm6l0G3jo8/5m s6LHOwrw0nhjsPAuiVKquRRtUEZI3nQHweKzqyqZ8Jmy0q79EzktNYblRKFrZzjgBGOh R4e/0oJe1jXlLslkYS8oWfpCWPYbssiW0DzJfgYpfxY6eTx/VlsJsApJ1Mg1V+hJLR5d PRzV4Py8fio8zggob05+QjUjh3mI1agWtEsc+NxkXlTzj3RYzX8K1eIr0mpXQejrx3OI qStQ== X-Gm-Message-State: AC+VfDz5DK6XufTxmYJQoR3YbN3lnnTytkJcW6fRf+a/RZGXN24PngZ4 FxCriomPYZNZqKuC/cQ8F3MkWXVaTRU+hNdk4Vw= X-Received: by 2002:a05:6a00:23c2:b0:647:e45f:1a4c with SMTP id g2-20020a056a0023c200b00647e45f1a4cmr36484pfc.11.1686277466951; Thu, 08 Jun 2023 19:24:26 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:b071:df63:5761:f449]) by smtp.gmail.com with ESMTPSA id x25-20020a62fb19000000b0063afb08afeesm1686458pfm.67.2023.06.08.19.24.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 19:24:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: ardb@kernel.org, berrange@redhat.com, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, pbonzini@redhat.com Subject: [PATCH v2 26/38] target/riscv: Use aesenc_SB_SR_MC_AK Date: Thu, 8 Jun 2023 19:23:49 -0700 Message-Id: <20230609022401.684157-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230609022401.684157-1-richard.henderson@linaro.org> References: <20230609022401.684157-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This implements the AES64ESM instruction. Signed-off-by: Richard Henderson --- target/riscv/crypto_helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/riscv/crypto_helper.c b/target/riscv/crypto_helper.c index 505166ce5a..c036fe8632 100644 --- a/target/riscv/crypto_helper.c +++ b/target/riscv/crypto_helper.c @@ -198,7 +198,12 @@ static inline target_ulong aes64_operation(target_ulong rs1, target_ulong rs2, target_ulong HELPER(aes64esm)(target_ulong rs1, target_ulong rs2) { - return aes64_operation(rs1, rs2, true, true); + AESState t; + + t.d[HOST_BIG_ENDIAN] = rs1; + t.d[!HOST_BIG_ENDIAN] = rs2; + aesenc_SB_SR_MC_AK(&t, &t, &aes_zero, false); + return t.d[HOST_BIG_ENDIAN]; } target_ulong HELPER(aes64es)(target_ulong rs1, target_ulong rs2)