From nobody Thu Oct 16 04:35:00 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1745352662; cv=none; d=zohomail.com; s=zohoarc; b=PD5huDzIecO3GQvybXzpiHyYUYeruXc/5t45PiRACZ4fQ7dc/XI7HMmM5BT7+M00waDqKM19+Y9viO+PkduT7HfIbqADeWimxcUNuR9RuQKnFjmtBccue1q72V9AxSrAJFInbqB3aR0s0kya23TgfV8AfGD3AoS4B8T8NEd52nU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745352662; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Lgi2ZSVQ13wT2MCsVR2Sol/xGooWiIWNyPhzHZZ9Q0k=; b=S9hD7Ob9LT+GUd1kDqOhG2kh7uyPLIROSCg6AVyk58mekWeCXP3BNFCysSpSTykAJ4UICv+E+MOMoXFkz1F4pG1PegJIrDfcVQ4T75PJbc4Pi596mCYrKnKwFMGIP3H74mQY/zRFeIp49Id9f+lZtCNRvOvdEhnrRN/anfkgAAQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17453526621491000.1534847558196; Tue, 22 Apr 2025 13:11:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u7JT9-0006Vh-GZ; Tue, 22 Apr 2025 15:39:47 -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 1u7JSN-0004Kd-I3 for qemu-devel@nongnu.org; Tue, 22 Apr 2025 15:39:02 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u7JSK-0007NM-2e for qemu-devel@nongnu.org; Tue, 22 Apr 2025 15:38:58 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-2254e0b4b79so85309145ad.2 for ; Tue, 22 Apr 2025 12:38:55 -0700 (PDT) Received: from stoup.. (71-212-47-143.tukw.qwest.net. [71.212.47.143]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22c50eb484dsm88951765ad.148.2025.04.22.12.38.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 12:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745350734; x=1745955534; 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=Lgi2ZSVQ13wT2MCsVR2Sol/xGooWiIWNyPhzHZZ9Q0k=; b=V9NV6X2gO9YPyy1sIz1UgClUCoovnkHdJjQ4Cb+t+z7MsFQssdm/EWdzO40/2fLerP Mhz6o+YtybiPJnjFiActyGNxE1lS59L40UWWBnbZFe1gGg/uIIevAAk7eQrTjgKKNjJQ lgU/0LJhhdLN69Z7WYcXk4qtBe/JqO7hEza6a4zF9+thCGU6+dqDkOv8DH9gTsdDSjOL btcXURLRE5l/4l6+1/ggcsiebKhUzeo/DTdqyRHbuycEz4+GsHvjKHmjEzK04p8MaGRK 1w70ItkOLdq30sr2lPgsk9ByqyjFIzvnpaa7gX8wU8/wNWHrrKBm35dnHTXX6ivKGwLQ VO2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745350734; x=1745955534; 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=Lgi2ZSVQ13wT2MCsVR2Sol/xGooWiIWNyPhzHZZ9Q0k=; b=P7INJ0d17osGAbogwP1C7fqkUkSWpAxKb3YLcmapoiBFZUigLN+TQzWby6MZmNl8BQ aL+NUrjTkpDlVx88iyrYv4JffdhHG5qCcWykMuQ0Uv+8JqwN8MzMlUHh94ibDooMAyRb vmHA9/axGifx9Ldso5ECdaKRQGHdc8/ZAhek3LUuVF37/j4YuRD4ymqV1UMUu6BEW9Ae Vp+2fVoPS3aWrvOwjp0kJ9xQJmhBCbXACw0FAnFKVWhBJXWP88TFYczzzeK/AsoXtHHM AnyD9rcbrPqRNFIayP0o9c+4RULTAxCdhe+Wy3qBafwjhWfmETs3i5Pu5Yh3KIFbvipT DvLg== X-Gm-Message-State: AOJu0YwVdHFaf6CG+7df0qMow4K1o/3rE8edSLd/ZRINPJwfCtU0uoHM avVst8UsDsORqwMEIlE9CSe7sR+2Vbhr6cYjLhS7MGYg8Pzzq/HN8L6eFxVC4JiC6g5qbdBe+e4 8 X-Gm-Gg: ASbGncuIK/LBQz6Ee/SpuIxg+HZrzzH8MwIHa8BdzyPNkT09PA84WmM7JRksy+912X/ KVRdou4ofmXh1fWNEksTvmjNS1mY+0K6/jVhhGrlCD+F4DWtovPnKhFaXlawmLkvthfdQ1Xizcg ya2JCQgEg0LT9jPj38SovZ3nqyF8lNno0hKRxYUXbhF/JrsONdZ0kZzsfiP4RRf9MuEijMeZB9N dmTtgpfhMU/eERt2cTt15YreBqBF7kY+mVttCuRJZfdLJtNytRuMhktbevzXfTtHCzwZSXdNNYy UPaWmJbiImNg6I4rant9gVLmVIa1S8ki32bDewOsIHWdAmhRVzJ9gMtKfVJD0cz8UAe2020EfM8 = X-Google-Smtp-Source: AGHT+IGr+gExjmgnV7yjdS5opKkbSYL+ooMSYnyKBhvKwkj+sNHat9/zjcOC6/XzXYh52nRO0x8s6g== X-Received: by 2002:a17:902:e808:b0:223:8256:533d with SMTP id d9443c01a7336-22c536207d3mr243061725ad.46.1745350734114; Tue, 22 Apr 2025 12:38:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PATCH 141/147] tcg: Move qemu_tcg_mttcg_enabled() to 'system/tcg.h' Date: Tue, 22 Apr 2025 12:28:10 -0700 Message-ID: <20250422192819.302784-142-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250422192819.302784-1-richard.henderson@linaro.org> References: <20250422192819.302784-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1745352664036019100 From: Philippe Mathieu-Daud=C3=A9 qemu_tcg_mttcg_enabled() is specific to 1/ TCG and 2/ system emulation. Move the prototype declaration to "system/tcg.h", reducing 'mttcg_enabled' variable scope. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier Reviewed-by: Richard Henderson Message-ID: <20250403220420.78937-17-philmd@linaro.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 9 --------- include/system/tcg.h | 8 ++++++++ accel/tcg/tcg-all.c | 17 ++++++++++++++--- target/riscv/tcg/tcg-cpu.c | 1 + 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 10b6b25b34..c8d6abff19 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -594,15 +594,6 @@ extern CPUTailQ cpus_queue; =20 extern __thread CPUState *current_cpu; =20 -/** - * qemu_tcg_mttcg_enabled: - * Check whether we are running MultiThread TCG or not. - * - * Returns: %true if we are in MTTCG mode %false otherwise. - */ -extern bool mttcg_enabled; -#define qemu_tcg_mttcg_enabled() (mttcg_enabled) - /** * cpu_paging_enabled: * @cpu: The CPU whose state is to be inspected. diff --git a/include/system/tcg.h b/include/system/tcg.h index 73229648c6..7622dcea30 100644 --- a/include/system/tcg.h +++ b/include/system/tcg.h @@ -17,4 +17,12 @@ extern bool tcg_allowed; #define tcg_enabled() 0 #endif =20 +/** + * qemu_tcg_mttcg_enabled: + * Check whether we are running MultiThread TCG or not. + * + * Returns: %true if we are in MTTCG mode %false otherwise. + */ +bool qemu_tcg_mttcg_enabled(void); + #endif diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 3efc7350eb..bb759cec07 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -38,6 +38,7 @@ #include "hw/qdev-core.h" #else #include "hw/boards.h" +#include "system/tcg.h" #endif #include "internal-common.h" #include "cpu-param.h" @@ -58,6 +59,17 @@ typedef struct TCGState TCGState; DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE, TYPE_TCG_ACCEL) =20 +#ifndef CONFIG_USER_ONLY + +static bool mttcg_enabled; + +bool qemu_tcg_mttcg_enabled(void) +{ + return mttcg_enabled; +} + +#endif /* !CONFIG_USER_ONLY */ + /* * We default to false if we know other options have been enabled * which are currently incompatible with MTTCG. Otherwise when each @@ -97,7 +109,6 @@ static void tcg_accel_instance_init(Object *obj) #endif } =20 -bool mttcg_enabled; bool one_insn_per_tb; =20 static int tcg_init_machine(MachineState *ms) @@ -106,14 +117,14 @@ static int tcg_init_machine(MachineState *ms) unsigned max_threads =3D 1; =20 tcg_allowed =3D true; - mttcg_enabled =3D s->mttcg_enabled; =20 page_init(); tb_htable_init(); =20 #ifndef CONFIG_USER_ONLY - if (mttcg_enabled) { + if (s->mttcg_enabled) { max_threads =3D ms->smp.max_cpus; + mttcg_enabled =3D true; } #endif tcg_init(s->tb_size * MiB, s->splitwx_enabled, max_threads); diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 50e81b2e52..88f7cdb887 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -36,6 +36,7 @@ #include "tcg/tcg.h" #ifndef CONFIG_USER_ONLY #include "hw/boards.h" +#include "system/tcg.h" #endif =20 /* Hash that stores user set extensions */ --=20 2.43.0