From: Richard Henderson Date: Sat, 5 Apr 2025 01:52:36 +0000 (-0700) Subject: accel/tcg: Move mttcg warning to tcg_init_machine X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=84cde4af081b9fa9c0fc82d3f1a8da406b4ba9e4;p=thirdparty%2Fqemu.git accel/tcg: Move mttcg warning to tcg_init_machine Delay the warning to tcg_init_machine, because we will have resolved the CPUClass at that point. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index fa77a4c5a2..ecdd48847c 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -93,7 +93,8 @@ static int tcg_init_machine(MachineState *ms) # else bool mttcg_supported = false; # endif - if (s->mttcg_enabled == ON_OFF_AUTO_AUTO) { + switch (s->mttcg_enabled) { + case ON_OFF_AUTO_AUTO: /* * We default to false if we know other options have been enabled * which are currently incompatible with MTTCG. Otherwise when each @@ -108,12 +109,22 @@ static int tcg_init_machine(MachineState *ms) */ if (mttcg_supported && !icount_enabled()) { s->mttcg_enabled = ON_OFF_AUTO_ON; + max_threads = ms->smp.max_cpus; } else { s->mttcg_enabled = ON_OFF_AUTO_OFF; } - } - if (s->mttcg_enabled == ON_OFF_AUTO_ON) { + break; + case ON_OFF_AUTO_ON: + if (!mttcg_supported) { + warn_report("Guest not yet converted to MTTCG - " + "you may get unexpected results"); + } max_threads = ms->smp.max_cpus; + break; + case ON_OFF_AUTO_OFF: + break; + default: + g_assert_not_reached(); } #endif @@ -153,10 +164,6 @@ static void tcg_set_thread(Object *obj, const char *value, Error **errp) if (icount_enabled()) { error_setg(errp, "No MTTCG when icount is enabled"); } else { -#ifndef TARGET_SUPPORTS_MTTCG - warn_report("Guest not yet converted to MTTCG - " - "you may get unexpected results"); -#endif s->mttcg_enabled = ON_OFF_AUTO_ON; } } else if (strcmp(value, "single") == 0) {