From patchwork Thu Sep 14 17:44:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 722578 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp527858wro; Thu, 14 Sep 2023 10:46:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFz+PfGB/Q+tmuPbG8dglu9m/Kc9gCITWpG16ZpZowrV3nUHUtRK6Kc4jD1oGEUV+3R+UoG X-Received: by 2002:a05:620a:cc8:b0:767:b196:e88 with SMTP id b8-20020a05620a0cc800b00767b1960e88mr5129681qkj.42.1694713577590; Thu, 14 Sep 2023 10:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694713577; cv=none; d=google.com; s=arc-20160816; b=f98aWfyH727Azdrgh6HzwfuxAKcaeZY4qa90eT38TWwJrJYlbL/JEGWTSYPi8XSxce UJjCYVaj7C6E48mC1E114yONQPwm8EDtd7YR0DK1xrNHs2fZKO65f/GqM7ctn5yLY25J 3iiIbfmNIdZAkWUcDoaa/X9Z9SgwUibpYWLyWOVrM7igNZi3J8A32R+j03n6FfHdc5DW tSGdMTZ098V8K85jc7SQg/LS86d7hJ4BD3D655+8fow+4qJBiym2EESB/9eQoLcntYjw Ooc8s+anqY4Ps8bEN2eDDSLJyMHlugG7HRYj19NGRcH86oI8AX4QCh8TRxZpYTTaMOQc nL8g== 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=V3EVonE9eg3BvfVh3vmTdOCW0800wHk+spI7M9DnBuQ=; fh=ycigHkwOPieh2u5PmcA89sNk/qPD1ZkdDlL8Mchfvw8=; b=ItuQHkICw+mxqMQNsOC/VUvLZDuC7614QWD2IlR17ITiIPCwTuEYJNyth5ryD3Vnfz LXM9lxcRtncOS93oKLxfazEdM+7eYlRcL6fVenui4XTkioHczH07tuPenvYedbCsSBDr cw+V2NUA1SAJJZ2oWADlgASpWlfa/Hs4Tg5bl8KKyIkAK59MEtmJbw+xj9SUNOyMyXgu nUCPQVqh3tmgYgwiMmxHYrwlx8YtfN6YBlwQTr5QdOPov3drKoXhxdsTq5xoIjYr8nEC vU9s2d+3wSNr40OA7KGvfYDC9dYbqahrTtN5xv0uSu/oDe/Y1Acd2vJTKjnPHgKKFV0Y KPiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ZZp/rgAH"; 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 j11-20020a05620a288b00b0076da43af035si1231489qkp.733.2023.09.14.10.46.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Sep 2023 10:46: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="ZZp/rgAH"; 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 1qgqOY-0000jM-6x; Thu, 14 Sep 2023 13:44:50 -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 1qgqOV-0000hJ-Gt for qemu-devel@nongnu.org; Thu, 14 Sep 2023 13:44:47 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qgqOT-00070k-Lc for qemu-devel@nongnu.org; Thu, 14 Sep 2023 13:44:47 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-68fc9a4ebe9so1101030b3a.2 for ; Thu, 14 Sep 2023 10:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694713484; x=1695318284; 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=V3EVonE9eg3BvfVh3vmTdOCW0800wHk+spI7M9DnBuQ=; b=ZZp/rgAH9B3AR3Ht6cfoY0zEF+7PypQMQfFiT3h8rbpfNOUGiIM+0uwfX9C11nIgKv xQNI7Rrl2rsXLBMLZor4TgYzNxgf7RzywpfSS69KHvO2FWH4eSdYTR5gr36tpLZhMxw/ rDoCBf+c0I3ZalhjkqtnO5gpad35RuZzlRZj+MAElhrRoVhL7TV3LYnDNpFYKFc4gw41 vOyA3kLF9VaPYXWn+VQ76+v2GHH9MSYO8eGG6/qLY54zQw8QuIgHMcBFhU+gEGYoMPCw AJMVUGQ6jhuexh0APuRDOXPkYluL8V1VXKnuoUA4djEmmn7bElrUukKIdxpLOM9kwY0/ pvhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694713484; x=1695318284; 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=V3EVonE9eg3BvfVh3vmTdOCW0800wHk+spI7M9DnBuQ=; b=hzIa0uB0AY/BD350/aBDsXTC7IbT0/k5WuhwL/qor1hfstN6gHpGAkc/HM/Y9fsI5O xuvpde3qR7lVo3ZoZhbFL5E/kwj8fuE3QbIg12psX3DnyDc0QnCJUbo8q/yVxqjD7eAw FwUPADAAZ6B9N4jW/mWwyJF8Ss1KRPCchx/IcuaFBkt1iF7WkNHKzGGhJcpLdwR7Y5qK cvQq2gq5itQJ0ppTKUVUZD7yEsV/LCyAgZ92I1waz/yteq+x9iOQP94b9ZUJuU5m1cKv 1hfC/lzkVYCkANcF866EGohFjqjlRh/VTOFAGjEcFHVGtY9Rhrmc1/kLhn50atLSa/N4 2B7A== X-Gm-Message-State: AOJu0YzSTPeaYaU1QYYghwbalogAtX20dt5gUKBuvCOOm5QD/xst9Pz5 t7CBjTfOLvsqOMCF+l4Qx1u7l4oRtFFiMhjXv5E= X-Received: by 2002:a05:6a00:998:b0:68e:2d9d:b0cc with SMTP id u24-20020a056a00099800b0068e2d9db0ccmr7487846pfg.6.1694713483670; Thu, 14 Sep 2023 10:44:43 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id w17-20020aa78591000000b0068c5bd3c3b4sm1588933pfn.206.2023.09.14.10.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 10:44:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org Subject: [PATCH 6/6] accel/tcg: Always require can_do_io Date: Thu, 14 Sep 2023 10:44:36 -0700 Message-Id: <20230914174436.1597356-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230914174436.1597356-1-richard.henderson@linaro.org> References: <20230914174436.1597356-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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 Require i/o as the last insn of a TranslationBlock always, not only with icount. This is required for i/o that alters the address space, such as a pci config space write. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1866 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- accel/tcg/translator.c | 20 +++++++------------- target/mips/tcg/translate.c | 1 - 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index dd507cd471..358214d526 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -28,12 +28,6 @@ static void set_can_do_io(DisasContextBase *db, bool val) bool translator_io_start(DisasContextBase *db) { - uint32_t cflags = tb_cflags(db->tb); - - if (!(cflags & CF_USE_ICOUNT)) { - return false; - } - set_can_do_io(db, true); /* @@ -86,15 +80,15 @@ static TCGOp *gen_tb_start(DisasContextBase *db, uint32_t cflags) tcg_gen_st16_i32(count, cpu_env, offsetof(ArchCPU, neg.icount_decr.u16.low) - offsetof(ArchCPU, env)); - /* - * cpu->can_do_io is set automatically here at the beginning of - * each translation block. The cost is minimal and only paid for - * -icount, plus it would be very easy to forget doing it in the - * translator. - */ - set_can_do_io(db, db->max_insns == 1 && (cflags & CF_LAST_IO)); } + /* + * cpu->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 && (cflags & CF_LAST_IO)); + return icount_start_insn; } diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 9bb40f1849..593fc80458 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -11212,7 +11212,6 @@ static void gen_branch(DisasContext *ctx, int insn_bytes) /* Branches completion */ clear_branch_hflags(ctx); ctx->base.is_jmp = DISAS_NORETURN; - /* FIXME: Need to clear can_do_io. */ switch (proc_hflags & MIPS_HFLAG_BMASK_BASE) { case MIPS_HFLAG_FBNSLOT: gen_goto_tb(ctx, 0, ctx->base.pc_next + insn_bytes);