From patchwork Fri Apr 16 21:02:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 422660 Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp749647jaf; Fri, 16 Apr 2021 15:02:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzz1iQVR9MkkervedKMECWQd6yQwEDMhYmv6NrBhNdKUoDdF8xrBEcu7f6tAPvffV81j9i X-Received: by 2002:a17:906:4cc5:: with SMTP id q5mr10373280ejt.302.1618610548241; Fri, 16 Apr 2021 15:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618610548; cv=none; d=google.com; s=arc-20160816; b=ft+XH5MSz84OxnFNpZaGhgVVywrpHpM0biTN6GJBxmeINYA+/jdw5pRmrB9vdH3LmL EulkKMpU2ltdcu4lDcAntWch2YhOyMMvSY5IDeQ89DL6h6hp6IF1BtY6C60v/ILeRZG+ BzoV+piEd+ewvdlsp2tgvgTxDhT5WL1obixMWp2h1zieJX6cqfAtQKBvOr9RpHjuLJ7E G/QDjtbx5YIP97WCF/xykdvD41iBPRzgJBokpOG38kG4wGU877WUn9khim52jj4MjT9a 8k9C2VVtmSNai1cx3Medx+2XrQZBGzK7UKQpOlay0ctGcucvY+HY3r5OzXSgiQtQ/WFo 645w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=08G/gmmis9kTq4Wos8KgqE9HaSoRMxfx4IEhQdOfahw=; b=IPnu6mKTg8I7sn+aW8lAlhrU6VNMF951hxjmPjhAcBebVWiANpMix0g+M+njw1VtME Lv42HAiHOL85Phi30XrxyYkYKiBNGqLcfTLX9SEYQcsI9yAG8/7l+gpRA3bWaEGzTbCI o5j9hJZnugJjPrl9SirEVf0e3An59tmHyDgMv4p/aygpEjtJtPxAI6beAxdAQkYHQZvb /n5mBqZnQ/trDOj8j1uOgxwzE65F9orsJSZHkPbhDj5smBhtDZ6HnZMKhtpOv14XJklp 1X7AN8jo/iYGOIXYzBBRLsF846vjxd+UmOjdEY1aGdy1IEcT5CC2MOylcY4wl6rHrL9b AK9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bX6wkcAp; 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 b13si5929183ede.383.2021.04.16.15.02.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Apr 2021 15:02:28 -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=bX6wkcAp; 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]:48882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXWXj-0002cq-9V for patch@linaro.org; Fri, 16 Apr 2021 18:02:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXVdo-0006VA-5l for qemu-devel@nongnu.org; Fri, 16 Apr 2021 17:04:40 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:33426) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXVdV-0001kV-JK for qemu-devel@nongnu.org; Fri, 16 Apr 2021 17:04:39 -0400 Received: by mail-pg1-x530.google.com with SMTP id t22so20043965pgu.0 for ; Fri, 16 Apr 2021 14:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=08G/gmmis9kTq4Wos8KgqE9HaSoRMxfx4IEhQdOfahw=; b=bX6wkcApBUdRtW3onP015fnjn/e0q9c4D54oStV9cNg8cbKTyWq1BNDjzE2VJS1ffn 8NJCjlUImC25+ZfGfV6tYp6aEi+QDZSg8p0frW+FVOP9wU566Fy52pwtxTJf99kR8YPK u8kBzMqzWWroaPQHQqohk2KbCZX5PfjOkHiMVJKsWtfnmMeX7T6Z5HRzwabY5FRXLTu3 IW2w1sWuHVBJ7VnMEXYlCeDTUAyQO/zIneAvrhw57FbcEEn4RVaOK0fD034jkU9ukf1I Y2iXK03pQ8kKwEPkWNgBnQnZOKZWUgIwjYAoYNHItopEIVW/7Yj0y6HZEO6Paf5ajF6R u5sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=08G/gmmis9kTq4Wos8KgqE9HaSoRMxfx4IEhQdOfahw=; b=p+Sz3UNiWZSSI8xWY95lVa98AQGK5ZOAe4QfyLpAIoE6/J9JEIIA8WmigeIgP8JAQh jaCSYSGyLJiXKhhGp/hP5IVzDgoIC9J0GYRYYha3PK6GL06hqgWM08fHU8F0YsNWiPyR q/2cRKwF7Pf/kq4qEI71YX3TsDsvyvAvithgWGyt6BUTe9UoUtD1gBuUIafQMy4sltCs IT1gRQxbzuG6BU7aAyvf2UCE4q5GKP6AwIHXfdiYzK4n3Nhv3Jvulz8tcZ/OHT3Q7m5w CZhmdpP4mlcYHHl5I/0/t3BxHKs7aBGkFXyk2GACRSG4PzN2UwS0lxj9gVDZDokE5B8d afdw== X-Gm-Message-State: AOAM531ylIYXMIWDr2cOQXowjDIwr5N5/77R1b/Q4d/S9MYGu6hwQsJl 1IMy3vq50oaVsBU7RrSlfYLXOMmieExwdw== X-Received: by 2002:a63:5807:: with SMTP id m7mr816391pgb.73.1618607053934; Fri, 16 Apr 2021 14:04:13 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id m9sm5766734pgt.65.2021.04.16.14.04.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 14:04:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 63/81] target/arm: Implement SVE2 crypto constructive binary operations Date: Fri, 16 Apr 2021 14:02:22 -0700 Message-Id: <20210416210240.1591291-64-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210416210240.1591291-1-richard.henderson@linaro.org> References: <20210416210240.1591291-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/cpu.h | 5 +++++ target/arm/sve.decode | 4 ++++ target/arm/translate-sve.c | 16 ++++++++++++++++ 3 files changed, 25 insertions(+) -- 2.25.1 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 904f5da290..b43fd066ba 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -4246,6 +4246,11 @@ static inline bool isar_feature_aa64_sve2_bitperm(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, BITPERM) != 0; } +static inline bool isar_feature_aa64_sve2_sha3(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SHA3) != 0; +} + static inline bool isar_feature_aa64_sve2_sm4(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SM4) != 0; diff --git a/target/arm/sve.decode b/target/arm/sve.decode index fb4d32691e..7a2770cb0c 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -1522,3 +1522,7 @@ AESMC 01000101 00 10000011100 decrypt:1 00000 rd:5 AESE 01000101 00 10001 0 11100 0 ..... ..... @rdn_rm_e0 AESD 01000101 00 10001 0 11100 1 ..... ..... @rdn_rm_e0 SM4E 01000101 00 10001 1 11100 0 ..... ..... @rdn_rm_e0 + +# SVE2 crypto constructive binary operations +SM4EKEY 01000101 00 1 ..... 11110 0 ..... ..... @rd_rn_rm_e0 +RAX1 01000101 00 1 ..... 11110 1 ..... ..... @rd_rn_rm_e0 diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 681bbc6174..de8a6b2a15 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -8121,3 +8121,19 @@ static bool trans_SM4E(DisasContext *s, arg_rrr_esz *a) { return do_sm4(s, a, gen_helper_crypto_sm4e); } + +static bool trans_SM4EKEY(DisasContext *s, arg_rrr_esz *a) +{ + return do_sm4(s, a, gen_helper_crypto_sm4ekey); +} + +static bool trans_RAX1(DisasContext *s, arg_rrr_esz *a) +{ + if (!dc_isar_feature(aa64_sve2_sha3, s)) { + return false; + } + if (sve_access_check(s)) { + gen_gvec_fn_zzz(s, gen_gvec_rax1, MO_64, a->rd, a->rn, a->rm); + } + return true; +}