From patchwork Fri Sep 15 09:41:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 723102 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp272028wro; Fri, 15 Sep 2023 02:42:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFeMXjvs8cnWk5Zp3bRPDW70Xe2GrSNkPD/H/fVJ3KEoQfUxmIvulUtiaMOF3RLO44+zR5n X-Received: by 2002:a05:620a:c54:b0:76e:ff2e:44c5 with SMTP id u20-20020a05620a0c5400b0076eff2e44c5mr1038901qki.37.1694770928123; Fri, 15 Sep 2023 02:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694770928; cv=none; d=google.com; s=arc-20160816; b=DUrLRU0AGdM/Yw1HFkT8BJ88nSIiUMGsb3jC7aW05xGl/q4AiPAqVxXopcIWFdAFPG rxiP7n6W1hh/B6Kq7tpuCx/du3MwB+rzRAEh2uA5Y4GcW/bNBX+2NOlkep50NJPqcsNc V3+iEllPh95bTHdlXf6ZNxTdwfO6blZ6afnQHl92+L9QGe+rEiYk+C5FCGmnSoWLUDGW pYkZv0Te6MxBQ86Wc2EY9nVRZjdLT0frASomigcHFyrggA/PHUgEY4RuyjFQYm06nki4 HOYzloy6DDr0D8Th0p5v0VAubHMTG2gWCUSDxjAxHyuuPW1LGh166kEMeoqGgQfakLCG UjvA== 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=xKB6i1a2Yf+Z+ixpNmbbmyHoSOgE6srsg9geAh24tEo=; fh=fz3DJMUXEzejNv0JWYQ+xa02BmrDN+/I7HIv5ot61VY=; b=ji2OUtYAHmTg/eIr3Wb2dGqqeyXv7PPFcXQqZxFueLn9ChTgXnky3Sw/A5q30YnqTc cp+rQdtrPTqEo320F1AhhJIo+5ATqqwvur/BcO3ixYMTYdtM2eSzebwEhiFgwVzQmZtC 0USPg7b3HztR2Flpl7+dp3rVlErJhwcK4v756Y2fyNWIjtetloDwjif5+EvMoR/JyF3w 46/Ex0Hq7O6JPPDHNN7WzDEhaSE9JxPrMv3WYpbBYrLwSEb+tINtx99horcdz4CCEbbi Klgc4fAoJLW2C/8lUKVY8gYg1sPXGMA6rWKg1f/GLxTtc7SbQu5Ne8zWZZDJjlhW5c7e u5FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NhAz04SU; 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 i13-20020a05620a0a0d00b00772471359c9si2089172qka.165.2023.09.15.02.42.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Sep 2023 02:42:08 -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=NhAz04SU; 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 1qh5KB-0001lR-Ph; Fri, 15 Sep 2023 05:41:19 -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 1qh5K7-0001kA-MY for qemu-devel@nongnu.org; Fri, 15 Sep 2023 05:41:15 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qh5K6-0000d1-0m for qemu-devel@nongnu.org; Fri, 15 Sep 2023 05:41:15 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-9a9d82d73f9so237306166b.3 for ; Fri, 15 Sep 2023 02:41:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694770872; x=1695375672; 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=xKB6i1a2Yf+Z+ixpNmbbmyHoSOgE6srsg9geAh24tEo=; b=NhAz04SUeTyUKiLhH++IXVolxZ5v5/GSpRC2MRGvAQBv22aSDLcMp1mtlWShnlG0Uf RcTwLnul59EPyfpOpdSWfq8xJV8/NWLNElc8mocRw8i3TNPywMHvgYXOBiw8gLKo60iL lkLe4DKiaxn2KJtvjTjvp6p59vENw3KUVNfoKPaJUinEN9UY6aASok8wUVPrpssnZV8u 0KL9wV5fABIAAQZ0n53v49z4tGFUFlj2Sxl1XWbakl9jYJeuXBO59eJVqXiSEu2hzJDw b8eezZA1f7DgqytegSVE6ClJUVse2S7inb0RK683UlhdmQBrBnBcv+KLun8nTM683FEe WGVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694770872; x=1695375672; 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=xKB6i1a2Yf+Z+ixpNmbbmyHoSOgE6srsg9geAh24tEo=; b=weynLDz0cnjqhco6yPLKYmu2CO8TR///pE9o2s/4Itap7WHsuuSjhXLYIWMili1rsT ok+NppBLH8lopEUiu8EKqvrL611fGX215g8RoVwF97wVfqa4iBMkRCJvFljUfKjF4uvj jt4n6jaOyxJAVcQtmfdblfACV6Xlb2b/hrhrmVRiuA9QdajkNmtb4LR3X80HQ+a/m8ya rpuMiVy3N4ykYwUii3lGMsGSSgiiw5Eiy9DJkVwAgybyBGLmTD6AfZ3NzavbYOTEjE14 v8OLpOZ6OOe72y1dDcEEKniOusyQZh2DX8LytgXUYmrc1KtoRe3AQpMyM9FZ6rqnKcQp xPAQ== X-Gm-Message-State: AOJu0Yw9qHTLy34rJT+mMZJvkMvEYQBSoGSUtyWaWtWECfsX8nKQBmij 2ZJNigAgiTmo5iAUqDjdrVxVp996qhx1HPJYAuw= X-Received: by 2002:a17:906:15b:b0:9a1:a134:8cb4 with SMTP id 27-20020a170906015b00b009a1a1348cb4mr927969ejh.32.1694770871969; Fri, 15 Sep 2023 02:41:11 -0700 (PDT) Received: from m1x-phil.lan (176-131-223-129.abo.bbox.fr. [176.131.223.129]) by smtp.gmail.com with ESMTPSA id z15-20020a17090655cf00b00997d7aa59fasm2211850ejp.14.2023.09.15.02.41.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Sep 2023 02:41:11 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 3/6: 1/2] accel/tcg: Refactor gen_io_start() as set_can_do_io() Date: Fri, 15 Sep 2023 11:41:08 +0200 Message-ID: <20230915094109.82757-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230914174436.1597356-4-richard.henderson@linaro.org> References: <20230914174436.1597356-4-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=philmd@linaro.org; helo=mail-ej1-x630.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 Message-ID: <20230914174436.1597356-4-richard.henderson@linaro.org> [PMD: Split patch in 2, extracting set_can_do_io() first] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé --- accel/tcg/translator.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index b6ab9f3d33..cebf0a84cc 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -16,9 +16,9 @@ #include "tcg/tcg-op-common.h" #include "internal.h" -static void gen_io_start(void) +static void set_can_do_io(DisasContextBase *db, bool val) { - tcg_gen_st_i32(tcg_constant_i32(1), cpu_env, + tcg_gen_st_i32(tcg_constant_i32(val), cpu_env, offsetof(ArchCPU, parent_obj.can_do_io) - offsetof(ArchCPU, env)); } @@ -35,7 +35,7 @@ bool translator_io_start(DisasContextBase *db) return true; } - gen_io_start(); + set_can_do_io(db, true); /* * Ensure that this instruction will be the last in the TB. @@ -47,7 +47,7 @@ bool translator_io_start(DisasContextBase *db) return true; } -static TCGOp *gen_tb_start(uint32_t cflags) +static TCGOp *gen_tb_start(DisasContextBase *db, uint32_t cflags) { TCGv_i32 count = NULL; TCGOp *icount_start_insn = NULL; @@ -91,12 +91,9 @@ static TCGOp *gen_tb_start(uint32_t cflags) * 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(). + * translator. */ - tcg_gen_st_i32(tcg_constant_i32(0), cpu_env, - offsetof(ArchCPU, parent_obj.can_do_io) - - offsetof(ArchCPU, env)); + set_can_do_io(db, false); } return icount_start_insn; @@ -154,7 +151,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ /* Start translating. */ - icount_start_insn = gen_tb_start(cflags); + icount_start_insn = gen_tb_start(db, cflags); ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ @@ -181,7 +178,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, the next instruction. */ if (db->num_insns == db->max_insns && (cflags & CF_LAST_IO)) { /* Accept I/O on the last instruction. */ - gen_io_start(); + set_can_do_io(db, true); } ops->translate_insn(db, cpu);