Combined qemu-system -M none keeps SYS_EMU_TARGET_NONE, so target_cpu_type() is NULL. Skip the CPUClass lookup and leave MTTCG off instead of crashing in tcg_init_machine().
Signed-off-by: Yonggang Luo <[email protected]> --- accel/tcg/tcg-all.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 767e8805552..e44856f8304 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -107,8 +107,13 @@ static int tcg_init_machine(AccelState *as, MachineState *ms) unsigned max_threads = 1; #ifndef CONFIG_USER_ONLY - CPUClass *cc = CPU_CLASS(object_class_by_name(target_cpu_type())); - bool mttcg_supported = cc->tcg_ops->mttcg_supported; + /* + * Combined qemu-system -M none keeps SYS_EMU_TARGET_NONE, so + * target_cpu_type() is NULL. MTTCG defaults off. + */ + ObjectClass *oc = object_class_by_name(target_cpu_type()); + CPUClass *cc = oc ? CPU_CLASS(oc) : NULL; + bool mttcg_supported = cc && cc->tcg_ops && cc->tcg_ops->mttcg_supported; switch (s->mttcg_enabled) { case ON_OFF_AUTO_AUTO: -- 2.52.0.windows.1
