From patchwork Tue Jun 26 16:19:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 140022 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5450277lji; Tue, 26 Jun 2018 09:27:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf6Qkifcf1m8c2v8t6APLmmpMOC666ThfhLWNKif+rhY9Mu+2GwtIT/6SxnNqLqKZf0a+dR X-Received: by 2002:aed:2846:: with SMTP id r64-v6mr2110662qtd.287.1530030469145; Tue, 26 Jun 2018 09:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530030469; cv=none; d=google.com; s=arc-20160816; b=WmZHYBh5RTU4Bm7G/KaeAMoBjTBfl0swq4GqiQRbtzPZRS7lODODE/ErzmOygHVkWk WQ2jiFLYzWJagKcxF9iMKYUW9XMkXNYBdy+t4G9ZaL/gEvkTVxujqJvh7cw3a+AjDYwq eJVYBpZiTDUVzTG8GCof7KDlWIndF/ObRDZWbNdnGJcPQLdRyO7FDW9rL2qFUBNZ+eoR wq1LVyQPuD5MATysbwsAU6S42mh/SexInRMN85SoYv2YCHhuDv5ZBOyMtKwR8YU52Owd Xv/Zt69jmAvt8BhXFIJPqPI+J1nVjoddYHJD96Z4jraYbcvM67OGNaf49XeyZdwEmo7m QR7Q== 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=eHy18mSxSfmi7Mu0ivgDQ36YgURhjOjHU9AXE2YyG6M=; b=ZqRcdqgTRfExS8AGyYIBbGuyLifz9lX/UNNspSN78g1sFVyoUODxDta0YkbqRdY67w FNzUjEL3x4RLLRbAe9CvTslInjHR039AWXjrLd8pRSe9/wm7Xr3m8XdngnqfzmUR0lzg Z9VTX/LnAWXq2aJR58xXFFuc1n7qHksZ9hvVH03Cu/oB2/Ncsx3avcCO4KoIjakJHk7D h7LeWvnLPikyqv/83Nu9VoFF8DEa7GvafMhg6cMWxKhx/zqKUlj6keTumAo+7q3xJOSh PH/CgAv7ifCZD2q8ULqlexGaE1YugTRVREXuxigLtQxDnxjMtMM3UlvXTz0geBja8PMt SLXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jFmJXqt1; 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 u6-v6si1069672qvf.157.2018.06.26.09.27.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 26 Jun 2018 09:27:49 -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=jFmJXqt1; 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]:53797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXqom-0007Jg-KR for patch@linaro.org; Tue, 26 Jun 2018 12:27:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42683) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXqh1-00016u-5K for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:19:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXqh0-00061w-3q for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:19:47 -0400 Received: from mail-pl0-x22d.google.com ([2607:f8b0:400e:c01::22d]:38635) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fXqgz-00061M-T0 for qemu-devel@nongnu.org; Tue, 26 Jun 2018 12:19:46 -0400 Received: by mail-pl0-x22d.google.com with SMTP id d10-v6so8792861plo.5 for ; Tue, 26 Jun 2018 09:19:45 -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=eHy18mSxSfmi7Mu0ivgDQ36YgURhjOjHU9AXE2YyG6M=; b=jFmJXqt1LmTa2UjUk4Q80b2OdQjfG9hDcu5zQnHZUXV7SfMT4657ABJPqkz9EYO6lW 6hwoGqc/EId1rjJYJDx6Y15DHWS/tNZ9A0c9FN/l0B/dWtw+478ZHO32FisjtPlT7/uq foB3iM0bBCfSYb7JZodb0e9GJcUvn97UZeiHk= 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=eHy18mSxSfmi7Mu0ivgDQ36YgURhjOjHU9AXE2YyG6M=; b=t/YT71hh7AIDZN8oGFn0iX4e2T9oKw5d4xDZkBoN8punyGZqgpSigNYzOBpTHY1e8K hyg87hCYp21qxe9l9HU501Fs3yuNB4GgKS5j6YmjAYoK/U+51PxJu79PWBJ5DjIQXKCn NeFsdfit0tyHjdca6Bju6nopTOS/hfyNU4vu2FclkwtlWgSeOKc4rufVFdSNubcL7vwA vRzP59sR+CODaim57+e8+Zg12Q+CUOGcSrgoFjZPhtn5WKGdnVYNII0RY4EnENF3XDdw 0rFbIMDp+JBburtDndMH1Jrtykayelco7949cdTxAFo8sYY7+1eXssjsEnJ2lQ8h72Js 5Reg== X-Gm-Message-State: APt69E0tnmhn2zzdfWIJHyngZOjvcBBpsr+66slUrxpcMGtSvL3MbDpV P0YmUMKS2qjHbRT7+DoIyp6qIxW6QOo= X-Received: by 2002:a17:902:6b86:: with SMTP id p6-v6mr2338869plk.75.1530029984775; Tue, 26 Jun 2018 09:19:44 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id 67-v6sm5054306pfm.171.2018.06.26.09.19.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Jun 2018 09:19:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 26 Jun 2018 09:19:21 -0700 Message-Id: <20180626161921.27941-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626161921.27941-1-richard.henderson@linaro.org> References: <20180626161921.27941-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::22d Subject: [Qemu-devel] [PATCH 13/13] 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-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- 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 */