accel/tcg: use current_machine as it is always set for softmmu
authorClaudio Fontana <cfontana@suse.de>
Tue, 8 Sep 2020 08:59:07 +0000 (10:59 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 5 Oct 2020 14:41:22 +0000 (16:41 +0200)
current_machine is always set before accelerators are initialized,
so use that instead of MACHINE(qdev_get_machine()).

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
accel/tcg/tcg-cpus.c

index cedd1e6c4ffabf8f838f3e4b78db4e9085cb180b..da1c63d8f60802da2137fa0e55656a423f0bbd4a 100644 (file)
@@ -479,16 +479,7 @@ static void tcg_start_vcpu_thread(CPUState *cpu)
     if (!tcg_region_inited) {
         tcg_region_inited = 1;
         tcg_region_init();
-        /*
-         * If MTTCG, and we will create multiple cpus,
-         * then we will have cpus running in parallel.
-         */
-        if (qemu_tcg_mttcg_enabled()) {
-            MachineState *ms = MACHINE(qdev_get_machine());
-            if (ms->smp.max_cpus > 1) {
-                parallel_cpus = true;
-            }
-        }
+        parallel_cpus = qemu_tcg_mttcg_enabled() && current_machine->smp.max_cpus > 1;
     }
 
     if (qemu_tcg_mttcg_enabled() || !single_tcg_cpu_thread) {