Message ID | 20250321155925.96626-3-philmd@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | tcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field | expand |
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 > + > /* > * We default to false if we know other options have been enabled > * which are currently incompatible with MTTCG. Otherwise when each > @@ -97,7 +107,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) > diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c > index 60a26acc503..5ccd7b9dc07 100644 > --- a/target/riscv/tcg/tcg-cpu.c > +++ b/target/riscv/tcg/tcg-cpu.c > @@ -35,6 +35,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. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
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 + /* * We default to false if we know other options have been enabled * which are currently incompatible with MTTCG. Otherwise when each @@ -97,7 +107,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) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 60a26acc503..5ccd7b9dc07 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -35,6 +35,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.
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(-)