From patchwork Sat Apr 6 22:32:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786493 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp764705wrw; Sat, 6 Apr 2024 15:34:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUvj4boBdmAS+QHekaE7sJpC37gVtkm4z0Tm6Z1MGSwX66ri/NyQuYsPj7s3KVF/xLLNw56p8pyimwS9luW16YI X-Google-Smtp-Source: AGHT+IGlGhAMluZh+y/+G8n8ElRXjypzl9Yzgare4D+3Gv6dCTJLcHzwXf7PrjeV9kFCXkTvYB7/ X-Received: by 2002:a05:622a:1449:b0:431:38ea:1d42 with SMTP id v9-20020a05622a144900b0043138ea1d42mr10532742qtx.30.1712442864955; Sat, 06 Apr 2024 15:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712442864; cv=none; d=google.com; s=arc-20160816; b=kPUEE3sgJEbRVb7CSrmFH939B+mANem+3uibF8MFemD8M7JbIrohNqjXWCMgzsbIzH EO8z/crJuODwKAjjtlKC3RIyJ7Gu2XfwmsU0vbJwBuYSYB0ri/jsQ7Uici88fCtvhGuU WyFzQxR9LdRQx1Wi50u9z/bG3arDYC+lSaC5/2byIaw3o0DtxYhLPmSXeVf2ZGOMYy0G 20N9ALL3PyDkeLSDPsOZdFC0I0k0znHYtuNVCkR1Z+aMpqVewZpiFYq8qJMPU/d7ocvZ Cd+0gU800hC1Z9a38J4PL5qpiftXOhd9RQOLbX/fOpWUPayVZSh5YYo07j29ou6dO544 MLzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=uK1v+EiguMoYRGbIEG8BvH+kU+PSbAC8gTglH1oJQN4=; fh=t2FDTK0wJR+mMTLWNW5gXtpfMdBooRB0/s6tIZf8wcM=; b=uvXOrlaFlvPLUZMMpee5wh59zc/2vWgLqIMoV4EZlvoZw61911YHurIltVuCQ1Dedr UAzpqBRhFeASDlqYW7Y3GXkDMxUfctTSxSYGK8yyqSOklcPDnz+K8GlceKXf7x3MHao5 2kyhVOdTsbJ1WChnT2EEWnJjdwuXrb8Az32Amcvs0mzhKLondKxgxsmyuWLiSRu+k6/J zNmYm1B90p+RjFyj5UT3llgHAVaGVIq8p0MMN6BldN36BKY+TafN2951UqlvMBPdGdCG wD4Cfaabn0eonjF60uLAQcAgLLtonpaT301nGOXigpnHP+DN/SvpQdjqct0gHtD3/sXf 0FuQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C4JMonpk; 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 o18-20020a05622a139200b00432dc51d68bsi769639qtk.429.2024.04.06.15.34.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Apr 2024 15:34:24 -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=C4JMonpk; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtEap-0003M2-HF; Sat, 06 Apr 2024 18:32:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtEan-0003LQ-1U for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:32:57 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtEal-0006fI-Ft for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:32:56 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6ed2170d89fso88444b3a.1 for ; Sat, 06 Apr 2024 15:32:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712442774; x=1713047574; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uK1v+EiguMoYRGbIEG8BvH+kU+PSbAC8gTglH1oJQN4=; b=C4JMonpkumYVHLLy8PcAPHvlDkFbTuu4KReUjuHM2x06qsvQLQReyP2pHiBICV6V/w RSx2WE+ys6JuTFmPSmtlSKkRD163f/lSRLXSlB4XiinVyc0Tmeea3VZhbeGNL8DYNty0 E+dOIQAq1Qx+w3mEa/i1MDPc//ebfMlDCKYrb7MDXmEwzpVYrJCVgozaPWHSKfocRqm0 l98y7VQeTkfsHq9s1h2UeWkho5QfRUl/wL8nrWzqo9om0YyNUuNSA6btyK2jSs2q2V28 EhTkyPcflkatkt6mElHp6rfTxj/6ql4THy3qKJ+rEHkyO6BUkPPZqyZyGvV1mqvFZ49I A1OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712442774; x=1713047574; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uK1v+EiguMoYRGbIEG8BvH+kU+PSbAC8gTglH1oJQN4=; b=KLMZu4XQkqXqWTyyIG3h6AChobt9GqVq35g/ovZNMwl4HU4FRDnz35PtWfQ4w7snGv ZCbUPTf7w6Qk+TU0c+vkSKRF6ZKbNjPDj2irYJcHPTCoqOGI0wiIgGCj7xBmqn84YY4f dfFPjKy5ouZUmyv5h3I+QpvnlDJjHzXyRKAwMyaegXQ5I58J7N5GcRUnhXVXMybc6TkQ 7h0YkG7Y2hinDfqS17CiIXvrf518jYjrsUj9xLuXASJXEHyCm7JL1pRTyfOQbGjOE+kW 0kYBO5Jz5n3OowMCk1iXyoi6lodo/x+hpPzVNuWWr5can6JMxUm6KsfJq/TZaJ603ccd k10w== X-Gm-Message-State: AOJu0Yy7uAKwb8dsO9U8QMKSc25g55Q7msu0fG1nYQkXfmNxSkDodwPY evobkhVFW75t6I+Wnh6MLTQOxjODaYaEriwZhZwsS8qPxFbbSaNKouAz+rV4RToN8UCrEofkK9O 5 X-Received: by 2002:a17:90a:f683:b0:2a4:b04b:d204 with SMTP id cl3-20020a17090af68300b002a4b04bd204mr2799489pjb.7.1712442773854; Sat, 06 Apr 2024 15:32:53 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id f23-20020a17090ace1700b002a20c0dcebbsm3643279pju.31.2024.04.06.15.32.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 15:32:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Jorgen.Hansen@wdc.com, Jonathan.Cameron@huawei.com, linux-cxl@vger.kernel.org, Pierrick Bouvier Subject: [PATCH 1/9] tcg: Add TCGContext.emit_before_op Date: Sat, 6 Apr 2024 12:32:40 -1000 Message-Id: <20240406223248.502699-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240406223248.502699-1-richard.henderson@linaro.org> References: <20240406223248.502699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Allow operations to be emitted via normal expanders into the middle of the opcode stream. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/tcg/tcg.h | 6 ++++++ tcg/tcg.c | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 451f3fec41..05a1912f8a 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -553,6 +553,12 @@ struct TCGContext { QTAILQ_HEAD(, TCGOp) ops, free_ops; QSIMPLEQ_HEAD(, TCGLabel) labels; + /* + * When clear, new ops are added to the tail of @ops. + * When set, new ops are added in front of @emit_before_op. + */ + TCGOp *emit_before_op; + /* Tells which temporary holds a given register. It does not take into account fixed registers */ TCGTemp *reg_to_temp[TCG_TARGET_NB_REGS]; diff --git a/tcg/tcg.c b/tcg/tcg.c index d6670237fb..0c0bb9d169 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1521,6 +1521,7 @@ void tcg_func_start(TCGContext *s) QTAILQ_INIT(&s->ops); QTAILQ_INIT(&s->free_ops); + s->emit_before_op = NULL; QSIMPLEQ_INIT(&s->labels); tcg_debug_assert(s->addr_type == TCG_TYPE_I32 || @@ -2332,7 +2333,11 @@ static void tcg_gen_callN(TCGHelperInfo *info, TCGTemp *ret, TCGTemp **args) op->args[pi++] = (uintptr_t)info; tcg_debug_assert(pi == total_args); - QTAILQ_INSERT_TAIL(&tcg_ctx->ops, op, link); + if (tcg_ctx->emit_before_op) { + QTAILQ_INSERT_BEFORE(tcg_ctx->emit_before_op, op, link); + } else { + QTAILQ_INSERT_TAIL(&tcg_ctx->ops, op, link); + } tcg_debug_assert(n_extend < ARRAY_SIZE(extend_free)); for (i = 0; i < n_extend; ++i) { @@ -3215,7 +3220,12 @@ static TCGOp *tcg_op_alloc(TCGOpcode opc, unsigned nargs) TCGOp *tcg_emit_op(TCGOpcode opc, unsigned nargs) { TCGOp *op = tcg_op_alloc(opc, nargs); - QTAILQ_INSERT_TAIL(&tcg_ctx->ops, op, link); + + if (tcg_ctx->emit_before_op) { + QTAILQ_INSERT_BEFORE(tcg_ctx->emit_before_op, op, link); + } else { + QTAILQ_INSERT_TAIL(&tcg_ctx->ops, op, link); + } return op; } From patchwork Sat Apr 6 22:32:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786491 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp764685wrw; Sat, 6 Apr 2024 15:34:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUWAoG1ODJYJBc/1oMplQjcCS12C1i3M3fZVPAVwb2l2EYDc4nW1BuSTnclcxLW1aAbmDyDcialmXw/S425BoFX X-Google-Smtp-Source: AGHT+IGbdDs8FBJKIJ06mXLjBMdl7l2AfWOUM23IZEdXROjvKd2KAQqGixPXAMiAnC0DDsM6XL1I X-Received: by 2002:a05:622a:528c:b0:434:72eb:99da with SMTP id dr12-20020a05622a528c00b0043472eb99damr3372405qtb.18.1712442855865; Sat, 06 Apr 2024 15:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712442855; cv=none; d=google.com; s=arc-20160816; b=CTbDHhYxxawzfFcJYC6ZcTIlci++yNFpOIct7nCUlLI1rxEhznRzp3D/7ub4oW3Bx9 iE0zbD0rD13sGYQalK6p8HKOkUWl9selAjuk7/HTLmdQy79JbST3V9ZtdmP/uN64eJ48 6NsQNXWHFfmBHHSUJBYgeww+yZZ74Z/C+29P9ikdnLfBqYWaxgbeiruwWwNEBiSnIAf/ SQe/C1IrNhdc5ny0fBR9hVElhNDDY0zMEuiQPJYYZRALAeGZtKuddqNe5JBch9spDBST tDQy34ymXeWqfIGDoeVuniBVGI3bIfHhFAMYavpEGFNaY3Tuefzwd19ELm6tJb0UDUk1 50tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=2L2/prB0ux2ctNxoqiiUKt6ospzwwfXyvGcwqxEj/VU=; fh=/EzrXVxGMvSr5VAgu4NIsk0fqauOAeCxfxr2Kf+iwls=; b=0jtFguRabNbcuxihkcICaS5bTRnsd6MfTkpMyurqsGIcgznyts+Jt5MTvsPc2Ipk0j fw5LHy1H+PipUdjMzLh0KMSSfHFJ0V9OKLZ1J15vof7bb/YF7DU5JTIKqHkfbRZKl6ao zJoLzd+FBm4ns60RMGuPd0BkFkrA5+aVYW5Sc2HGfLYxzsTK93CK2sei3JhKhJxVjxJA GveOQY6fp5CyblsT9uf13/6oVcMqonYEzAxZkfU6ejeMpGXqFO8DL6P6mj4ZglV9edUC LXAe5QNoiuNuzb/e1LoZA7Gdon5+okEPTdsD+AenGs/pdiwwV4qTZBNUGgIqiRy6ba+6 becg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="TnslF/4k"; 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 s36-20020a05622a1aa400b0043434539fefsi5209460qtc.149.2024.04.06.15.34.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Apr 2024 15:34:15 -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="TnslF/4k"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtEaq-0003M6-55; Sat, 06 Apr 2024 18:33:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtEao-0003Lo-EE for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:32:58 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtEam-0006fN-Uv for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:32:58 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2a2f6da024eso1848124a91.3 for ; Sat, 06 Apr 2024 15:32:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712442775; x=1713047575; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2L2/prB0ux2ctNxoqiiUKt6ospzwwfXyvGcwqxEj/VU=; b=TnslF/4kyHI0TtRj0726QWUwk3l01jJsj8h34GOmnf5CnnKzS2CMGc2MHA2FxhVDu6 ZqVR3TQgpCv3S0yNXlcpm5QeBQRQGYLC484TVjkZ+ONuGdjPZUJP2AiWUYX1ZcPrvaFG D63qawqB+lxsUn/cXhqjqzwMjNRid1YOgCtu8RWvFInWAMA+UR0zlurzUvpvVv6N6B7W LmDgXQxlrkzynOin5kllDW+8bKqZ/kI7nTp9/NHyIRltHzbKw5ZaJJGcw8hJips3lPne GLYtUm+jv806kak7KML9a38iyVS2kQb5Z4IKOEOyGHiKgNfpiEPQnzxnunznouuC0ojH Q6jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712442775; x=1713047575; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2L2/prB0ux2ctNxoqiiUKt6ospzwwfXyvGcwqxEj/VU=; b=DCyuKlhxaKcC/yAL5VrLbKP0Rq0150R2uMR/dIC/eNFIIISw2cSrJgRCuFmFpUtkeb Lh8Kc7RDayNf5zzv4U5bU8OOskl79fF3gAgaYXjMknPw77eZf50KLon6UoKZZcnzhfcb 0Cz9WrAVAv2y2SC86qKu0rON8LpDtD4TrVVupE109Za0V45utsty/tpLR97ANBTuP/6K IFBB32XOflK6cEhq/jwTooQHwjt5u/3dye65f2MeqwwWQUR1Bsg/Pt3htecYAXLYtBAv e8SVk6MgHwUlXs93u4+msChvKSM7hzjHFpITUs2sBajUPuixSK5cakeZR1Apr6JAlUsf 2ldA== X-Gm-Message-State: AOJu0Yy0XC8aItKtlwdcdNKp6KAd4PERYGooj4cpr8ugzh2gYE7xbo50 HGYHVFBiHtbhnhUMOHWveRc8r47MciTRHAkTEURIwI0cZZHmxw4dssTs3AriMJlYZyHMm7Gea0Y f X-Received: by 2002:a17:90a:df10:b0:2a2:9b12:da04 with SMTP id gp16-20020a17090adf1000b002a29b12da04mr3882477pjb.3.1712442775469; Sat, 06 Apr 2024 15:32:55 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id f23-20020a17090ace1700b002a20c0dcebbsm3643279pju.31.2024.04.06.15.32.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 15:32:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Jorgen.Hansen@wdc.com, Jonathan.Cameron@huawei.com, linux-cxl@vger.kernel.org Subject: [PATCH 2/9] accel/tcg: Add insn_start to DisasContextBase Date: Sat, 6 Apr 2024 12:32:41 -1000 Message-Id: <20240406223248.502699-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240406223248.502699-1-richard.henderson@linaro.org> References: <20240406223248.502699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This is currently target-specific for many; begin making it target independent. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- include/exec/translator.h | 3 +++ accel/tcg/translator.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/include/exec/translator.h b/include/exec/translator.h index 51624feb10..ceaeca8c91 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -74,6 +74,8 @@ typedef enum DisasJumpType { * @singlestep_enabled: "Hardware" single stepping enabled. * @saved_can_do_io: Known value of cpu->neg.can_do_io, or -1 for unknown. * @plugin_enabled: TCG plugin enabled in this TB. + * @insn_start: The last op emitted by the insn_start hook, + * which is expected to be INDEX_op_insn_start. * * Architecture-agnostic disassembly context. */ @@ -87,6 +89,7 @@ typedef struct DisasContextBase { bool singlestep_enabled; int8_t saved_can_do_io; bool plugin_enabled; + struct TCGOp *insn_start; void *host_addr[2]; } DisasContextBase; diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 38c34009a5..ae61c154c2 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -140,6 +140,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, db->max_insns = *max_insns; db->singlestep_enabled = cflags & CF_SINGLE_STEP; db->saved_can_do_io = -1; + db->insn_start = NULL; db->host_addr[0] = host_pc; db->host_addr[1] = NULL; @@ -157,6 +158,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, while (true) { *max_insns = ++db->num_insns; ops->insn_start(db, cpu); + db->insn_start = tcg_last_op(); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ if (plugin_enabled) { From patchwork Sat Apr 6 22:32:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786497 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp764800wrw; Sat, 6 Apr 2024 15:34:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVg/5ibSS4KzQPLv9C4Bqv2fAgBC8hfadkli3YxwI/FpidDRMDFIVcypgegOo8JIt17aJhNw284HVZeeYFO54ad X-Google-Smtp-Source: AGHT+IFI234NHyZfi6DXaUWj0aVeyW4dID86qTYsLZ8ROfbOwW7tGRrcTM3RkSqL0FzcAOsQU6UM X-Received: by 2002:ad4:5188:0:b0:691:abc:ade5 with SMTP id b8-20020ad45188000000b006910abcade5mr12184470qvp.27.1712442889745; Sat, 06 Apr 2024 15:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712442889; cv=none; d=google.com; s=arc-20160816; b=DS6JLxteGjTtEoz1eQsv7EdL78qM52fkB7i+izcAi+QCK7nJnZUm0eUsa53zLikq9V k1Q1nyRQ7/Su2IbdwJPagLxHWnbMHJTiM8Ai4yx/8jiXIRKbFiXsgm0rswwf5kK2D3Xi B6wznNSNt+186RMdcZ2nEo87nrK32W39Mt2pZnMuswbp8ExFRhjUvOPsr9MLI88nnss+ CAgUL+WdrYLqnoHvank9MFff6g8xmZhNWAUZXeKkS/SvU8c3SmNkvgZMXKnc+sIp0SQQ IXtz++PEWgClLFzuy56ci3l9XWXcx1dQIuTjYgnnnmCLRscB7tp9qQRdsHz+8h0i4xJ8 YZ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=QQc6e5RogWeg+/QqEB/0KfIIQRJeLZXWsX6Xz7y/RG8=; fh=/EzrXVxGMvSr5VAgu4NIsk0fqauOAeCxfxr2Kf+iwls=; b=jBh52NxEaO161pXJH7VVjFwpNWKPCady7jHKq8Qa7XhEF+D/9GJkgKzC2UQXlnNBIy 7xCdwTAEhAerxIlR2hly0XpmvBWRVsTxsqgziZHz5ffZpWay4X4UyxP4mkByjQ/1OBTN JfetLbjYfFW3HQlNtBlbqZIXrasDRIuKr1W9Seie2YjkSXZrofzCx5imr+OZqkmFsLCE K1SRNqL/lpF5aPpwIyeVbC0ijFmRXwhko2mk7TTdlJn9Q4NsMQ68T8e5oPklkM+Pbb0W bJxUEwbQ/GCv1x4mFyYfYJ0LJtTBCnR0Ry4mVwznHogAEfZ1y1pMqakh8XTee+Ojmb+3 0Haw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=okzOtzWW; 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 n6-20020a0cdc86000000b006991179d6f6si5268936qvk.46.2024.04.06.15.34.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Apr 2024 15:34:49 -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=okzOtzWW; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtEas-0003N8-Gy; Sat, 06 Apr 2024 18:33:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtEap-0003M4-Uz for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:00 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtEao-0006ft-Ct for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:32:59 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2a2d0ca3c92so2115561a91.0 for ; Sat, 06 Apr 2024 15:32:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712442777; x=1713047577; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QQc6e5RogWeg+/QqEB/0KfIIQRJeLZXWsX6Xz7y/RG8=; b=okzOtzWWY9TyyLE+vDIzRbNyMb8tVFFm66dF6voACRkpHacdT0aELlWF9Urxn7mAZt D4Eq5qjp44bwle4NK/ddgVWssrsDv9U+Uuco+mHBVr93tOgM8PJxAFCKQfzGUeLXkA3X uY7RK6q3bJlhszJiLHTVk34YWOHaRBzLjlDjvz5LQugqLtaVjBX00uVVgS+eLdzrYQ5s 909+w2CzFMs+WZpOsLWoeTX2jkk+OPmpb7v5I+MSs0F8wPi6ttv37RTDXR82InHP1AxC 00PemL7qrLBBTmu/1RettFoEiGFF2MOGmNG6bdAq1gNUKsLfEQa8kfxQIdNOYOibBm1B WGyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712442777; x=1713047577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QQc6e5RogWeg+/QqEB/0KfIIQRJeLZXWsX6Xz7y/RG8=; b=CYWF+ZVVgyoLzeZ3v9xDImLCndAgVqE5703sOpQT3NnXNH4RXtleQatf+EXE0wYJhu 5aLqk2GGsE6TSpFiGhth5tdly36P3W3eExsEWlJzv4VrMggzARMyK06njgwXoO7B75bd kKMtOwjC768DYxS/E1ryvqM1klKehd638zxoJxXBm3j+UfKCH8Qw8TJuqOZ5vacW14ue 0w3AL04jFNrkPPLlU7S/9mSx9wg/EJsPfhGYLTGF/5AYLIYk7UQAZ/fc8JlccXPmpPBg SZWE4nwyfv+oRowiG/j/hMyXK26aXyMT7EB82YOTSRDC04FmrNkUkVXFOI5pBi3m1Q7q fhXQ== X-Gm-Message-State: AOJu0YxIhyrgED4kmgiy09/VNlu2zQm6bgIXNeAM80wC3qmtnY/rJ5tN u8BBIRqrQuEY+L39zf6v8ZU8Gl/99XNRQlQ/uB8TsrRbw05c0+yQOPiru2T9ijpKt7sreLC4jFd / X-Received: by 2002:a17:90a:7c43:b0:2a2:f249:6180 with SMTP id e3-20020a17090a7c4300b002a2f2496180mr8207410pjl.18.1712442777063; Sat, 06 Apr 2024 15:32:57 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id f23-20020a17090ace1700b002a20c0dcebbsm3643279pju.31.2024.04.06.15.32.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 15:32:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Jorgen.Hansen@wdc.com, Jonathan.Cameron@huawei.com, linux-cxl@vger.kernel.org Subject: [PATCH 3/9] target/arm: Use insn_start from DisasContextBase Date: Sat, 6 Apr 2024 12:32:42 -1000 Message-Id: <20240406223248.502699-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240406223248.502699-1-richard.henderson@linaro.org> References: <20240406223248.502699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org To keep the multiple update check, replace insn_start with insn_start_updated. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/arm/tcg/translate.h | 12 ++++++------ target/arm/tcg/translate-a64.c | 2 +- target/arm/tcg/translate.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 93be745cf3..dc66ff2190 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -165,10 +165,10 @@ typedef struct DisasContext { uint8_t gm_blocksize; /* True if this page is guarded. */ bool guarded_page; + /* True if the current insn_start has been updated. */ + bool insn_start_updated; /* Bottom two bits of XScale c15_cpar coprocessor access control reg */ int c15_cpar; - /* TCG op of the current insn_start. */ - TCGOp *insn_start; /* Offset from VNCR_EL2 when FEAT_NV2 redirects this reg to memory */ uint32_t nv2_redirect_offset; } DisasContext; @@ -276,10 +276,10 @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn) syn &= ARM_INSN_START_WORD2_MASK; syn >>= ARM_INSN_START_WORD2_SHIFT; - /* We check and clear insn_start_idx to catch multiple updates. */ - assert(s->insn_start != NULL); - tcg_set_insn_start_param(s->insn_start, 2, syn); - s->insn_start = NULL; + /* Check for multiple updates. */ + assert(!s->insn_start_updated); + s->insn_start_updated = true; + tcg_set_insn_start_param(s->base.insn_start, 2, syn); } static inline int curr_insn_len(DisasContext *s) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 340265beb0..2666d52711 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -14179,7 +14179,7 @@ static void aarch64_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) pc_arg &= ~TARGET_PAGE_MASK; } tcg_gen_insn_start(pc_arg, 0, 0); - dc->insn_start = tcg_last_op(); + dc->insn_start_updated = false; } static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index 69585e6003..dc49a8d806 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -9273,7 +9273,7 @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) condexec_bits = (dc->condexec_cond << 4) | (dc->condexec_mask >> 1); } tcg_gen_insn_start(pc_arg, condexec_bits, 0); - dc->insn_start = tcg_last_op(); + dc->insn_start_updated = false; } static bool arm_check_kernelpage(DisasContext *dc) From patchwork Sat Apr 6 22:32:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786490 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp764632wrw; Sat, 6 Apr 2024 15:33:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU9wMYTgwSg4Ru5fgPNVcgGq3Bs+rGqH5u421XIT+IM3a2B04YI3zbiVzxMkkxknkG34e4XC11B8fDAQ9N1yszC X-Google-Smtp-Source: AGHT+IHZH2p/pQirc1d9YF1njhTB31uNNEhKnuHYMHr9DeSqbT4JG3eC7PR3pLU3hlHRngc1Tgcf X-Received: by 2002:a05:6214:248c:b0:699:22b3:dfd5 with SMTP id gi12-20020a056214248c00b0069922b3dfd5mr5926169qvb.43.1712442836246; Sat, 06 Apr 2024 15:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712442836; cv=none; d=google.com; s=arc-20160816; b=HVnrFvgEmwhOxO6KxCOUvs0rxRe35JOnF3sqZ0uhnjo2yHon4zxfQCqOJG0ql9Q2Uf lVwWKUR8xupfI8KU6xFA+s9AWqg72wQqwWKlD7AvqDO7GQpfWq3sfYUOqRlzNphkv62i LnLOK/KttRir/NJ3ulmRMNk3/LuqnM894jf+IYye+UlJUyFfbvEbEdMZn0lhet2O79Cu 3BoB71VyGD1jRHIbGjYbpR8e430vDhL8vuZWvGXC5vRGfypIHnPn42HdNhDmjuswcYAw RHsczzOvXBTe9Lfvqf2Ml+0N8w3eKN03pjRC/8kgR4WNMekjo4uTXlpixjBFDk9C8BDj lZKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=+n5c7Yxg8Vn5seTMJXxw9ptGbTW4ezPBKl3xezctxZM=; fh=/EzrXVxGMvSr5VAgu4NIsk0fqauOAeCxfxr2Kf+iwls=; b=APqUdluGO6tOODIuDDjjFvuIyhH10J8jJQrl0PeriIizGR32cAttx1R/UP0xGtQteo B9oQWNPfaAnlfv6Og0QrU4KPaiRq5q1zdNXLC7fk0/D6+YpW47tLRHJIpXw99YAXhf1t L4Whf70k4/YPvAAQFvKcfET7NG2IGf+xC7JaAoD19eHhKtnGJhI/wen/t3FRCYyyfsdB HHBiTmeD42mD5eExl9F6IHeWBYBjQct3fY5PKZoAUV6UIFlyFh/qxFu/7jA43MREdg/d ew/Z3iSd2uGGm9hASHJ0MDgOZWv6Jx6Crug7orpl0QiDcQrHpjCcvcyK+c9X1gnygQwG gaPg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="s/cUR2Ye"; 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 m2-20020a0ce8c2000000b00699271e7e56si5161212qvo.474.2024.04.06.15.33.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Apr 2024 15:33:56 -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="s/cUR2Ye"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtEas-0003N9-Gv; Sat, 06 Apr 2024 18:33:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtEar-0003Mk-Ld for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:01 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtEaq-0006gY-1o for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:01 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1e2178b2cf2so30600875ad.0 for ; Sat, 06 Apr 2024 15:32:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712442778; x=1713047578; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+n5c7Yxg8Vn5seTMJXxw9ptGbTW4ezPBKl3xezctxZM=; b=s/cUR2YeZate0zQhDZYSpxe9C8JimrO0ZJzCgJysH3RG2Dc2fv8TeTwzkVa4fwQsXL S+kYg3LSA7onYadCxEOiJOITKVU6Y5k/XwQ676F8eVSLezR+gHTUJ0/0zjxxKmUpLOd1 AKTlwW7VbNNuWl23l4XSQkdEYKqT7AJTO5J+OcPOD40QBrEcJnEkBpXGv5QedyX+pxOK yk+FOY1KYrRYiwfNhlifrsVVSBBQb90HjljF61hCJ5Wv22kNCsJ08j8j0awTdlCTLDjQ 7vBDTt/rl0QOLzzQfKmSQ2NEH37855mzsGW+oQgZroWTQetc2++h1XcOvje1Fcxsg9UE JD2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712442778; x=1713047578; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+n5c7Yxg8Vn5seTMJXxw9ptGbTW4ezPBKl3xezctxZM=; b=sgZJTabVoE1aZ9UiSpimaUB5COrl1hQpYIoEeckSSW5sDOya265lG3bjlV3bPhYGWH G8C/SICVIyITGE22+dt0abDP0zuUfquEj7zealcB9G0QvidKKhP4cnTNk+PA9XqG8Rog dYix10DzHjNzYjS2Pdp3bnDcLzNzkD7mXkm5wxvWot7LfGu5EAbaiPaWoawOClIi+yPq 9fPoVFB6EiiEEhOkhhf3wuno8c5MHorev9FY+gFjSgH+kiWouPEY3/Am59ASvoKnN77s X3jwnS1orutujUjd4lX0arcy49bCkCnu92JjxVRAvEL5Bj9kGVVLHXrVmFjmDQiJbfml AEPA== X-Gm-Message-State: AOJu0YyTbzB6vw6g//BZNcDG5omf87zUIpr1hq9IRvUDox/Nz5/LB49b laVoCWdHBeYsXTSDlFFd6pC1l2AEFXzUmFQMKUQcOtjhpYtS9BbQLXF8qbgt9CG6gKEYjNhZZT/ 7 X-Received: by 2002:a17:902:efce:b0:1e0:983c:d686 with SMTP id ja14-20020a170902efce00b001e0983cd686mr4702554plb.20.1712442778661; Sat, 06 Apr 2024 15:32:58 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id f23-20020a17090ace1700b002a20c0dcebbsm3643279pju.31.2024.04.06.15.32.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 15:32:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Jorgen.Hansen@wdc.com, Jonathan.Cameron@huawei.com, linux-cxl@vger.kernel.org Subject: [PATCH 4/9] target/hppa: Use insn_start from DisasContextBase Date: Sat, 6 Apr 2024 12:32:43 -1000 Message-Id: <20240406223248.502699-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240406223248.502699-1-richard.henderson@linaro.org> References: <20240406223248.502699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org To keep the multiple update check, replace insn_start with insn_start_updated. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/hppa/translate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 8a1a8bc3aa..42fa480950 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -44,7 +44,6 @@ typedef struct DisasCond { typedef struct DisasContext { DisasContextBase base; CPUState *cs; - TCGOp *insn_start; uint64_t iaoq_f; uint64_t iaoq_b; @@ -62,6 +61,7 @@ typedef struct DisasContext { int privilege; bool psw_n_nonzero; bool is_pa20; + bool insn_start_updated; #ifdef CONFIG_USER_ONLY MemOp unalign; @@ -300,9 +300,9 @@ void hppa_translate_init(void) static void set_insn_breg(DisasContext *ctx, int breg) { - assert(ctx->insn_start != NULL); - tcg_set_insn_start_param(ctx->insn_start, 2, breg); - ctx->insn_start = NULL; + assert(!ctx->insn_start_updated); + ctx->insn_start_updated = true; + tcg_set_insn_start_param(ctx->base.insn_start, 2, breg); } static DisasCond cond_make_f(void) @@ -4694,7 +4694,7 @@ static void hppa_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) DisasContext *ctx = container_of(dcbase, DisasContext, base); tcg_gen_insn_start(ctx->iaoq_f, ctx->iaoq_b, 0); - ctx->insn_start = tcg_last_op(); + ctx->insn_start_updated = false; } static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) From patchwork Sat Apr 6 22:32:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786496 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp764765wrw; Sat, 6 Apr 2024 15:34:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXie8HgInpzfX67dk/48uRec+ReggnUp4wrWKKOz/4WDk/gthXFURbv6xM8e2v4iHsk+mH8k554X0wyie6S9MnZ X-Google-Smtp-Source: AGHT+IHD6RsHf4kFGzspK10+z0k0LtyiKFBGM3s5OOrM61bbBib8ySZ0vUVeHVw+y6ah+9hPW3Nr X-Received: by 2002:a05:620a:12ed:b0:78d:3a4e:7b1d with SMTP id f13-20020a05620a12ed00b0078d3a4e7b1dmr4918466qkl.40.1712442882589; Sat, 06 Apr 2024 15:34:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712442882; cv=none; d=google.com; s=arc-20160816; b=odEE+cQcGIpNJo8nlkd5kmuKDW5wlT81XmzQgj6K9M7gQS321SlFzAb2YJTlmfBUUV zk6Eg6TWrGAe0mI+NFQUDNYM4GXyM9Ks0Nu6lw/SjftO7oWWebU3xAl949S8kOBGy6lR FvcD4Jysj/Alo0rkhEtNNMOXxeW7NlGFaB5GvjvxlXZzeisRRckItbziecvOD6Zyr2XL nG2+O/VTQuijlokoRlCmPfPKkWXu0IDbz4ftuHYN8X6N8sh07xtDt89nAdITTtZIBN9X GstyaPEOQx1/6hQUhJ2cdgtM+U2LBPMLL3ZTvjh74UWzS3tuTCQe4dSQagjo41cvP803 KwUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=huPDBBhYc/g4B/wyxsCiRcrglSPPFxdW6/Rpm03HcSo=; fh=/EzrXVxGMvSr5VAgu4NIsk0fqauOAeCxfxr2Kf+iwls=; b=tfVCc0809lOql90ZSmlEYIyGyyDkgKdLacBsiF1R7Vc+4zqcJ9EOWGSZWii65fO63u XnYPf3oLzgBBzNwMYCr3fNbeRtAWa2XSLN2jGszChEJ4d5uw6qshM8B6PaJj91xgXTvV SDlfK2xoSttcVik2gw8/aBj9rivpXn/HnhMoIsAaYRuPl4zDMf+IG4M+Hj4pBw3tmnwn 2feTNh7z238244DcpGmjXndi9YAUprzpKYgK+seNdjZos+tqYNtImiEgEahYBQ9dDVUV 6gYbnix79Aj/+n6j701v435EZRRe78yJRAQ8IrPotNmmkOgBPZu2a8y3SptbUfxRpfnk zPgA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kONFEQ4y; 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 z25-20020a05620a261900b00789eb878549si5471172qko.777.2024.04.06.15.34.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Apr 2024 15:34:42 -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=kONFEQ4y; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtEav-0003Ns-5M; Sat, 06 Apr 2024 18:33:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtEat-0003NQ-Cm for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:03 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtEar-0006hI-Qi for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:03 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5d3907ff128so2806936a12.3 for ; Sat, 06 Apr 2024 15:33:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712442780; x=1713047580; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=huPDBBhYc/g4B/wyxsCiRcrglSPPFxdW6/Rpm03HcSo=; b=kONFEQ4y5iwAb3rt2Q6Wlc18pqdSqTPWD/QcIz6ichYzohOijEdcwPfOoOWqSqSQMl RlsW6H5yST21p9U8/+6+JMqJEbQMx4ZLUXqGDNlElpqym1ic4OFGBn8tjPk7VVlPouL1 AOdcT0yynzL2x3EKH8IfibXSPkeRKbhUuVneCkn+bOXro9zDHnDjq8SotaCgKIPjmCQH LDk/dBbl0HSqN1Zi86qRKXVptsRLRMLROenqrgdhrOH1+/Hca78nwIJfC4v5X8Xse2Wn GQpbYHHzYuWngzv1NaoyysbLHgl8UYPLJyRw2fqKZGKbi2gq276fo6SuOeRrD6YZTrOp 9LrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712442780; x=1713047580; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=huPDBBhYc/g4B/wyxsCiRcrglSPPFxdW6/Rpm03HcSo=; b=a0uP4XkJtG7kYbK9cutxDLtN9cl37FOqCb9lZAakZUH3ms2BpsnS4Jo87W2Svkud6M MDzqp8l9RjQ+BPzle4QlABGPxkYQdaN43rIIFmH81DDpInoFF+h8vvSSQHgfv5NmxDi+ l2UdQjum6r/BcqQc+vNePI8g1twl7wiJfYQW+zHu/8076KIs0NTf18Iy5SfA22YGlRtD JQo8tA32FZ/hplsF0EvcmB+EJKQ6uNp60H5ZPQVnQ4MpL+YJHY3ttsYrNqgtlAd8rl+y mCknvlGD+jTom+nEScn+UN9UUFEhW7jMKeCPfCri4ww2Z6DX2tgCSso7WTerJQ2PQUEf FPHA== X-Gm-Message-State: AOJu0YxQmlCDeY0BG0rVcCZ85OxFemj0y7Ns5XjhjP/zk3fAQyt3Yq0W z8OPLnr8KIkvqGECVL7+uWjCNJCp8OjEHZECqZjZjS63KtOWkwzgWpp+3+l09sqsbB8NMP+OGYa L X-Received: by 2002:a05:6a20:5518:b0:1a7:5b43:326d with SMTP id ko24-20020a056a20551800b001a75b43326dmr426867pzb.22.1712442780564; Sat, 06 Apr 2024 15:33:00 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id f23-20020a17090ace1700b002a20c0dcebbsm3643279pju.31.2024.04.06.15.32.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 15:33:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Jorgen.Hansen@wdc.com, Jonathan.Cameron@huawei.com, linux-cxl@vger.kernel.org Subject: [PATCH 5/9] target/i386: Preserve DisasContextBase.insn_start across rewind Date: Sat, 6 Apr 2024 12:32:44 -1000 Message-Id: <20240406223248.502699-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240406223248.502699-1-richard.henderson@linaro.org> References: <20240406223248.502699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org When aborting translation of the current insn, restore the previous value of insn_start. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Tested-by: Jørgen Hansen --- target/i386/tcg/translate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 07f642dc9e..76a42c679c 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -139,6 +139,7 @@ typedef struct DisasContext { TCGv_i64 tmp1_i64; sigjmp_buf jmpbuf; + TCGOp *prev_insn_start; TCGOp *prev_insn_end; } DisasContext; @@ -3123,6 +3124,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) /* END TODO */ s->base.num_insns--; tcg_remove_ops_after(s->prev_insn_end); + s->base.insn_start = s->prev_insn_start; s->base.is_jmp = DISAS_TOO_MANY; return false; default: @@ -6995,6 +6997,7 @@ static void i386_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) DisasContext *dc = container_of(dcbase, DisasContext, base); target_ulong pc_arg = dc->base.pc_next; + dc->prev_insn_start = dc->base.insn_start; dc->prev_insn_end = tcg_last_op(); if (tb_cflags(dcbase->tb) & CF_PCREL) { pc_arg &= ~TARGET_PAGE_MASK; From patchwork Sat Apr 6 22:32:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786492 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp764693wrw; Sat, 6 Apr 2024 15:34:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUGFkOAfmpH6Z6WibP1xtY4oBTB5/PCSano26KKj6LWuVw8E852W/FPfViqsOqRiVwGDPS3dtUQuoWq516Jw0du X-Google-Smtp-Source: AGHT+IGj4D10nbp094/ohuRIbQZTsx2Je4BeShtuvpTKz7g6I2+3t83gj6Noe96tlaIXt6AzJaRR X-Received: by 2002:a05:6830:1e8b:b0:6e8:a92f:74f8 with SMTP id n11-20020a0568301e8b00b006e8a92f74f8mr5454607otr.18.1712442857483; Sat, 06 Apr 2024 15:34:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712442857; cv=none; d=google.com; s=arc-20160816; b=rV4XDD7hq8HmWAtcIazVh2oXGjHMpKhTsCjiJv4BMmS1swjq9yUwlLRhexHBRSk5m1 jvBCeQIkDupiGjxNo1XDc9ge+w+i+58csVvUlzAF33P7HAsQ8fZMpLdyL+nq3U6SK1aU U0K8nq0o9dOKVXA66cPjsKVfUzGX4zwLfw6d+TzfixUqTbJDm2yIcXMA0DfFnJLIeAZN Bx2M3ub4CFD+LtzL2fPX9x0fiRTq7VR7w7cWc//rTxhtGCgGfkLQ/4yoxAyXMz+1+tYO x5XXw15mFQ2ObE6v+ttG552kOpO9JcLXWbS+rnqQApydy2uW9I3+G86M9W/M/5phHtCs tUcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=XUzNX9wVB6qbDLCwM/K8CjqXVmj1FUosoEHWX0Cy0rY=; fh=/EzrXVxGMvSr5VAgu4NIsk0fqauOAeCxfxr2Kf+iwls=; b=L2TcBCP5QNKdEw74FULqtf0/ye+vVwZknP23KbN2BYhYI7Cy2QBeL7zXleonzFNmFL GetTcPsaBXOrwmIHht8T9myfm4cJfXAWySpGN4jp48DLh7iHzKgXDVoYBA/tlwb6pnJw 3LTTwh3zmYHDsDtQKB9nLF+pb1xYnFG+To1bhWseEbHG5/DWQGXiXisej6deTusxfMUz RE82uJjPx9NQddhmxwIpdMMCC2rL4Ul3BbBDwpeVw/KbWoHTWgD4SeE/RLIb6UqP4shL rlFV7PI+T/07C+wbHQ+k8EprSI7DJl6bU1O7fHUlh/xuOD1hTQ0tCXk9h09WVk/YWDnO C8OQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NCF8Bx48; 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 ep2-20020a05621418e200b0069922e9d38bsi5099037qvb.383.2024.04.06.15.34.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Apr 2024 15:34:17 -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=NCF8Bx48; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtEaw-0003O6-4D; Sat, 06 Apr 2024 18:33:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtEau-0003Ni-TA for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:04 -0400 Received: from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtEat-0006if-EA for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:04 -0400 Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-5aa27dba8a1so175023eaf.0 for ; Sat, 06 Apr 2024 15:33:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712442782; x=1713047582; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XUzNX9wVB6qbDLCwM/K8CjqXVmj1FUosoEHWX0Cy0rY=; b=NCF8Bx48+UG3ilgO8Mg6b7O/agyUyY+qQhQCL06Kay8OXyz4An29hzmk5ATbFgk0xp acO/um8hCDMJyvqWsX1ArTVHXqDC7gKOYD4Hj7m26+f4J1yGn+NaV4Gn8Dzq+4lXkhKo CFyQKaiPZnhAmZQOwbgyGkgpr9u6ZVmQF+DDtYL97Ectlbs6WQKDckICWIqseFauaMi5 MzfDnGL0npXXyFJsk7kqDaXAGyARX/he2rH3/rnjD3FR+/7ktK442Yy5e5W/dsgPj5uK WxYU8UUPtVVm2ttcMZAGIPEWfHiE0hwQ0VfgWKA6Xm7D5Tkx7j9V2X75EHjnzO6FHc3u yJpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712442782; x=1713047582; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XUzNX9wVB6qbDLCwM/K8CjqXVmj1FUosoEHWX0Cy0rY=; b=EEnSNA5PKQqjc4WunT6zJqa5W/IhvaXkqZxvJ9E4bs2+JI8U/itsJ+srt49Amya/Yc 1lRakESqSFWRowFuiOxlzyvfPjuyYFGpXopvh0+AR5BrxM0P8sFekN+tlhWBrAi7hqcb uW3OPLYfj1CUaiCgCs3BtF3OOh+GdpEimaSc8K3ctu74IPx3e1Z7EodwAl2yyJS2tsyK uo0j0ObRe07FUOYXTd5Sfk7b1ZrGYpmooj0vM3aO5hvojNfSMTFplen2nFPzz2KhdG8W Tu8EIL6TNr2Pv92JYxaGbshU5trz96LEEb5GVgc2zDbj4UCc6uObJCHo7xSOWtK6gVyU 84MA== X-Gm-Message-State: AOJu0YyQjbDkRiupwNDQt3WyEKe8yCJdhdYE+o4bqBfoaWeikLSsdrr9 rDo/8+p0DxlqwVMEfPPgxfbhHGPzp5PlkiXWY7QKN0n1WB/033ABcVtJAOTlsLHyxnWCXmmdeCJ R X-Received: by 2002:a05:6358:7a8e:b0:17c:263a:5b8e with SMTP id f14-20020a0563587a8e00b0017c263a5b8emr6804018rwg.14.1712442782138; Sat, 06 Apr 2024 15:33:02 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id f23-20020a17090ace1700b002a20c0dcebbsm3643279pju.31.2024.04.06.15.33.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 15:33:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Jorgen.Hansen@wdc.com, Jonathan.Cameron@huawei.com, linux-cxl@vger.kernel.org Subject: [PATCH 6/9] target/microblaze: Use insn_start from DisasContextBase Date: Sat, 6 Apr 2024 12:32:45 -1000 Message-Id: <20240406223248.502699-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240406223248.502699-1-richard.henderson@linaro.org> References: <20240406223248.502699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c33; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc33.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/microblaze/translate.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 4e52ef32db..fc451befae 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -62,9 +62,6 @@ typedef struct DisasContext { DisasContextBase base; const MicroBlazeCPUConfig *cfg; - /* TCG op of the current insn_start. */ - TCGOp *insn_start; - TCGv_i32 r0; bool r0_set; @@ -699,14 +696,14 @@ static TCGv compute_ldst_addr_ea(DisasContext *dc, int ra, int rb) static void record_unaligned_ess(DisasContext *dc, int rd, MemOp size, bool store) { - uint32_t iflags = tcg_get_insn_start_param(dc->insn_start, 1); + uint32_t iflags = tcg_get_insn_start_param(dc->base.insn_start, 1); iflags |= ESR_ESS_FLAG; iflags |= rd << 5; iflags |= store * ESR_S; iflags |= (size == MO_32) * ESR_W; - tcg_set_insn_start_param(dc->insn_start, 1, iflags); + tcg_set_insn_start_param(dc->base.insn_start, 1, iflags); } #endif @@ -1624,7 +1621,6 @@ static void mb_tr_insn_start(DisasContextBase *dcb, CPUState *cs) DisasContext *dc = container_of(dcb, DisasContext, base); tcg_gen_insn_start(dc->base.pc_next, dc->tb_flags & ~MSR_TB_MASK); - dc->insn_start = tcg_last_op(); } static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs) From patchwork Sat Apr 6 22:32:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786488 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp764630wrw; Sat, 6 Apr 2024 15:33:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXUSpF+1u0qFGMombejjgbTKLqhXEtz4kJF/TTloWUdIHbzIS+il2VoyXTSbLMteUnMgqZNLQhMvlIV/FoEpY59 X-Google-Smtp-Source: AGHT+IEJagamKVVaT6ybzLdh0aKTX6Y4M11yjr4gpUJaz/Tbn9LKUKYebbeLmXZM6mKaktDW7rcT X-Received: by 2002:a05:6214:20a6:b0:699:3304:30e4 with SMTP id 6-20020a05621420a600b00699330430e4mr6282104qvd.31.1712442835907; Sat, 06 Apr 2024 15:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712442835; cv=none; d=google.com; s=arc-20160816; b=azkONl2Fgwv2j4qqXNOcgK0FcdoT7ue3FVeUKkP5D9Jqm4/nGt9vWi6NqsAwkxrobz xhxb8wQsw3Vebb3/CkoAmZfJ6X89uN0bi6VCccVQJcRnChCgQiQ2xC7a2cwdSk05CalC x2xE4gA66qX02VjPPbzqA3rmp4f7bzV1/D9o54ntHlIFh4l1wpecEaQAZkTFJkw5EnM3 jn7/HsfuHtWfcXxslzrnUYwJxuuMDKVsvSsYEpkbYLRQpxMhp29NKLR0ptNbY6EMEkkk Vxdu19BnHHLjLce918+9AlpeiYopO5zSM/c8FuXlDlRG9Pc1C18ZlT3nTs/CQ3zjY8RL uYNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=5EK613jOMt0q5YKINPHaRaY+PjrWQT7TxkM34vbcqwA=; fh=/EzrXVxGMvSr5VAgu4NIsk0fqauOAeCxfxr2Kf+iwls=; b=0LjcPw6AcUERHCKiB+Spa0T3I6r56+wY/Ng0dnBd/bLPcG2Pg3rTziRpIhvRrFXOCp aDRCzUgXpz0QOKoUhIsDkGNr1ro6FHdzfxchLCAQ89MejDHV2vc//VHuz/4Vv9aFZqKh QcVSLwGbqiHAAh1bQ6QJKKp/rVXbFmUwDv/DwGXJa9a+KF3FB5hfEv6m4ObkeVUyCUWY aoB9CH5xQEAeTcGbqpNrwW1Hkm03TikiNHlI2tL9jpBQGdSdyIGEcDzCvkaHgwrYe4x/ EEEW45EeqK2Ht4zdPcqdRqT0LLdguecfUc5qTBDd8iEyTWjzuu5N1D1BcPm5FJBgPpSw tMIw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a6iP+T6r; 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 ef10-20020a0562140a6a00b00696955631adsi4773705qvb.167.2024.04.06.15.33.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Apr 2024 15:33:55 -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=a6iP+T6r; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtEay-0003Oy-TB; Sat, 06 Apr 2024 18:33:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtEaw-0003OL-HQ for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:06 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtEav-0006jw-3P for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:06 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so2769479a12.1 for ; Sat, 06 Apr 2024 15:33:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712442783; x=1713047583; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5EK613jOMt0q5YKINPHaRaY+PjrWQT7TxkM34vbcqwA=; b=a6iP+T6rk6iAIhM7d8wsEfyJ9b8hoWyphLncgP0F3l5RAtfzFhS7lSX5B4Egvd5xia izFMpUn7jTYbDA1f8nPSx9CnZS8F+ExY7ghF6pkjZCczIcsPZZCHRCZ+fmTimKWb4bYk iDaTMphD7594Fvs/wJwpN8g5i8psT1dOaodlGdzfj9IIwpP7cYSE56N0saFkrSaIVMU5 K6AAMdluwVvj2Lo5GFtbUAggv722x92Y06xNwQIyjspKYoQZf0Jr8dYMPxuPGTAfcYXG uBsz8VMGS1WP95GvLRljKtKtVS5OPm4XtN5+UQ3O93sej16DE9FYXT3VviWzrGbX27tL LOuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712442783; x=1713047583; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5EK613jOMt0q5YKINPHaRaY+PjrWQT7TxkM34vbcqwA=; b=hi8HQrwodOzJ0UtFAVyJ2hT4DtizfbBVZAzd4ckq38LJNyEkRPXlNx95X+e0uy827H dmk7idJb8TG1Ju9ejpenNoaIPdoU3ret6GWsC/ksWkcY8OPgpR0403dRB3LV1035+H8H qe2xrmaR7wjYI3V63d0hKJH7Yc+3BbkxoD/ZHyNJL6Ek+u1i9tKDvta8mMkywNlKrpGx v48n6h+QwnH/zYt00U6ZWVwa7TGQpnvN0gw7P9PqWCBQtx8+5htaMKN14SeiVoClX9gX f4Pce6KG9OuX+HM2pmlM4Sz48EGaPjp9BPwGMYDRwM/H3dUVH8XH7q7BJG2JjYrCgfoN M1mA== X-Gm-Message-State: AOJu0YxBWGSHfIDlRviekjwd5q3oXoxjyPa+KNFPdnnJTuxdIyeOcbPD 042X9+lxYHJsuNOk3U5AkjBpsS+Wm5QiX34AAF4Ydv3c+Rmq0Cvxms0mimcUIRnq6GBP+/xMzGI C X-Received: by 2002:a05:6a21:8182:b0:1a7:5706:9b96 with SMTP id pd2-20020a056a21818200b001a757069b96mr966857pzb.38.1712442783698; Sat, 06 Apr 2024 15:33:03 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id f23-20020a17090ace1700b002a20c0dcebbsm3643279pju.31.2024.04.06.15.33.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 15:33:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Jorgen.Hansen@wdc.com, Jonathan.Cameron@huawei.com, linux-cxl@vger.kernel.org Subject: [PATCH 7/9] target/riscv: Use insn_start from DisasContextBase Date: Sat, 6 Apr 2024 12:32:46 -1000 Message-Id: <20240406223248.502699-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240406223248.502699-1-richard.henderson@linaro.org> References: <20240406223248.502699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org To keep the multiple update check, replace insn_start with insn_start_updated. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/riscv/translate.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 9d57089fcc..9ff09ebdb6 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -115,8 +115,7 @@ typedef struct DisasContext { bool itrigger; /* FRM is known to contain a valid value. */ bool frm_valid; - /* TCG of the current insn_start */ - TCGOp *insn_start; + bool insn_start_updated; } DisasContext; static inline bool has_ext(DisasContext *ctx, uint32_t ext) @@ -207,9 +206,9 @@ static void gen_check_nanbox_s(TCGv_i64 out, TCGv_i64 in) static void decode_save_opc(DisasContext *ctx) { - assert(ctx->insn_start != NULL); - tcg_set_insn_start_param(ctx->insn_start, 1, ctx->opcode); - ctx->insn_start = NULL; + assert(!ctx->insn_start_updated); + ctx->insn_start_updated = true; + tcg_set_insn_start_param(ctx->base.insn_start, 1, ctx->opcode); } static void gen_pc_plus_diff(TCGv target, DisasContext *ctx, @@ -1224,7 +1223,7 @@ static void riscv_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) } tcg_gen_insn_start(pc_next, 0); - ctx->insn_start = tcg_last_op(); + ctx->insn_start_updated = false; } static void riscv_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) From patchwork Sat Apr 6 22:32:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786495 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp764727wrw; Sat, 6 Apr 2024 15:34:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVYCucVSycUqa/0TAIHqdCc1e68NqeXVqrv3p72m739YVn/8GUYKJaLx4vA8XTiU150U9ie8oNlrcgqwoBE7ibt X-Google-Smtp-Source: AGHT+IEcc6cWNxgtP3BeEEiRqxpkI9YXq4UWhiRzGyI/ODQprFKno2/Ep2sJAKNAFX77pWk7NYKA X-Received: by 2002:a05:6a20:3950:b0:1a3:bd9a:a1a with SMTP id r16-20020a056a20395000b001a3bd9a0a1amr7034648pzg.5.1712442870249; Sat, 06 Apr 2024 15:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712442870; cv=none; d=google.com; s=arc-20160816; b=eFwxvkNuyhcG8h5yU70F52Wr2yr0f1ZRFI1J4WUGAP3pjUvi8mDtpelmZaSpa3LlXG DMzl9QFut6UntwmJKH0awmXMK48erZqJjKoWhgLfJ15C7tZxRYbStZmgJpW8P86Mlcqj K9qlgPkgMfr4cdiWwbysII5lzDCR77rPX6tig8hejvQDVTl/aXzGU7PXPl0feeQpyXko eBLwAQD44hvFqIazq8i4Qx4brfgtKOhPra+tltm7lYnlxjBPFuXmCA6CpjGgj2ICkJWe UX1gc7y07X/fyzAwprT39okTcoudzxVoWoI/62I71mlkFYKe3la6GRFnhasyViAzn1QC Stpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=NX9Ag++TnmEtIL49KdN8wfC5CW3UFh53IC9I9+TmU/s=; fh=/EzrXVxGMvSr5VAgu4NIsk0fqauOAeCxfxr2Kf+iwls=; b=t5gFXsPDKNRBhpLoRVqsuqTSgoEP/n/HnpD2Q8b95kDhTKiSEq915BPQG+IJBEDrJy PBFsRgZ1wDUemZGYDm3XegMZ/ZsVyXrcHilSvGlpzPOAkZGEs6A11nuB54U/9umxS05v CQ0/bv5xvisw/c6izQq7KJcWWwmoC6qqZIjcifLNZmO/lrYAKE+5E0xQ7nOYNih1I4Sx 6bnZb7WqgLIjt9EvFRyrHFThTqlj/Inqn1KnQKwlrbQzext48dwkb1idICoX0bQwE2VW 6XhhiAzTh3N8lqtaBBwz9q1m7Lwel4IPT2yTULifUAFsr6MuCTIR4/DCmC2g5aypKvzW otzw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EofMBaj/"; 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 x2-20020a0ce782000000b00699323a10b4si5089260qvn.15.2024.04.06.15.34.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Apr 2024 15:34:30 -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="EofMBaj/"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtEaz-0003P1-Ea; Sat, 06 Apr 2024 18:33:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtEay-0003OV-2J for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:08 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtEaw-0006m8-Iw for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:07 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2a2f007a33dso2160606a91.0 for ; Sat, 06 Apr 2024 15:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712442785; x=1713047585; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NX9Ag++TnmEtIL49KdN8wfC5CW3UFh53IC9I9+TmU/s=; b=EofMBaj/Tqc1jReXhhRVJFkZz4yhAAEWlix6d8bhw86xTpA/o2NpXs4f2dBCR0fG7e vDTPHTVpyS6stFBtdnKBP/CzK9HfkRUaaS0qwScjUnGWevn0wqbeKf93eFhHEH/O+y8v jqInLSzKiL8tXWPKoerPb51Axr7B0QeeYMsr5PgXx1lmXYYWW0rmLMWoMhcO2UoIbVAp ih9TbxdW7ZGl6w9k35m7VUt/SYD2r6PmLGeY5uvzFm5izG+pXrRnedx7caGXUokK7RRe sFWXpUZ2bPkocLHucCZiYUiLeA+cLuoidOkz9V0CD35gVOlpMAn5uFgFK5O+ccIrfIog uUMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712442785; x=1713047585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NX9Ag++TnmEtIL49KdN8wfC5CW3UFh53IC9I9+TmU/s=; b=XOyJWyJUd41QXYkLpFxbrXNSWup4bH7IcNxOmn0hxFrWMYQtIK1GXRuOmydw3GsjxN XrhRlziJ1P8lmG9nm6qlww5ui96k7Dp5PJ6ZhRpvQJpNXTCxK7a+SCPeUPwxiGqSgEcF yws8m8QcH7Tzx9uS3353cj5NbC5P1AJhbOIYFuPhuwvYymfLtUoktaRi/iEIUXrrzhPZ /5KIzYmK+EdkujSqgrMPpHQSbngNbjHhx6BWt/hRoBWhS64XOwEtyNiouppKCDjgrTZv 0Rg4oyqvdO7fr+GudSTz3o8O2tgrBRcCYNJWgEHpOsBvrN1m7mVCNP2jKj78Rm5XgT9l 4qpg== X-Gm-Message-State: AOJu0YyJxide5R8g7xiVZgR0DFezjKovHUper7Qkla+BtJuOefRkePp1 CwxDr4EoJSfHbiJ/Aug/VwmQxK2ZIfxiIRjEwcvT5mugUvuQ2rNyLaQXLfRVwlUq3CviuucUayo Y X-Received: by 2002:a17:90a:eb0f:b0:2a2:53a5:7559 with SMTP id j15-20020a17090aeb0f00b002a253a57559mr4607335pjz.38.1712442785243; Sat, 06 Apr 2024 15:33:05 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id f23-20020a17090ace1700b002a20c0dcebbsm3643279pju.31.2024.04.06.15.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 15:33:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Jorgen.Hansen@wdc.com, Jonathan.Cameron@huawei.com, linux-cxl@vger.kernel.org Subject: [PATCH 8/9] target/s390x: Use insn_start from DisasContextBase Date: Sat, 6 Apr 2024 12:32:47 -1000 Message-Id: <20240406223248.502699-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240406223248.502699-1-richard.henderson@linaro.org> References: <20240406223248.502699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/s390x/tcg/translate.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 57b7db1ee9..90a74ee795 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -141,7 +141,6 @@ struct DisasFields { struct DisasContext { DisasContextBase base; const DisasInsn *insn; - TCGOp *insn_start; DisasFields fields; uint64_t ex_value; /* @@ -6314,7 +6313,7 @@ static DisasJumpType translate_one(CPUS390XState *env, DisasContext *s) insn = extract_insn(env, s); /* Update insn_start now that we know the ILEN. */ - tcg_set_insn_start_param(s->insn_start, 2, s->ilen); + tcg_set_insn_start_param(s->base.insn_start, 2, s->ilen); /* Not found means unimplemented/illegal opcode. */ if (insn == NULL) { @@ -6468,7 +6467,6 @@ static void s390x_tr_insn_start(DisasContextBase *dcbase, CPUState *cs) /* Delay the set of ilen until we've read the insn. */ tcg_gen_insn_start(dc->base.pc_next, dc->cc_op, 0); - dc->insn_start = tcg_last_op(); } static target_ulong get_next_pc(CPUS390XState *env, DisasContext *s, From patchwork Sat Apr 6 22:32:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 786489 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp764633wrw; Sat, 6 Apr 2024 15:33:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXNc8R+2HqwtGS3QPcwoaKFlNhXd3IMwDzauy/FaDrkdDGYXcQdnmQYEShLOu3bvABZGtfyWZumhZWXuQ17DVhB X-Google-Smtp-Source: AGHT+IHbeqoGUDIUQP8c0lrqcHhRT+Ba+bsr8QjDsL728SpMu+vNf6qXyT19t2BSTX94sqF4e2o5 X-Received: by 2002:a05:620a:4092:b0:78d:4238:93ae with SMTP id f18-20020a05620a409200b0078d423893aemr6749451qko.59.1712442836260; Sat, 06 Apr 2024 15:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712442836; cv=none; d=google.com; s=arc-20160816; b=s/IYm4n12vI+fhSpPgHuPwEP2XX2XDCaqnud6p0Zc+ngLxU6++aEkxZDR9LQmLSmhz WfibvvYw3vwEFIWmpjYPJD5rBljbdSn8CAPMxbqV51W0nWbMLpAjhikdVBM4sTdeYFah 6pF2hjiWNJCf5XydlI4wwFhM/wZLWY5vC7JvFZ8VUaz8INd1Ik/Zl/JbPjsX65PMjuYp 3x05EZeTwSrK+Dfm0gtGtKL4zqAGsnLcapHH5IuphtVT4zD9Imd5BebmIM6QdrXwkc3U 12vk9soCths0bCp7XdYkfuCHN5wI0Re379LTLWzszMgNAsZFKUd0OUkC6G57WKt9bATD fLrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=hCcliQok5xWZ0STL9q8OCOy2kMXMLfgS8Bx/eIbiktU=; fh=/EzrXVxGMvSr5VAgu4NIsk0fqauOAeCxfxr2Kf+iwls=; b=w1DwvNY+MLkEc5ZTwcVZg2A0JKO14ido+F8H4SjiKypJ+fzxjHqwQ5MxAvTprxEy8I 8XqcKoYKazeu2xe+GaZoY7YoKDBqIA3LAKRlVG8vRWmcEhEvcvCcz8AEGx5ECaR5vf2e Sv+HIBk+6lkGGx/B6bMKdkHFDgKA759lNlAci447S9hbRukdo58bFt+RORgk8Dqy2Kl8 OGoW3SGifhWbWrAerf1hJe9KalmhQ4unb6Xnwn38zpJ+3Ew7KLxQO7yM1Wc1fU30laY4 ef1gx082K/pyENRvAQSlfUwsIVGssS+jvcBTgmcfxQlkaNs615B70cC016Nm/KqtLloH Ozyw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yW315/nd"; 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 yf1-20020a05620a3bc100b00789f57caff0si5002264qkn.199.2024.04.06.15.33.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Apr 2024 15:33:56 -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="yW315/nd"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtEb3-0003Pp-R9; Sat, 06 Apr 2024 18:33:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtEb0-0003PO-Cb for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:10 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtEay-0006mR-0U for qemu-devel@nongnu.org; Sat, 06 Apr 2024 18:33:09 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6ecf406551aso2317933b3a.2 for ; Sat, 06 Apr 2024 15:33:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712442787; x=1713047587; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hCcliQok5xWZ0STL9q8OCOy2kMXMLfgS8Bx/eIbiktU=; b=yW315/ndvN1TQiyQFXoffBOE6QtOh6i8LXzq55Ghum6MBqbyAkSzO/cV9nrJ0AQ+Ao hnEbRzsAOMjRO/muwdgRYJf2ZvqPxYmFC0b31P0mxoI+uJcbi7PQazVE+N/qPSeL8vZl j18+fjvdsry+5kwEyetiSdfDLcxmVRKptwC+MJcc42bkPVhMamETZu0CHJ+pWbF/lRal b+TjvzQLfN43OETYRTTCL9ay8/m4FwBOwF1x5eKNToZJNLx8LhC2BLkb5QbyV4jBni/5 6c39lZ8jzpRYaTStvrKZMSJa+WpAqlKjQpwLP2UMXOMvCqvat+dmJQN6oM2gcEO0pawA IBeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712442787; x=1713047587; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hCcliQok5xWZ0STL9q8OCOy2kMXMLfgS8Bx/eIbiktU=; b=ZCewJefSvejz9ri7LydgyBwkcX2oWuyW88h0bPAI63JKCfzY3AzBM8vmo0ALDOWtvs gEbT+tlRlmR+0A1cbXe55qOLy7kaQ9uvZbVjnf6t7XgneDDKmefC1CQJIVStHCe3sIVe Ecwwyy1JHPdlk7YCikWxP6GNlBjNlSg06ifibDHNIQhSr1nRkDfv5WgfPNR6d/7ExOGR yCmeNWB4rSqFX/xQar9SRJ975IHF7inWazqicg0SpdtlkkSo92pWhZxXCN+J5OfItM9Q NRivpTRQG6ei+eZM0I/2PJO0Sx66Rd7lc90AqLRVqK8G/wnhI1xgIMHFZhQmj2a+WTn4 dzow== X-Gm-Message-State: AOJu0YzOvqM+mGEYvwJ8/QzNM9ch97IX6I7O+D2Y8gsiAQRubqZYlG/p 9tMQjpXZqT/rFD3Mwl/L+JbiB7xVep008H4IQQcHCk/lJhSgveJuMZIMTELFKv0Jo8wVpDiJ2oo 8 X-Received: by 2002:a05:6a20:158c:b0:1a7:1c26:f9ac with SMTP id h12-20020a056a20158c00b001a71c26f9acmr6020296pzj.62.1712442786698; Sat, 06 Apr 2024 15:33:06 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id f23-20020a17090ace1700b002a20c0dcebbsm3643279pju.31.2024.04.06.15.33.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Apr 2024 15:33:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Jorgen.Hansen@wdc.com, Jonathan.Cameron@huawei.com, linux-cxl@vger.kernel.org Subject: [PATCH 9/9] accel/tcg: Improve can_do_io management Date: Sat, 6 Apr 2024 12:32:48 -1000 Message-Id: <20240406223248.502699-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240406223248.502699-1-richard.henderson@linaro.org> References: <20240406223248.502699-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.google.com 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_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We already attempted to set and clear can_do_io before the first and last insns, but only used the initial value of max_insns and the call to translator_io_start to find those insns. Now that we track insn_start in DisasContextBase, and now that we have emit_before_op, we can wait until we have finished translation to identify the true first and last insns and emit the sets of can_do_io at that time. This fixes case of a translation block which crossed a page boundary, and for which the second page turned out to be mmio. In this case we truncate the block, and the previous logic for can_do_io could leave a block with a single insn with can_do_io set to false, which would fail an assertion in cpu_io_recompile. Reported-by: Jørgen Hansen Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Tested-by: Jørgen Hansen Reviewed-by: Gregory Price --- include/exec/translator.h | 1 - accel/tcg/translator.c | 45 ++++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index ceaeca8c91..2c4fb818e7 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -87,7 +87,6 @@ typedef struct DisasContextBase { int num_insns; int max_insns; bool singlestep_enabled; - int8_t saved_can_do_io; bool plugin_enabled; struct TCGOp *insn_start; void *host_addr[2]; diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index ae61c154c2..9de0bc34c8 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -18,20 +18,14 @@ static void set_can_do_io(DisasContextBase *db, bool val) { - if (db->saved_can_do_io != val) { - db->saved_can_do_io = val; - - QEMU_BUILD_BUG_ON(sizeof_field(CPUState, neg.can_do_io) != 1); - tcg_gen_st8_i32(tcg_constant_i32(val), tcg_env, - offsetof(ArchCPU, parent_obj.neg.can_do_io) - - offsetof(ArchCPU, env)); - } + QEMU_BUILD_BUG_ON(sizeof_field(CPUState, neg.can_do_io) != 1); + tcg_gen_st8_i32(tcg_constant_i32(val), tcg_env, + offsetof(ArchCPU, parent_obj.neg.can_do_io) - + offsetof(ArchCPU, env)); } bool translator_io_start(DisasContextBase *db) { - set_can_do_io(db, true); - /* * Ensure that this instruction will be the last in the TB. * The target may override this to something more forceful. @@ -84,13 +78,6 @@ static TCGOp *gen_tb_start(DisasContextBase *db, uint32_t cflags) - offsetof(ArchCPU, env)); } - /* - * cpu->neg.can_do_io is set automatically here at the beginning of - * each translation block. The cost is minimal, plus it would be - * very easy to forget doing it in the translator. - */ - set_can_do_io(db, db->max_insns == 1); - return icount_start_insn; } @@ -129,6 +116,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, { uint32_t cflags = tb_cflags(tb); TCGOp *icount_start_insn; + TCGOp *first_insn_start = NULL; bool plugin_enabled; /* Initialize DisasContext */ @@ -139,7 +127,6 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, db->num_insns = 0; db->max_insns = *max_insns; db->singlestep_enabled = cflags & CF_SINGLE_STEP; - db->saved_can_do_io = -1; db->insn_start = NULL; db->host_addr[0] = host_pc; db->host_addr[1] = NULL; @@ -159,6 +146,9 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, *max_insns = ++db->num_insns; ops->insn_start(db, cpu); db->insn_start = tcg_last_op(); + if (first_insn_start == NULL) { + first_insn_start = db->insn_start; + } tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ if (plugin_enabled) { @@ -171,10 +161,6 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, * done next -- either exiting this loop or locate the start of * the next instruction. */ - if (db->num_insns == db->max_insns) { - /* Accept I/O on the last instruction. */ - set_can_do_io(db, true); - } ops->translate_insn(db, cpu); /* @@ -207,6 +193,21 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, ops->tb_stop(db, cpu); gen_tb_end(tb, cflags, icount_start_insn, db->num_insns); + /* + * Manage can_do_io for the translation block: set to false before + * the first insn and set to true before the last insn. + */ + if (db->num_insns == 1) { + tcg_debug_assert(first_insn_start == db->insn_start); + } else { + tcg_debug_assert(first_insn_start != db->insn_start); + tcg_ctx->emit_before_op = first_insn_start; + set_can_do_io(db, false); + } + tcg_ctx->emit_before_op = db->insn_start; + set_can_do_io(db, true); + tcg_ctx->emit_before_op = NULL; + if (plugin_enabled) { plugin_gen_tb_end(cpu, db->num_insns); }