From patchwork Thu Jun 18 04:26:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 191060 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp1082234ilo; Wed, 17 Jun 2020 22:11:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrJFwcaV31Tt884sUBO3cSPI201Xvl9/2le4NvdN76B/naNCCgMcnp4usIaUh2OvmsQnLy X-Received: by 2002:a05:6902:508:: with SMTP id x8mr3640682ybs.474.1592457089826; Wed, 17 Jun 2020 22:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592457089; cv=none; d=google.com; s=arc-20160816; b=iaWsPDEBvF/reiBHgRcVyU5xumE35gbVVEAhaRWAGjw8u1JMRG2U187NQy89b9xItT ItX07TA4yNYChlH9fEdbYNicoHUjwtl/N2+0FurW+g2rmJQw/DiLtsd4j1AtSTmDgXz7 x1I+eLlc326hekeYm08BCUdD0YVQ7m08D4bGQbz3GNl2C9ltk4bG9Qefs66bjxePsI9I f7r/ZQK3CS6Ig0Wm2sfZKZUgf5HbFc9lWwYmiwmViPFnsY98q1uKkCy/jx1YhWE/yAK/ USkVEYZxSXJQkp7T8dVmrB6+Vi4TLQrPctPohNg9cZ8PygKFXEt99qdyTDxqbNkHJ43v Fbzw== 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=/UB6J774uuR5LiuUwntUTQWEH3U6r5EYks5GcEtJxWo=; b=mVi02wWaXnM5eoAFPGAxxYR9u1cBL7PryQg4/s5c58XC0Pqp3kUPi9GyoIqcvzfI/5 WwsjAUhaY8LftjwGCJCc25FLcCikCYL5F6HU3hQzS4CLfaXnmqmcYBvLCHBSaHQVGnk2 O4RpOh0BZkKGKzn9/ZqW81F68E2SmXFQ84DsH0UJKlP786FByHsnbVvPA3MeXke454KM /reVjRBgEuRI0RYCdv3OkIDgiZT5de+l7msXKSnlfX3UET65RJuQv7rP5h9j46fYSu4p GV4UhVn1RowULrXI8A7POpvEmo+/6OVPa3zaUqweR6c9DqBwOsLqSrUSQusL/xXuPwXz oiIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ioxfextV; 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=fail (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 x11si1494192ybk.72.2020.06.17.22.11.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Jun 2020 22:11:29 -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=fail header.i=@linaro.org header.s=google header.b=ioxfextV; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlmpl-0004Y0-7M for patch@linaro.org; Thu, 18 Jun 2020 01:11:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlmES-0006E8-1F for qemu-devel@nongnu.org; Thu, 18 Jun 2020 00:32:56 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:39578) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlmEM-0003cZ-B9 for qemu-devel@nongnu.org; Thu, 18 Jun 2020 00:32:55 -0400 Received: by mail-pj1-x1031.google.com with SMTP id h95so2082089pje.4 for ; Wed, 17 Jun 2020 21:32:49 -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=/UB6J774uuR5LiuUwntUTQWEH3U6r5EYks5GcEtJxWo=; b=ioxfextVsudD19uzqAPqbaA2WiJie4QcKP2SIHGNAjZeGYOLe470i9hESfKGdcAHhF UquLz7yWJ31SDJDX+la5XnP9xZ0mV75bwpz5pdKkMKnIzJ0qy3MOPq35D+sXg8x80yGF 7n/ErUhKBYZ26glfk5j46hHhVtH8JrQOVHmSiDZNnK3raxQp7UTVhVmAQDLDXpJ4W+Rf 0HeVKtQUFsuKbFJ1auHm6Lp3kGOEX02XaxqQzkO8spPfTDqMk58KLDPKp+EVjEoctfX7 eSp7d4suSMeH35FK3PIZZYABIUgptgAXJ/I7sdLaGYQsXj46j94GCFcLqKUi+1AT5I19 FuJA== 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=/UB6J774uuR5LiuUwntUTQWEH3U6r5EYks5GcEtJxWo=; b=eigDGGmZ5lQ6c3Bb0lhuo1OC5OxK04NftPObKz9a4d4/UqjVsj+maikQBPVcMYl3e6 dbdVyVQr1ndwJv1KtZAqkIaKQCWJashVhBlr79UM+7Wwh8jqrUHMpZbk+pN+Pu4+nrRY KZViwVr/y/oOtq8wxPWzN3qyvF7jS9aGDD11YvZAnuKLsPazeWFrJTmCyxiU1FasYxUf 602bNESsrSNn7HfQxjc20mFHgqAp6uY5vnlDzcSo1cFN4oLEo3s+S2vE2R5n0zaKJu1c lyev9qs+zYKPRj5zK75pfcmmONv1EyFAUEOi/Y5abYrtVZe91KB/aETfr4WJwtm0o+P7 xihQ== X-Gm-Message-State: AOAM531fvhcRtuHCbZ1CAKyBMN8hamdvnqzP3Nax+3KuV3962H88ctqT tC5r5t+ckROce0j2Xulr4+s+WnE1Npk= X-Received: by 2002:a17:902:7288:: with SMTP id d8mr2258717pll.18.1592454768568; Wed, 17 Jun 2020 21:32:48 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id d2sm1165766pgp.56.2020.06.17.21.32.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 21:32:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 087/100] target/arm: Implement SVE2 crypto destructive binary operations Date: Wed, 17 Jun 2020 21:26:31 -0700 Message-Id: <20200618042644.1685561-88-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618042644.1685561-1-richard.henderson@linaro.org> References: <20200618042644.1685561-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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=_AUTOLEARN 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, steplong@quicinc.com 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 df0a3e201b..37fc866cf8 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3877,6 +3877,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_sve2_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 9b0d0f3a5d..2ebf65f376 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 \ @@ -1557,3 +1559,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 bc65b3e367..92140ed2fa 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -7693,3 +7693,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); +}