From patchwork Sat Apr 5 16:13:17 2025 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: 878424 Delivered-To: patch@linaro.org Received: by 2002:a5d:6dae:0:b0:38f:210b:807b with SMTP id u14csp4289104wrs; Sat, 5 Apr 2025 09:15:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVPGeMznhKnJLk527dFARnomyI7pW7xrQI+aSjWr9TSSg3n+Q2JZ7WHI0xIOkkRdVu//EbS5A==@linaro.org X-Google-Smtp-Source: AGHT+IFIPLXZQuS7WVqnCzHHDFaYv3nI2Y/HBZ+BAC1B0dTXjybDTiurO9Yd+ENr45SVqBa33RKq X-Received: by 2002:ac8:574e:0:b0:476:60a1:3115 with SMTP id d75a77b69052e-479249a7bbcmr123647971cf.33.1743869742502; Sat, 05 Apr 2025 09:15:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1743869742; cv=none; d=google.com; s=arc-20240605; b=kDdJ4txSGnGeWa/FUshJko79r2CG74pAkZbKaqGJObGLYzZgBpdkSSMxl4b53t1Gq3 dyp1N1LRLo4s1Y87ABVYuNeAvKEhQkpe+YWO6QkJQLXj/YaAV65Nrirthby3KjdGeCWn 0DXGTZAAHtKJv2aOp6y6aN8wxZ9dOY6TdXRC1bDAe7huDG4OtkVaCwXcj5qMiJ7fnJ4o FkFf9laxzjC9TR+TTZsuRI0Euz5ZmJiudvV5KkxBZrWvol5r9dAqOTqpH862il1Fh+Xj hfUdbtPIqdTApUHgkE3OQxKtoHui2J5Dl8fOsn1tUYy8XaUzGmFePIMXLbQk1aoM1jEM eMxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=G/LTVfYsOIJ5re5/xeDsdKiBrQeXn6HocLb4nBW7R3Q=; fh=ewablq11zO+WL7X4n3MMOCnLV8HxPJyS9XF5ZM+AHaM=; b=QvfmvCGV8AaqGYj8L+uPODWrBaoU0f+mGQPg/Rox+f0sxTAxgQeRlySdvCfP5HEAtH fjmg4bs2nKOFU/+Aqz6IJ1izYhbCrZfTaXyGuRc+jhfzHNpOjW/uMA5A6+JyQtPSD1mi OY8DO8JHzRGXxygjPfvSPMOsm5AbgvFd+CniQNUjxxAcyIZZWWVrtUOeLh0VvjOuDKV6 JLSn/SEiMfty12LyCy/bzoYoQd1SpoMqv2hqp0UrtL4W1bRzbyDz6fBVCXps45Xg5gn7 fj/zz61+wSeqIAOW3vhONSnhknxIyUJFYgtW9vsQHVcilnWfqCjyOuxqb6gu2h26ZzDU H8nA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="gqf/1rff"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4791b077478si53128701cf.161.2025.04.05.09.15.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 05 Apr 2025 09:15: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="gqf/1rff"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u16AE-0001CW-2X; Sat, 05 Apr 2025 12:14:34 -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 1u16A8-00010U-Gn for qemu-devel@nongnu.org; Sat, 05 Apr 2025 12:14:29 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u16A6-0005IJ-MF for qemu-devel@nongnu.org; Sat, 05 Apr 2025 12:14:28 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-39c1efc457bso1760124f8f.2 for ; Sat, 05 Apr 2025 09:14:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1743869664; x=1744474464; 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=G/LTVfYsOIJ5re5/xeDsdKiBrQeXn6HocLb4nBW7R3Q=; b=gqf/1rffEbG3fBdaHZNEBsUSwuEGRxoI6+eYZlHwSicK2s6r49J0+vxdXs1YBNdvFY XAglZtH9ZCdSBOvAX1mXWkujoOQeXE9PNDPoXl+pb9pKzWSHFP0cGksUV0Tw/z1ky4za JGtZVvoO1VCIYBOPrxDeEVVylI90bRFj8sPoxUm7sIlbAtGDHKue9Bg9Ihoy9NPiuD3E ZNWaucWivGTRisxhW2+PbsQ63b2/qjVFk45pkl1tOGCMfwJ96+ezemEN1WppWm/ZKmyW Sld9nPsgmUGflIW5sHqPMVKCot2CbA1buegF8LeeQ9XHs8O92jBQ9gLxTKhx1ronHLDB Qm4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743869664; x=1744474464; 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=G/LTVfYsOIJ5re5/xeDsdKiBrQeXn6HocLb4nBW7R3Q=; b=Lrfv7dzS5m0e0NDlFxnW8jPiJRzVKgH4BkXyrgQDtr9n2yfvbo8FjEkaIeldIBgeCa sRAUr1ZIS1NPc6DPynWfbNeRkr4zeXhTZfmHbymOFC6LMcKxqxRkeojuPsc+w6DoJwrp vzUFWNNeLpeKCqvfVZBvcd6Meijver5IJ2FjBFmSk9Rb/BGbH4aHf8jfDgS3sJgIV9yI UyLXnSashdexBf5Ala2EBfcGO9IXJ64kE50dWi0qTz3NZkRbF1noPPh7Qu3qLjDU7cPa NfwHKbmmLn60uX16YZ9VIS8dE0kKZ0S0G530h2Fidsrwf8mFRvZNKfbUuVqwb1gFsQcD nE8g== X-Gm-Message-State: AOJu0YxOQ2hnt33lo6LDH3DimD4BoYjv5AcAQ1WhqisnhJJVfiLA2VyQ PrT4Ld+xINSikXHSKeX0H0/DAKuzkGldm2cp2jPAqv3SfOfmilkc72/nTeDx8X8Bg3mRfQ7EwRD J X-Gm-Gg: ASbGncuYOq8lq9FUvLzi5NXWACwf80Z+k63pl9XxcQHOWfG7nxLXUgo5dn9eDTxTlDg 1yWZY6xdjvCxjrXtaYGRjnI6i1i4ctbGyIil3n2Z3Hv+QFV7GyKyC5LfKVq3+PSM/t80Lcu6AfZ eiW/9oiIHrwPp1qay+6zkD1mTfmwYn24CUYXdUohsUxu7JfUBeqrBrLlz92ol9VI7CuxyUnFfj7 j3FWWvwAnZ5D5j56+hm3KJrLvhqJpf/yTE5/vynpjAp+4JipN1aZfxipq/6IxJYRKAWGrUADKRb Qg/KOHV0jifVSBv8Cz+fZEezWXQTapG1u1W2XnQQgNvxMTbxlSD1UHnGlie7PZ/Ik/z+gN+7NLQ N0P7fdIs038kUeBRK9zxkpB6a X-Received: by 2002:a05:6000:440e:b0:39c:266c:d82 with SMTP id ffacd0b85a97d-39cb3575971mr4271768f8f.10.1743869664362; Sat, 05 Apr 2025 09:14:24 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43ec17b3572sm80270355e9.39.2025.04.05.09.14.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 05 Apr 2025 09:14:22 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PATCH-for-10.1 v4 13/16] tcg: Move qemu_tcg_mttcg_enabled() to 'system/tcg.h' Date: Sat, 5 Apr 2025 18:13:17 +0200 Message-ID: <20250405161320.76854-14-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250405161320.76854-1-philmd@linaro.org> References: <20250405161320.76854-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.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 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é Reviewed-by: Pierrick Bouvier Reviewed-by: Richard Henderson --- include/hw/core/cpu.h | 9 --------- include/system/tcg.h | 8 ++++++++ accel/tcg/tcg-all.c | 16 ++++++++++++++-- target/riscv/tcg/tcg-cpu.c | 1 + tcg/region.c | 4 +++- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 10b6b25b344..c8d6abff19a 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -594,15 +594,6 @@ extern CPUTailQ cpus_queue; extern __thread CPUState *current_cpu; -/** - * 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 73229648c63..7622dcea302 100644 --- a/include/system/tcg.h +++ b/include/system/tcg.h @@ -17,4 +17,12 @@ extern bool tcg_allowed; #define tcg_enabled() 0 #endif +/** + * 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 a5a1fd6a11e..b8874430d30 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) +#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 } -bool mttcg_enabled; bool one_insn_per_tb; static int tcg_init_machine(MachineState *ms) @@ -107,10 +118,11 @@ static int tcg_init_machine(MachineState *ms) unsigned max_cpus = 1; #else unsigned max_cpus = ms->smp.max_cpus; + + mttcg_enabled = s->mttcg_enabled; #endif tcg_allowed = true; - mttcg_enabled = s->mttcg_enabled; page_init(); tb_htable_init(); diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index e146c76e6aa..44fdf6c4cf1 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 /* Hash that stores user set extensions */ diff --git a/tcg/region.c b/tcg/region.c index 478ec051c4b..56d2e988719 100644 --- a/tcg/region.c +++ b/tcg/region.c @@ -34,7 +34,9 @@ #include "exec/translation-block.h" #include "tcg-internal.h" #include "host/cpuinfo.h" - +#ifndef CONFIG_USER_ONLY +#include "system/tcg.h" +#endif /* * Local source-level compatibility with Unix.