From patchwork Wed Jun 3 01:12:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187422 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp75591ilo; Tue, 2 Jun 2020 18:23:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwusxwGW8FingLApDfj1GqD3zq7/0+yxydxQ9uwbXQ6rwb17Na3YTFvd+B/vZ1iN4FJ6yzy X-Received: by 2002:a25:be05:: with SMTP id h5mr13246341ybk.431.1591147432672; Tue, 02 Jun 2020 18:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591147432; cv=none; d=google.com; s=arc-20160816; b=jdIR83y3QWvWZ9uKlmD4pXirlh+Bh/w48f4nDD3Fg/IX8KWixrWGcNsHnf4XY46nr2 XgS6M2laUsoSuo0DrnxnEwhsMP/6RBM09OrM3eKJ2h4Zs8pj81zbbR2SNC0Q/Mhb7mwm Jbl4zb/dnzhSA6rw/XoUEss1my1vqS/uMXElrdfA3POFYQ7zgnGWemD1Bf4koNx+P5pv SRc73bghGu8arAN3JWcjDdXX+qkknSgSb68PnGUj07rP2XyxK3wglI+v7RXpC2PUy9d5 bXWsPbTzz9eOpkxu0k3x6WpysGkB0KAzkDwyFkqZcytHCiY/7QK8Vf7AUMMSrxERx7aq 7lDQ== 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=lQUCdDSymie/7dQ1iavooQ03Mfu1YJhrKa9eVrF8VLk=; b=VS+6F5CkCs7vgUxV0AjazCbsNTAbqaeLJPCGJdZASGIyTES7aART+rBLXiEL9jflUy 3pCs1sRVjExUi2CWn7EbK3/3iyxhh0QW57aWUpWNy5yeVqoqDCgJWdRYMU17ldqrNhpR AApvCLI/l22vkgQPD9FxfOO1XU9lUlqMaMaGbi9/53r/EOTsdWHoNWre/F3dEbQyZjCE 9MDp5BofIJPEOcbtBF4i89gVkaYJj9WHp208Un6B5SWQ2tY1ZnumqGKymXfcJ4W6bbOK BP3J2dP0g8ir5jC/LVgEpJ++/k74WVK4mG51gFGWXQMiT9sfjItPDg5ztISRThSzFMsA 29Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="U/q0uTVo"; 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 r9si351737ybb.182.2020.06.02.18.23.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jun 2020 18:23:52 -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="U/q0uTVo"; 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]:36230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgI8G-00069D-3p for patch@linaro.org; Tue, 02 Jun 2020 21:23:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgHyV-00040p-H2 for qemu-devel@nongnu.org; Tue, 02 Jun 2020 21:13:47 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:46895) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgHyP-0003Zm-CQ for qemu-devel@nongnu.org; Tue, 02 Jun 2020 21:13:47 -0400 Received: by mail-pf1-x443.google.com with SMTP id b16so395832pfi.13 for ; Tue, 02 Jun 2020 18:13:40 -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=lQUCdDSymie/7dQ1iavooQ03Mfu1YJhrKa9eVrF8VLk=; b=U/q0uTVoFwQhjnL9XwKPSwInTYw7BqC/t+ZGwi4JRUW/sPbFLP5A5TDNoSz6MTkBvb sgs0BUjzNzoB8LmB8YKm/6ZQJs/NGKZ+1R5pGrovVN+iMAKzyjFLFGDQaDlqEYiFZGj/ ib41y5livE10QOUJLkkGuFlUPOscTndPf6Povg7tGl03wj5imEdYaYEDAjwoa8/Qgs+c ywnz91TtgvzVIDXjPaILVMYrIIfqIM66v3ycbganuzBIm/m2X3X7awbcqMbLf+Ltn8Kp +6sFQz0G9xLrXbRou2x9BeEVGzd7+JK5o5und6fnd6pYbBljpg89+5FDDYmZDebydoQw iRpw== 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=lQUCdDSymie/7dQ1iavooQ03Mfu1YJhrKa9eVrF8VLk=; b=KvC7dZA5w1m+1HEk/jgqAuX6HwRz2GSFTJspohJmeDsWoAjb40Xxs9u4MY8HdcWVWC 6CqenacNKxDnYw1lcfwT1S5sPq4InzHFZGaNcLK9ZyKEBdQ6OSWSJNO/D0KNEbzO1Xqp EGYzvFdvMPHiQJtOeVeuUDdEK0Bvkbd6HFF5RfI6R/HpgSs2PR9kC8btS7IpMgtDG2p4 Ypz+JplCBmOXVM6rCl6NiazlrteGvnQa9pHmc/verMyF6GpUklsdNS77g1J1G9skd8qz vahMLdJd61Brl7NEA3Dl1+HRv4wq1cYX+iclhs+arQKxkwr91FawVdH7XaevExd3p5xl TRQg== X-Gm-Message-State: AOAM5315FxOSAl2DCmR30tKF9wt53iRvsL4ZuARW523Opl/Sm0kpYEZ1 X0kPOPBmKzwYgmI2A8tqmSQ6XP55aiY= X-Received: by 2002:a63:348:: with SMTP id 69mr25417768pgd.68.1591146819477; Tue, 02 Jun 2020 18:13:39 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id 3sm290067pfe.85.2020.06.02.18.13.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2020 18:13:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 16/42] target/arm: Implement the STGP instruction Date: Tue, 2 Jun 2020 18:12:51 -0700 Message-Id: <20200603011317.473934-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200603011317.473934-1-richard.henderson@linaro.org> References: <20200603011317.473934-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::443; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x443.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_PASS=-0.001, URIBL_BLOCKED=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: peter.maydell@linaro.org, qemu-arm@nongnu.org, steplong@quicinc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v3: Handle atomicity, require pre-cleaned address. v6: Fix constant offset shift, non-checked address, use pre-computed ata. --- target/arm/translate-a64.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 0725c2ca07..2fc070ab90 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -2681,7 +2681,7 @@ static void disas_ld_lit(DisasContext *s, uint32_t insn) * +-----+-------+---+---+-------+---+-------+-------+------+------+ * * opc: LDP/STP/LDNP/STNP 00 -> 32 bit, 10 -> 64 bit - * LDPSW 01 + * LDPSW/STGP 01 * LDP/STP/LDNP/STNP (SIMD) 00 -> 32 bit, 01 -> 64 bit, 10 -> 128 bit * V: 0 -> GPR, 1 -> Vector * idx: 00 -> signed offset with non-temporal hint, 01 -> post-index, @@ -2706,6 +2706,7 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) bool is_signed = false; bool postindex = false; bool wback = false; + bool set_tag = false; TCGv_i64 clean_addr, dirty_addr; @@ -2718,6 +2719,14 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) if (is_vector) { size = 2 + opc; + } else if (opc == 1 && !is_load) { + /* STGP */ + if (!dc_isar_feature(aa64_mte_insn_reg, s) || index == 0) { + unallocated_encoding(s); + return; + } + size = 3; + set_tag = true; } else { size = 2 + extract32(opc, 1, 1); is_signed = extract32(opc, 0, 1); @@ -2758,7 +2767,7 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) return; } - offset <<= size; + offset <<= (set_tag ? LOG2_TAG_GRANULE : size); if (rn == 31) { gen_check_sp_alignment(s); @@ -2768,8 +2777,22 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) if (!postindex) { tcg_gen_addi_i64(dirty_addr, dirty_addr, offset); } - clean_addr = clean_data_tbi(s, dirty_addr); + if (set_tag) { + if (!s->ata) { + /* + * TODO: We could rely on the stores below, at least for + * system mode, if we arrange to add MO_ALIGN_16. + */ + gen_helper_stg_stub(cpu_env, dirty_addr); + } else if (tb_cflags(s->base.tb) & CF_PARALLEL) { + gen_helper_stg_parallel(cpu_env, dirty_addr, dirty_addr); + } else { + gen_helper_stg(cpu_env, dirty_addr, dirty_addr); + } + } + + clean_addr = clean_data_tbi(s, dirty_addr); if (is_vector) { if (is_load) { do_fp_ld(s, rt, clean_addr, size);