From patchwork Tue Jul 3 05:57:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 140901 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp771598ljj; Mon, 2 Jul 2018 23:11:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfzPiONm/clUKHtZAC5ZSASyunxUmL+Hv3Fn+mloyBWnZFb0ZhjrPky4fD/uPDe0yDerr8u X-Received: by 2002:a0c:aac7:: with SMTP id g7-v6mr2858361qvb.76.1530598277178; Mon, 02 Jul 2018 23:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530598277; cv=none; d=google.com; s=arc-20160816; b=i1PInXf47UqSCZyJixTRMNzjeeEtoZRmI9dovJajPNIyNz40KEm5qml7fTpC13IEIp 61of/kXiS58RKlxd0dhkK44LNZ90sg8bcA9x61U97T3RgnSplMu5F5aKPo9925PG2sXT pTX7/655Y1ktfLsRbqpOhb4SvaB8SnQZT0dHhbYCS+hPPMc+3aiZBeMRp/M1eCJVXxkT zW7OgBUJx1xqjNG/DHAcvILgy4nuTO4vRUab2jOJmeQHMIhdpkTlAfhDOiSNvxTx60Qg CJ6O6otRigSc0CV6LJI/9n/79Qq7IwR0xTI18jBcncAdLG3NKv0GpmHGGa8yk3wD576i cY6w== 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=tN2eafpMQyW3569TOeRUi7AJHWiAeydG/drZH/F7xBg=; b=0osLGsO6klnQKqOoqD93w+5sOTCrSP00zG5c6LEeDPg+LC0dZkoIU6ZbUaOlMOPUZk q0ztdAuot9rlX9dl35PTreRRi8edrZfsnzzshvoRslNths9lcHAmxtgxinoMjmL5HEGs TpAVc5Qbdnx7pvNzEt2rcHDE/PzkH9YMMdgKLoS3Wq6i4v4UvCwqCjX1ZGVwfIQL3khu Vs7BnsBymbLaZMScK8Atb7+sZlRdL59fjRAYcDiQCx/qEv2n4l8mMM9KfpEaLSWVmWzc ws4H2KxuoKrgVmfv4Z8j93NYHjk4Y5LL8IOdf32wx/Z9zBs+C3UJ6kLJF2wvFVkjeYPs GYhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gibson.dropbear.id.au header.s=201602 header.b=D1BA6V6q; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c32-v6si362782qvc.108.2018.07.02.23.11.17 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 02 Jul 2018 23:11:17 -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=@gibson.dropbear.id.au header.s=201602 header.b=D1BA6V6q; 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" Received: from localhost ([::1]:38003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faEWy-0004aI-I2 for patch@linaro.org; Tue, 03 Jul 2018 02:11:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faEKZ-0002u7-Eu for qemu-devel@nongnu.org; Tue, 03 Jul 2018 01:58:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1faEKU-000706-Ov for qemu-devel@nongnu.org; Tue, 03 Jul 2018 01:58:27 -0400 Received: from ozlabs.org ([203.11.71.1]:34269) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1faEKU-0006x0-84; Tue, 03 Jul 2018 01:58:22 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41KYMB31vvz9sBZ; Tue, 3 Jul 2018 15:58:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1530597494; bh=9JmbGYpkXqRuPWSZNnzwgmJeArXiZC0b10euIj5kODY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D1BA6V6qXHH6pVerB8bNyZqAdVVdyF6WtVLwQArnJXip77sf6GuN7PqXX0CnX1ZEm 4OY8+apjQzCkcawfcny1DvzpdU2gFdT0eaCOutIuzt9Ng8gMKSiFcpPDNlfEAWWSm6 uf8TuvfeFZ08beVITjsK0zW1JYsB+88aihC2evzo= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 3 Jul 2018 15:57:52 +1000 Message-Id: <20180703055804.13449-24-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180703055804.13449-1-david@gibson.dropbear.id.au> References: <20180703055804.13449-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 23/35] target/ppc: Implement the rest of gen_st_atomic 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: qemu-devel@nongnu.org, Richard Henderson , mdroth@linux.vnet.ibm.com, agraf@suse.de, aik@ozlabs.ru, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The store twin case was stubbed out. For now, implement it only within a serial context, forcing parallel execution to synchronize. It would be possible to implement with a cmpxchg loop, if we care, but the loose alignment requirements (simply no crossing 32-byte boundary) might send us back to the serial context anyway. Signed-off-by: Richard Henderson Signed-off-by: David Gibson --- target/ppc/translate.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 597a37d3ec..e120f2ed0b 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -3254,7 +3254,31 @@ static void gen_st_atomic(DisasContext *ctx, TCGMemOp memop) tcg_gen_atomic_smin_fetch_tl(discard, EA, src, ctx->mem_idx, memop); break; case 24: /* Store twin */ - gen_invalid(ctx); + if (tb_cflags(ctx->base.tb) & CF_PARALLEL) { + /* Restart with exclusive lock. */ + gen_helper_exit_atomic(cpu_env); + ctx->base.is_jmp = DISAS_NORETURN; + } else { + TCGv t = tcg_temp_new(); + TCGv t2 = tcg_temp_new(); + TCGv s = tcg_temp_new(); + TCGv s2 = tcg_temp_new(); + TCGv ea_plus_s = tcg_temp_new(); + + tcg_gen_qemu_ld_tl(t, EA, ctx->mem_idx, memop); + tcg_gen_addi_tl(ea_plus_s, EA, MEMOP_GET_SIZE(memop)); + tcg_gen_qemu_ld_tl(t2, ea_plus_s, ctx->mem_idx, memop); + tcg_gen_movcond_tl(TCG_COND_EQ, s, t, t2, src, t); + tcg_gen_movcond_tl(TCG_COND_EQ, s2, t, t2, src, t2); + tcg_gen_qemu_st_tl(s, EA, ctx->mem_idx, memop); + tcg_gen_qemu_st_tl(s2, ea_plus_s, ctx->mem_idx, memop); + + tcg_temp_free(ea_plus_s); + tcg_temp_free(s2); + tcg_temp_free(s); + tcg_temp_free(t2); + tcg_temp_free(t); + } break; default: /* invoke data storage error handler */