qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: Anton Johansson <anjo@rev.ng>,
	Pierrick Bouvier <pierrick.bouvier@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH-for-10.1 2/4] tcg: Move qemu_tcg_mttcg_enabled() to 'system/tcg.h'
Date: Sun, 23 Mar 2025 11:36:13 -0700	[thread overview]
Message-ID: <9e31c172-0474-4254-8fe7-96eaa517ddac@linaro.org> (raw)
In-Reply-To: <20250321155925.96626-3-philmd@linaro.org>

On 3/21/25 08:59, Philippe Mathieu-Daudé wrote:
> 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é <philmd@linaro.org>
> ---
>   include/hw/core/cpu.h      |  9 ---------
>   include/system/tcg.h       |  8 ++++++++
>   accel/tcg/tcg-all.c        | 11 ++++++++++-
>   target/riscv/tcg/tcg-cpu.c |  1 +
>   tcg/region.c               |  4 +++-
>   5 files changed, 22 insertions(+), 11 deletions(-)
> 
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 5d11d26556a..54570d21aea 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -597,15 +597,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 cb632cc8cc7..d75ecf531b6 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,15 @@ typedef struct TCGState TCGState;
>   DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE,
>                            TYPE_TCG_ACCEL)
>   
> +static bool mttcg_enabled;
> +
> +#ifndef CONFIG_USER_ONLY
> +bool qemu_tcg_mttcg_enabled(void)
> +{
> +    return mttcg_enabled;
> +}
> +#endif

It would appear (and it makes sense) that mttcg_enabled is only set for user-mode.  I 
think you should be conditionalizing the variable for system mode as well.


r~


  parent reply	other threads:[~2025-03-23 18:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 15:59 [PATCH-for-10.1 0/4] tcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field Philippe Mathieu-Daudé
2025-03-21 15:59 ` [PATCH-for-10.1 1/4] target/riscv: Restrict RV128 MTTCG check on system emulation Philippe Mathieu-Daudé
2025-03-21 17:32   ` Pierrick Bouvier
2025-03-23 18:08   ` Richard Henderson
2025-04-02 14:25     ` Philippe Mathieu-Daudé
2025-04-02 14:40       ` Philippe Mathieu-Daudé
2025-04-04  3:22         ` Alistair Francis
2025-03-21 15:59 ` [PATCH-for-10.1 2/4] tcg: Move qemu_tcg_mttcg_enabled() to 'system/tcg.h' Philippe Mathieu-Daudé
2025-03-21 17:33   ` Pierrick Bouvier
2025-03-23 18:36   ` Richard Henderson [this message]
2025-03-21 15:59 ` [PATCH-for-10.1 3/4] tcg: Convert TCGState::mttcg_enabled to TriState Philippe Mathieu-Daudé
2025-03-21 17:01   ` Anton Johansson via
2025-03-21 17:45     ` Philippe Mathieu-Daudé
2025-03-21 17:36   ` Pierrick Bouvier
2025-03-21 18:26     ` Philippe Mathieu-Daudé
2025-03-21 18:33       ` Pierrick Bouvier
2025-03-23 18:43   ` Richard Henderson
2025-04-02 21:12     ` Philippe Mathieu-Daudé
2025-03-21 15:59 ` [PATCH-for-10.1 4/4] tcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field Philippe Mathieu-Daudé
2025-03-21 16:41   ` Anton Johansson via
2025-03-21 17:43   ` Pierrick Bouvier
2025-03-23 19:07   ` Richard Henderson
2025-03-23 21:24     ` Philippe Mathieu-Daudé
2025-03-23 22:13       ` BALATON Zoltan
2025-03-23 22:17         ` Richard Henderson
2025-03-23 22:49           ` BALATON Zoltan
2025-03-24 16:39             ` Philippe Mathieu-Daudé
2025-03-23 23:15         ` Philippe Mathieu-Daudé
2025-03-21 16:00 ` [PATCH-for-10.1 0/4] " Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e31c172-0474-4254-8fe7-96eaa517ddac@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=anjo@rev.ng \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).