From patchwork Thu Mar 12 19:41:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 184516 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp957955ile; Thu, 12 Mar 2020 12:50:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv/IqJkPqbMOR17pd4xvlId0vY0yuE82kF4sakloqx/tseyxe1qmuPIwF76vFydRModZlP2 X-Received: by 2002:a37:9684:: with SMTP id y126mr9454361qkd.151.1584042613847; Thu, 12 Mar 2020 12:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584042613; cv=none; d=google.com; s=arc-20160816; b=t+JiB2PPjCq3GlVr+DuO4dvmz89mM9Thd1jISebaf85xOyxa+tex81jqeLS+9S67t8 bTUb+mEYGiN7n9acqkLX4aVHCtcDHeoQoGa1bZvCVTDOpRH6bV3V4AGHfs1afyquKxh6 FJ9BczkFzhKWUYRMohvPIyAWdjJyjV0Y8/10ihNvt4HYhKBPp65O+/fBWhV8RQUubI7W MeexFOy+KewCjRSJgTaVS0ZGp08lLf8L7UmIkOiwqMqFnkxsy7k176gYQ2HByPToa6Jq x9Q9XDeA+KmuaE0SvSZ/vwAa8xt9Yq/m+6GFQcBF4KizeA/GscVtyE2Gtxtk7D5CmRFj bCHw== 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=Smx0MhjIAblCuxDsW4fQawwrkcOGFEYFkfhp999nt6s=; b=c8WiIvPNRB5SrOMORbmoZ79O78pJRMpddqY8v4ggbLgxVDvLtrs6yJWhb6EBbtHK3S Tl10lAIRPKDB4Ic5gUIXJU4rjyD94NNrMxV4+emUSBcbHFG5Fvs50NgBJb6eDTvbHocT 10KAjVHrZX4G/RZXzuFucb343HtgLsb20uLRTo5NVGqnq7tOAJaszngeXGH8nH4LIGP7 VL67R2ZH1LMN1yfqvxs/jVUuLrza4DFiQ5mOY41oekfZe6FNJZgAo1qYHYEmHhOBth3Q SJ99kKx4FwP/dV6r1hjLgeCCLBUnlnXAF3ZUjehvcyJv6EtOG1eKBRqoyMHxnIuVvzCv QILA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cbH31Di9; 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 e19si3572576qkm.111.2020.03.12.12.50.13 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Mar 2020 12:50:13 -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=cbH31Di9; 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]:49370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCTqP-0001yF-86 for patch@linaro.org; Thu, 12 Mar 2020 15:50:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45422) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCTjF-0005Tv-1a for qemu-devel@nongnu.org; Thu, 12 Mar 2020 15:42:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCTj9-000250-IX for qemu-devel@nongnu.org; Thu, 12 Mar 2020 15:42:47 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:45505) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCTj9-00023a-CZ for qemu-devel@nongnu.org; Thu, 12 Mar 2020 15:42:43 -0400 Received: by mail-pf1-x443.google.com with SMTP id 2so3750614pfg.12 for ; Thu, 12 Mar 2020 12:42:43 -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=Smx0MhjIAblCuxDsW4fQawwrkcOGFEYFkfhp999nt6s=; b=cbH31Di9eWnm7xBxmIPPoPDx6u3hvM44tAQf8SBzLmev6t6MsJ6JKpAggJ1kdMIwfr 29QLsWOLKIV/GBdBFAAos/1SSoYkdRQilSvqfqKDFGXMwK9VS3y9KBtq3uMMPdZRCweJ SSRyK9dc4ZfGdnxxXSZQC5PM2CXC7+sEe9ASQOUS0crepDcrmxQvZW65dDSxQ7kaZvH6 zGNBjwLwSrE8O2nPwLsuYr1Df93Ch4zHAUKTJanlZW0WmY/47IveniyARmTirq4oVHt9 Pyz6vC5hjrOVfaDZD5vkb0STwSCM16TKFFs1xGqFQUNSEauidiYeFy6byIk5AcFOulJ/ 8SbA== 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=Smx0MhjIAblCuxDsW4fQawwrkcOGFEYFkfhp999nt6s=; b=UfZN/wO6DVkMHPonQNeHVnfCjAhxp5pXCeCkJDap2fO67V3VcsqGQw42a6XD0wgIae thGaFkdxsAGCTPfyr1OOBDW3qjxKy80JbpCvhN+m+QwVQL0ixubmEsNJkvTzQS3DhseX MNWZjBZb9LGSIpN/8hU2jbAO9zEuYlY823KvuxYy+CLg4ChVk3lZ7uaJt9m8KatRrXKB 8BzvZqhzwzVFCQ6oTNrs0aF1jpgBDMFpMobBGYGoOGJo7FrsiOAfsTniVImHLH3UweF1 Q9nLGhu3fxYHrNSDv4bRRxvDSeJAvrav9wOzDiGM59D0ji3wsaZ6iU553fSf6J6Rb5fl q7qg== X-Gm-Message-State: ANhLgQ3fPkt4d5d39rMcFuG1H971kh06LBmFbGcrgXplkRKjGtxdHg1Q w9aPunw3X1bujl4GoiA146lhy3fojCM= X-Received: by 2002:a62:be0a:: with SMTP id l10mr10243743pff.110.1584042162090; Thu, 12 Mar 2020 12:42:42 -0700 (PDT) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id g69sm6824842pje.34.2020.03.12.12.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 12:42:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 16/42] target/arm: Implement the STGP instruction Date: Thu, 12 Mar 2020 12:41:53 -0700 Message-Id: <20200312194219.24406-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312194219.24406-1-richard.henderson@linaro.org> References: <20200312194219.24406-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 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, alex.bennee@linaro.org 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.20.1 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index b99973b5b1..048140ddc0 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -2735,7 +2735,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, @@ -2760,6 +2760,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; @@ -2772,6 +2773,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); @@ -2812,7 +2821,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); @@ -2822,8 +2831,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);