From nobody Mon Feb 9 03:30:25 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627134709561647.5957424461659; Sat, 24 Jul 2021 06:51:49 -0700 (PDT) Received: from localhost ([::1]:36568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7I4C-0007FZ-KN for importer@patchew.org; Sat, 24 Jul 2021 09:51:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7I1c-00053L-Uv for qemu-devel@nongnu.org; Sat, 24 Jul 2021 09:49:08 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:38602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7I1b-0000kU-AE for qemu-devel@nongnu.org; Sat, 24 Jul 2021 09:49:08 -0400 Received: by mail-wr1-x432.google.com with SMTP id o1so5365023wrp.5 for ; Sat, 24 Jul 2021 06:49:06 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id n5sm34690344wri.31.2021.07.24.06.49.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 06:49:05 -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 :mime-version:content-transfer-encoding; bh=c7z+GYhXxuCb+T04d1yFr2qL06daIAh24I6xSy8/9AA=; b=d3GgIb2i4Ho3PuewNAu7P3gs29cFYb6QYF8f9/cf+kko92+EgFVWp3SkqCIZcYLxu4 JPumIGi8qNSkkc5eSMQdJvM076UvCTfl20C4+A3/F4hhj894uyPNIpNOLaI4QcRFORm2 RyfozTJ+CeQyaiJPKMSnrm19XbEdEdP6Vr/33XVYEom4iL+EgD3tAYpHdFwS8eUxjkod kBuODqbFPuvQYbJjJ2HS/MR/9FS5Jo9kBf0ETsA53Bi4hW+CDJ6VrXQUdYYXj4qr6wWn HBOxYAOn2v6YEU2CaM4YdwCh2Hxeeo4GN4+P2ruU0iLmK6jDtzvHtJ23+YypTR55s+a7 /LxA== 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:mime-version:content-transfer-encoding; bh=c7z+GYhXxuCb+T04d1yFr2qL06daIAh24I6xSy8/9AA=; b=K1S01woIqJ2TbUHXMl+EWJ4TclaFDwZ0L5zDNeF8iYnEyGF+bcH1ri7yJKjOeyVgMF DE6lqKTYWCqCyN+Ed53H6YFYsiQTzmZ1G+ZczetQAhVc5zNJCPSPr4nccTf0pI7vZc9T 860YWfuziMj5MON3drN3px7Uw+eLn2TgAHVxhXJ65wmvbC+MvMphC4Qg48MWeITi5pAQ xxh2p5TlULTxhJKlFaw1WPCheg4I0DgGjak9hU2KOcrX2ANY4cUKa7/fG/xZpaKLgLEo ZKanZqMtuyrhyMpPIA/x8QjCjxaT0fVa6/dI7ri1xxm4cLwJgOGAjkEhApGZR+fbKwS4 +NvA== X-Gm-Message-State: AOAM531rJb5Ab/E7th7q1P7MXD7CKUDa7uYGFvnj/3t6kFSuNKogcmyP wgOsZn8P+NaOXFDvv5J/vgWwjAdg178Hpw== X-Google-Smtp-Source: ABdhPJyY71jOPe9WibfyTlWc6jbQ9Zn/SAkk6/KtDC+yZVplGFO65E2AutFCdji28JUxfUOp8ZuBUw== X-Received: by 2002:a5d:67cc:: with SMTP id n12mr10252848wrw.131.1627134545584; Sat, 24 Jul 2021 06:49:05 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 1/2] target/sparc: Drop use of gen_io_end() Date: Sat, 24 Jul 2021 14:49:01 +0100 Message-Id: <20210724134902.7785-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210724134902.7785-1-peter.maydell@linaro.org> References: <20210724134902.7785-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Mark Cave-Ayland , Artyom Tarasenko Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627134711002100001 Content-Type: text/plain; charset="utf-8" The gen_io_end() function is obsolete (as documented in docs/devel/tcg-icount.rst). Where an instruction is an I/O operation, the translator frontend should call gen_io_start() before generating the code which does the I/O, and then end the TB immediately after this insn. Remove the calls to gen_io_end() in the SPARC frontend, and ensure that the insns which were calling it end the TB if they didn't do so already. Signed-off-by: Peter Maydell Reviewed-by: Mark Cave-Ayland Reviewed-by: Richard Henderson --- target/sparc/translate.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 11de5a49631..bb70ba17deb 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -3401,7 +3401,8 @@ static void disas_sparc_insn(DisasContext * dc, unsig= ned int insn) tcg_temp_free_i32(r_const); gen_store_gpr(dc, rd, cpu_dst); if (tb_cflags(dc->base.tb) & CF_USE_ICOUNT) { - gen_io_end(); + /* I/O operations in icount mode must end the = TB */ + dc->base.is_jmp =3D DISAS_EXIT; } } break; @@ -3454,7 +3455,8 @@ static void disas_sparc_insn(DisasContext * dc, unsig= ned int insn) tcg_temp_free_i32(r_const); gen_store_gpr(dc, rd, cpu_dst); if (tb_cflags(dc->base.tb) & CF_USE_ICOUNT) { - gen_io_end(); + /* I/O operations in icount mode must end the = TB */ + dc->base.is_jmp =3D DISAS_EXIT; } } break; @@ -3588,7 +3590,8 @@ static void disas_sparc_insn(DisasContext * dc, unsig= ned int insn) tcg_temp_free_ptr(r_tickptr); tcg_temp_free_i32(r_const); if (tb_cflags(dc->base.tb) & CF_USE_ICOUNT) { - gen_io_end(); + /* I/O operations in icount mode must end the = TB */ + dc->base.is_jmp =3D DISAS_EXIT; } } break; @@ -4582,7 +4585,8 @@ static void disas_sparc_insn(DisasContext * dc, unsig= ned int insn) } gen_helper_wrpstate(cpu_env, cpu_tmp0); if (tb_cflags(dc->base.tb) & CF_USE_ICOUNT= ) { - gen_io_end(); + /* I/O ops in icount mode must end the= TB */ + dc->base.is_jmp =3D DISAS_EXIT; } dc->npc =3D DYNAMIC_PC; break; @@ -4598,7 +4602,8 @@ static void disas_sparc_insn(DisasContext * dc, unsig= ned int insn) } gen_helper_wrpil(cpu_env, cpu_tmp0); if (tb_cflags(dc->base.tb) & CF_USE_ICOUNT= ) { - gen_io_end(); + /* I/O ops in icount mode must end the= TB */ + dc->base.is_jmp =3D DISAS_EXIT; } break; case 9: // cwp @@ -4697,10 +4702,6 @@ static void disas_sparc_insn(DisasContext * dc, unsi= gned int insn) gen_helper_tick_set_limit(r_tickptr, cpu_hstick_c= mpr); tcg_temp_free_ptr(r_tickptr); - if (tb_cflags(dc->base.tb) & - CF_USE_ICOUNT) { - gen_io_end(); - } /* End TB to handle timer interrupt */ dc->base.is_jmp =3D DISAS_EXIT; } @@ -5327,9 +5328,6 @@ static void disas_sparc_insn(DisasContext * dc, unsig= ned int insn) gen_io_start(); } gen_helper_done(cpu_env); - if (tb_cflags(dc->base.tb) & CF_USE_ICOUNT) { - gen_io_end(); - } goto jmp_insn; case 1: if (!supervisor(dc)) @@ -5340,9 +5338,6 @@ static void disas_sparc_insn(DisasContext * dc, unsig= ned int insn) gen_io_start(); } gen_helper_retry(cpu_env); - if (tb_cflags(dc->base.tb) & CF_USE_ICOUNT) { - gen_io_end(); - } goto jmp_insn; default: goto illegal_insn; --=20 2.20.1 From nobody Mon Feb 9 03:30:25 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627134785174211.6594146039946; Sat, 24 Jul 2021 06:53:05 -0700 (PDT) Received: from localhost ([::1]:38718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7I5Q-0000FT-6O for importer@patchew.org; Sat, 24 Jul 2021 09:53:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7I1d-00053Y-Ta for qemu-devel@nongnu.org; Sat, 24 Jul 2021 09:49:09 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:52033) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7I1b-0000kZ-K8 for qemu-devel@nongnu.org; Sat, 24 Jul 2021 09:49:09 -0400 Received: by mail-wm1-x32d.google.com with SMTP id o3so2436461wms.1 for ; Sat, 24 Jul 2021 06:49:07 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id n5sm34690344wri.31.2021.07.24.06.49.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 06:49:05 -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 :mime-version:content-transfer-encoding; bh=Mytq3FrMkJT4bae7M6CVd7ijJpQEo6Jjbs+BMV7IiMY=; b=CQCbLcNbRjlBmNOIvrysla2/eEtJs9KuJ9Wf+KaRQc2JXyBASsOO1jZhmVJOlXKkIw gbEMphjyCPWpguqOz02HxFf2Mh3kLy8KzCibZs4fCsi2wMloLzpljXzcKB0Z2ABYSSSn of+lIJTbELyQJ/40BiGkp1MNz6vgmdJfEaaVCgwuRMR+MlSp5D4vGLmaR9ZCZUgDLOPe IoYCrnaIn9IEyY7DDrPZhiHXyOmP+rFlXywSnltqXnNC6J1PwcDdPDtBZUfr7yvanpLh KVH1qv1UIx2w2Ek9NtijuO8i3zUjybwaWrHe+IExR7nrGARtPN6HBzldY+aulb2/4KEe HGmg== 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:mime-version:content-transfer-encoding; bh=Mytq3FrMkJT4bae7M6CVd7ijJpQEo6Jjbs+BMV7IiMY=; b=scLwzdssjeMchtMDsBFCoL4CG0umhhO9MtktqYw1AaYD1+WyTZ1MLZon/2rYERs0xT 2a+clQ9OqtmelUf+HiSwRx32fa7hBrtWdozI7FUA5M5LiHPf0M5FePCSQQRT2bnbTW6k TdH+/bl0s7SwACCGO1ARa4JiflybbIggWYTWHNLTECtzi75P4l4DtiPzI4IXdJcKAhn/ FMBQhDPE0+EW5NixkA8gFew1U8gTec3A4O8yaMQ3D+gpthXK76xLGQfJGDFoDf7nN9aT rs/vSTBBZRuKu2NmQ/yOdWGUvj/StDkng7xlPHPE+/z+YUees8OPrTt/WYoxM4FpY74p MeQQ== X-Gm-Message-State: AOAM532PqpbeNdYjex0dCwnt3pRmmIR+DRhKGvgmt4Pd/+2sExnj/3nv pXsq6Y5E9SpMw+/m/x8fTK5/Ni66lcg5QQ== X-Google-Smtp-Source: ABdhPJxftIf9RUsWxIYAdemyTk8dLdWuxGYQNMxA8HB9kGvYE9g+ltRVQpNbc9iEycTuS61KiiFcig== X-Received: by 2002:a7b:c5c8:: with SMTP id n8mr18715359wmk.124.1627134546311; Sat, 24 Jul 2021 06:49:06 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.2 2/2] tcg: Drop gen_io_end() Date: Sat, 24 Jul 2021 14:49:02 +0100 Message-Id: <20210724134902.7785-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210724134902.7785-1-peter.maydell@linaro.org> References: <20210724134902.7785-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Mark Cave-Ayland , Artyom Tarasenko Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627134787274100001 Content-Type: text/plain; charset="utf-8" Now we have removed all the uses of gen_io_end() from target frontends, the only callsite is inside gen_tb_start(). Inline the code there, and remove the reference to it from the documentation. While we are inlining the code, switch it to use tcg_constant_i32() so we don't have to manually create and destroy a TCG temporary. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- docs/devel/tcg-icount.rst | 3 --- include/exec/gen-icount.h | 27 ++++++++++----------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/docs/devel/tcg-icount.rst b/docs/devel/tcg-icount.rst index 8d67b6c076a..50c8e8dabc1 100644 --- a/docs/devel/tcg-icount.rst +++ b/docs/devel/tcg-icount.rst @@ -92,6 +92,3 @@ When the translator is handling an instruction of this ki= nd: } =20 * it must end the TB immediately after this instruction - -Note that some older front-ends call a "gen_io_end()" function: -this is obsolete and should not be used. diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h index 467529d84c5..610cba58feb 100644 --- a/include/exec/gen-icount.h +++ b/include/exec/gen-icount.h @@ -17,22 +17,6 @@ static inline void gen_io_start(void) tcg_temp_free_i32(tmp); } =20 -/* - * cpu->can_do_io is cleared automatically 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. Therefore, backends only need to call - * gen_io_start. - */ -static inline void gen_io_end(void) -{ - TCGv_i32 tmp =3D tcg_const_i32(0); - tcg_gen_st_i32(tmp, cpu_env, - offsetof(ArchCPU, parent_obj.can_do_io) - - offsetof(ArchCPU, env)); - tcg_temp_free_i32(tmp); -} - static inline void gen_tb_start(const TranslationBlock *tb) { TCGv_i32 count; @@ -64,7 +48,16 @@ static inline void gen_tb_start(const TranslationBlock *= tb) tcg_gen_st16_i32(count, cpu_env, offsetof(ArchCPU, neg.icount_decr.u16.low) - offsetof(ArchCPU, env)); - gen_io_end(); + /* + * cpu->can_do_io is cleared 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. Doing it here means we don't need a gen_io_end() to + * go with gen_io_start(). + */ + tcg_gen_st_i32(tcg_constant_i32(0), cpu_env, + offsetof(ArchCPU, parent_obj.can_do_io) - + offsetof(ArchCPU, env)); } =20 tcg_temp_free_i32(count); --=20 2.20.1