From patchwork Fri Apr 16 21:02:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 422648 Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp744633jaf; Fri, 16 Apr 2021 14:53:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzb0n2CBo6fRabElyf2Q9aBJGR9UPe/o7hRW4aE+sGNdeoY4wnaGPBQjdMBpfSPj/y4paB X-Received: by 2002:a05:6602:1da:: with SMTP id w26mr5268854iot.170.1618609987057; Fri, 16 Apr 2021 14:53:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618609987; cv=none; d=google.com; s=arc-20160816; b=KKnVUjYNi3VPuGfzB5Ii8V1VhfbKxJBsHXWB9QL57NdpD2pZ9EDLxkBImYsO6FDe15 rgOgDa2YvdaJ7fq82GkhHa7cbhrZB7ubIQQLkO4r8AI49fF4bLxU6ua9hflC0khLW0oa HeMjv4WO+93Li3Efao2BeqM8z/53GHU7yhABV6o60oMlUZfsiO7A/JD6VLwdsYVKmtuD 45DbtI72KlkmiZW+H9iiJX24K46WIJ+0gOqREcfnXEOG/ROGj0d9xAbtYZf0mESZ95fB ps9Y+bxpLkXpw4CQ+pvuw3qWNpbaPKzW9HHoBsCJJRX3e6BPcgG8QfWtO8JqvHzzVKir DP0w== 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=qO7nX/keqWMY4kFJdwer6bjckmqvkxXLwxerKkDKNvA=; b=m8COotDpyiOO7UJjrzmvogZCo6tffPXodujAodi7iUgP5rgEz3JhKSGRw4kDIRlOw4 u2a7l1rhnLMwzLjEFEIFTf1X53bGK9M3Vun2OmY3f2KzzQrvjeMvAmwwE46uIOMVk/us wTXspY/5bWXPTGW+SrUlpnVxxMD9mnj/4cWn2v2S+YTTyu6HkU9LlNgIg+MALqxj2Nnt jer1EV8Y+YYR+/uvic2mlGDCgae8ZlgLnMSuKF+hl48MaQdY/5P7n5WT3htF3L0A9+EC i4uC/FiLg6gCWYTcglOLq6RS8tYDYP0J5MFoi31dEdT5OpzJWKgv8d+b1jT0DKtyJpxF peLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NbSJgHjw; 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 x7si624861ilv.97.2021.04.16.14.53.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Apr 2021 14:53:07 -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=NbSJgHjw; 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]:45460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXWOg-0006gU-8i for patch@linaro.org; Fri, 16 Apr 2021 17:53:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXVdh-0006CX-7t for qemu-devel@nongnu.org; Fri, 16 Apr 2021 17:04:33 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:43943) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXVdV-0001k5-EA for qemu-devel@nongnu.org; Fri, 16 Apr 2021 17:04:32 -0400 Received: by mail-pj1-x1035.google.com with SMTP id x21-20020a17090a5315b029012c4a622e4aso15261616pjh.2 for ; Fri, 16 Apr 2021 14:04:13 -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=qO7nX/keqWMY4kFJdwer6bjckmqvkxXLwxerKkDKNvA=; b=NbSJgHjwQselsNtZ3gvP6mjDDx8hz9ihxjcRidOFkO4fVfARuAWzVG+hYzIMoXc1ts NYWDl8+CHob4iYLQQxr58EhxpJKqJd//BoXPki0xysXwIdGoCQ3hqXuIMM/g1pjs7ihR ky137UiGqeZUvqnNaqNIolx+IGQtLcvw1gLilNKOXyPzB/BOUEG8UhknR3wcE+xO8f6q fMR5cS6hEPCyj8bn3e30wDmQcugxn8t2HXuQtw2gAORzDRzLrIGjsiZLfXT6uAntJp49 KPOyJKK5nWl7/Em3KTC2yy5GFS4rsF6d0Z4MRAEwJ1UryVsZS8qkx5mv7o6R60LwJMf0 WPUg== 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=qO7nX/keqWMY4kFJdwer6bjckmqvkxXLwxerKkDKNvA=; b=Qk0JsCccsxAj94pSVJotHTzboYoDDH12Xkn7EeVtGSsusfPBI06VImJOPCTFxhDF+q eUECLQJe1IST2s/OATgyWsMwMFFHruNAnjDvzUNQvAKKAJvVQQgGnWnHRHugRQpI/pOt +gjsxKjPRo9zsT3S+MI7VTsGI1S4h92x5xRJBwZQX0SR/+9x3Sov2JacUlGcsX3nxcsA FrKAVYvPZmJ0sSRBFzWt1KPvRv1HRdKmq/1RpgxfafMFBzACcKCeeaGNc8FgNmKFyJFe R1tmg3J3U+1YXaz/zgIaR/Wy13cDspLjJ0KVDIg/txOTbY9m5QlQWMOvKzyT86tda0oh 9WnA== X-Gm-Message-State: AOAM5339MYW5WSqK6bM/vV8Z96X665S1WtePGcQ57Pi1mFrigq1bP1y7 Z1/79HRYGQOmzGB+iZxx5noJD66m+/VdIQ== X-Received: by 2002:a17:90a:1990:: with SMTP id 16mr4970193pji.172.1618607052898; Fri, 16 Apr 2021 14:04:12 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id m9sm5766734pgt.65.2021.04.16.14.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 14:04:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 62/81] target/arm: Implement SVE2 crypto destructive binary operations Date: Fri, 16 Apr 2021 14:02:21 -0700 Message-Id: <20210416210240.1591291-63-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::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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 | 7 +++++++ target/arm/translate-sve.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) -- 2.25.1 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 132ac5d8ec..904f5da290 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_sm4(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SM4) != 0; +} + static inline bool isar_feature_aa64_sve_i8mm(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, I8MM) != 0; diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 6ab13b2f78..fb4d32691e 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -118,6 +118,8 @@ @pd_pn_pm ........ esz:2 .. rm:4 ....... rn:4 . rd:4 &rrr_esz @rdn_rm ........ esz:2 ...... ...... rm:5 rd:5 \ &rrr_esz rn=%reg_movprfx +@rdn_rm_e0 ........ .. ...... ...... rm:5 rd:5 \ + &rrr_esz rn=%reg_movprfx esz=0 @rdn_sh_i8u ........ esz:2 ...... ...... ..... rd:5 \ &rri_esz rn=%reg_movprfx imm=%sh8_i8u @rdn_i8u ........ esz:2 ...... ... imm:8 rd:5 \ @@ -1515,3 +1517,8 @@ STNT1_zprz 1110010 .. 10 ..... 001 ... ..... ..... \ # SVE2 crypto unary operations # AESMC and AESIMC AESMC 01000101 00 10000011100 decrypt:1 00000 rd:5 + +# SVE2 crypto destructive binary operations +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 diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 4213411caa..681bbc6174 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -8083,3 +8083,41 @@ static bool trans_AESMC(DisasContext *s, arg_AESMC *a) } return true; } + +static bool do_aese(DisasContext *s, arg_rrr_esz *a, bool decrypt) +{ + if (!dc_isar_feature(aa64_sve2_aes, s)) { + return false; + } + if (sve_access_check(s)) { + gen_gvec_ool_zzz(s, gen_helper_crypto_aese, + a->rd, a->rn, a->rm, decrypt); + } + return true; +} + +static bool trans_AESE(DisasContext *s, arg_rrr_esz *a) +{ + return do_aese(s, a, false); +} + +static bool trans_AESD(DisasContext *s, arg_rrr_esz *a) +{ + return do_aese(s, a, true); +} + +static bool do_sm4(DisasContext *s, arg_rrr_esz *a, gen_helper_gvec_3 *fn) +{ + if (!dc_isar_feature(aa64_sve2_sm4, s)) { + return false; + } + if (sve_access_check(s)) { + gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, 0); + } + return true; +} + +static bool trans_SM4E(DisasContext *s, arg_rrr_esz *a) +{ + return do_sm4(s, a, gen_helper_crypto_sm4e); +}