From patchwork Tue Aug 21 14:27:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 144738 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5396228ljj; Tue, 21 Aug 2018 08:10:48 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZbcx/I2ii3PRXUUCZ7zszY4Ti7ZLtU4gQpQn2RIKv8bENLRRcmRKEjtTwenez6YI3osVcZ X-Received: by 2002:a37:e104:: with SMTP id c4-v6mr7515435qkm.28.1534864248157; Tue, 21 Aug 2018 08:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534864248; cv=none; d=google.com; s=arc-20160816; b=pnAl1RnL0W3kQQJg3CLEGICmsAGb71YHwVV34j2l6dBqyAgxF1riDo0pQfv/dbVPZa jBWSfM5PHRAXmjBW/OWD6MTv94vI3IPZqAlANsitk7YkPWQh/3UBFFG1qSU1ux+SWruG kbUO3gmoJON23G/KfD1fh7JrVOZUO/DVDPuzyipHwgU0s4gE2h4NM+IBdmw6z6r9mznj ogZGvDf8KDSIIemStQV+5hhsn7XI49zAZMLskNKT6f6V0Cbu92TeCrsBiR4g+vuxW/QF eiX5rdu8jcLjrhnaZhpQJ+XhO/yrddMNSg45eFsWw3oLMNVmPUiadTGclRI2t/RQvj22 bSdQ== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=8bpVvCtoKFGHfaR5ufB+bPf0dNEx4FwXN2j7Wpvc93g=; b=iEmSQUSymOXZZSmNexuz0V1m/px8nLm7y0ZViatV7KNH/FuS7dzF/w52ZW6e2dPcCQ WXJ52lkNxLgL1IA8nLeZlf/eV6WIp0xuwS37Trqd4RBhd+yEBlkPR1F9wIKWZQAeSgbL vOp+axmithqtzxZDzbzPG79wAn1m8PjRA3RShK+voEliQayHKZHlyoGB6lrSthIon2rc 0vbsc2eqmYC26VsBLGO8FYshgUao8nQqSCWtEKhXO2driPdOjwbJbTsKqOMiM2dP5rec XQT2ydW90roVC/j5dxQkuCV26/Q8HWy7Tm+zXspOZKFYDtpt+phZscIFDBTrv2S3/ann NZoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=FdVfdN22; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 93-v6si2091488qkv.141.2018.08.21.08.10.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 21 Aug 2018 08:10:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=FdVfdN22; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:54240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs8Ix-0006Fh-JD for patch@linaro.org; Tue, 21 Aug 2018 11:10:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fs7cp-0003Vd-RO for qemu-devel@nongnu.org; Tue, 21 Aug 2018 10:27:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fs7co-0000eB-3H for qemu-devel@nongnu.org; Tue, 21 Aug 2018 10:27:15 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:40264) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fs7cn-0000db-SV for qemu-devel@nongnu.org; Tue, 21 Aug 2018 10:27:14 -0400 Received: by mail-pg1-x52d.google.com with SMTP id z25-v6so3842314pgu.7 for ; Tue, 21 Aug 2018 07:27: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; bh=8bpVvCtoKFGHfaR5ufB+bPf0dNEx4FwXN2j7Wpvc93g=; b=FdVfdN22aKqzYJR/NNzwOFqKI/9WEz31A5P1LRXRmnVOtGq6BmZaPX25bsMdrgKWPC Vv6kDsKVqT6LZwIUuE6sSS0qc/72F26P10H4d3p7G68X4TCbN/iPisBa3iUIPGq29zgp 7MocVfTRjZwseySM1+HxXscg8Jd1enAxkfwAc= 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; bh=8bpVvCtoKFGHfaR5ufB+bPf0dNEx4FwXN2j7Wpvc93g=; b=mvqA+r0pfvqL7QbL+eOU+d3oVvx22DoHPF0rn0qfLUPGcrRVgh9ur8HGTw4kzsMifN pMhlWR6MgD75sUdO0RFwWgpaqdmeNRgdwR7dUARDDRCHEC0LgIIOKI3vGZ7bgiU44d61 R0F5SS4cotYDdK1GDjXqOBrF6SZTeGE34Uav7XwFOUVnIw35qkVru+6kqTaewws9MPoI TiJtVmcZoyn99L/V66WweI2bcZqj9+bitM0Jh/zDrfbdNCvZ2U3GbvYRcy/bK2k7Lvx0 ozAqgHXFOrb3mg90zJng8czBJ3bBqlKDbdaCA+mfFEWvNlFmFUuGPJ/GXo+3bQyNI7L4 bLqg== X-Gm-Message-State: AOUpUlGoEftyI+6nQz0wIGLHkamcxq10VX2sOc1TTjKRQS1KnETznFZD 3GJJbksFwdv4SByLItF1QNcgh33xS/o= X-Received: by 2002:a63:ea0c:: with SMTP id c12-v6mr47685084pgi.158.1534861632271; Tue, 21 Aug 2018 07:27:12 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id p5-v6sm16576984pfn.57.2018.08.21.07.27.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Aug 2018 07:27:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 21 Aug 2018 07:27:03 -0700 Message-Id: <20180821142704.18783-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180821142704.18783-1-richard.henderson@linaro.org> References: <20180821142704.18783-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::52d Subject: [Qemu-devel] [PATCH v2 4/5] target/arm: Check HAVE_CMPXCHG128 at transate time X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, cota@braap.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/helper-a64.c | 16 ++++------------ target/arm/translate-a64.c | 38 ++++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 28 deletions(-) -- 2.17.1 Reviewed-by: Emilio G. Cota diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 6e4e1b8a19..61799d20e1 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -563,9 +563,7 @@ uint64_t HELPER(paired_cmpxchg64_le_parallel)(CPUARMState *env, uint64_t addr, int mem_idx; TCGMemOpIdx oi; - if (!HAVE_CMPXCHG128) { - cpu_loop_exit_atomic(ENV_GET_CPU(env), ra); - } + assert(HAVE_CMPXCHG128); mem_idx = cpu_mmu_index(env, false); oi = make_memop_idx(MO_LEQ | MO_ALIGN_16, mem_idx); @@ -635,9 +633,7 @@ uint64_t HELPER(paired_cmpxchg64_be_parallel)(CPUARMState *env, uint64_t addr, int mem_idx; TCGMemOpIdx oi; - if (!HAVE_CMPXCHG128) { - cpu_loop_exit_atomic(ENV_GET_CPU(env), ra); - } + assert(HAVE_CMPXCHG128); mem_idx = cpu_mmu_index(env, false); oi = make_memop_idx(MO_BEQ | MO_ALIGN_16, mem_idx); @@ -663,9 +659,7 @@ void HELPER(casp_le_parallel)(CPUARMState *env, uint32_t rs, uint64_t addr, int mem_idx; TCGMemOpIdx oi; - if (!HAVE_CMPXCHG128) { - cpu_loop_exit_atomic(ENV_GET_CPU(env), ra); - } + assert(HAVE_CMPXCHG128); mem_idx = cpu_mmu_index(env, false); oi = make_memop_idx(MO_LEQ | MO_ALIGN_16, mem_idx); @@ -686,9 +680,7 @@ void HELPER(casp_be_parallel)(CPUARMState *env, uint32_t rs, uint64_t addr, int mem_idx; TCGMemOpIdx oi; - if (!HAVE_CMPXCHG128) { - cpu_loop_exit_atomic(ENV_GET_CPU(env), ra); - } + assert(HAVE_CMPXCHG128); mem_idx = cpu_mmu_index(env, false); oi = make_memop_idx(MO_LEQ | MO_ALIGN_16, mem_idx); diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 8ca3876707..77ee8d9085 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -37,6 +37,7 @@ #include "trace-tcg.h" #include "translate-a64.h" +#include "qemu/atomic128.h" static TCGv_i64 cpu_X[32]; static TCGv_i64 cpu_pc; @@ -2082,26 +2083,27 @@ static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, get_mem_index(s), MO_64 | MO_ALIGN | s->be_data); tcg_gen_setcond_i64(TCG_COND_NE, tmp, tmp, cpu_exclusive_val); - } else if (s->be_data == MO_LE) { - if (tb_cflags(s->base.tb) & CF_PARALLEL) { + } else if (tb_cflags(s->base.tb) & CF_PARALLEL) { + if (!HAVE_CMPXCHG128) { + gen_helper_exit_atomic(cpu_env); + s->base.is_jmp = DISAS_NORETURN; + } else if (s->be_data == MO_LE) { gen_helper_paired_cmpxchg64_le_parallel(tmp, cpu_env, cpu_exclusive_addr, cpu_reg(s, rt), cpu_reg(s, rt2)); } else { - gen_helper_paired_cmpxchg64_le(tmp, cpu_env, cpu_exclusive_addr, - cpu_reg(s, rt), cpu_reg(s, rt2)); - } - } else { - if (tb_cflags(s->base.tb) & CF_PARALLEL) { gen_helper_paired_cmpxchg64_be_parallel(tmp, cpu_env, cpu_exclusive_addr, cpu_reg(s, rt), cpu_reg(s, rt2)); - } else { - gen_helper_paired_cmpxchg64_be(tmp, cpu_env, cpu_exclusive_addr, - cpu_reg(s, rt), cpu_reg(s, rt2)); } + } else if (s->be_data == MO_LE) { + gen_helper_paired_cmpxchg64_le(tmp, cpu_env, cpu_exclusive_addr, + cpu_reg(s, rt), cpu_reg(s, rt2)); + } else { + gen_helper_paired_cmpxchg64_be(tmp, cpu_env, cpu_exclusive_addr, + cpu_reg(s, rt), cpu_reg(s, rt2)); } } else { tcg_gen_atomic_cmpxchg_i64(tmp, cpu_exclusive_addr, cpu_exclusive_val, @@ -2171,14 +2173,18 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, } tcg_temp_free_i64(cmp); } else if (tb_cflags(s->base.tb) & CF_PARALLEL) { - TCGv_i32 tcg_rs = tcg_const_i32(rs); - - if (s->be_data == MO_LE) { - gen_helper_casp_le_parallel(cpu_env, tcg_rs, addr, t1, t2); + if (HAVE_CMPXCHG128) { + TCGv_i32 tcg_rs = tcg_const_i32(rs); + if (s->be_data == MO_LE) { + gen_helper_casp_le_parallel(cpu_env, tcg_rs, addr, t1, t2); + } else { + gen_helper_casp_be_parallel(cpu_env, tcg_rs, addr, t1, t2); + } + tcg_temp_free_i32(tcg_rs); } else { - gen_helper_casp_be_parallel(cpu_env, tcg_rs, addr, t1, t2); + gen_helper_exit_atomic(cpu_env); + s->base.is_jmp = DISAS_NORETURN; } - tcg_temp_free_i32(tcg_rs); } else { TCGv_i64 d1 = tcg_temp_new_i64(); TCGv_i64 d2 = tcg_temp_new_i64();