Message ID | 20200916142004.27429-18-cfontana@suse.de |
---|---|
State | New |
Headers | show |
Series | QEMU cpus.c refactoring part2 | expand |
On 9/16/20 4:20 PM, Claudio Fontana wrote: > 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> > --- > accel/tcg/tcg-cpus.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/accel/tcg/tcg-cpus.c b/accel/tcg/tcg-cpus.c > index ec7158b55e..05af1168a2 100644 > --- a/accel/tcg/tcg-cpus.c > +++ b/accel/tcg/tcg-cpus.c > @@ -484,7 +484,7 @@ static void tcg_start_vcpu_thread(CPUState *cpu) > * then we will have cpus running in parallel. > */ > if (qemu_tcg_mttcg_enabled()) { > - MachineState *ms = MACHINE(qdev_get_machine()); > + MachineState *ms = current_machine; > if (ms->smp.max_cpus > 1) { What about simply using: if (current_machine->smp.max_cpus > 1) { > parallel_cpus = true; > } > Regardless: Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff --git a/accel/tcg/tcg-cpus.c b/accel/tcg/tcg-cpus.c index ec7158b55e..05af1168a2 100644 --- a/accel/tcg/tcg-cpus.c +++ b/accel/tcg/tcg-cpus.c @@ -484,7 +484,7 @@ static void tcg_start_vcpu_thread(CPUState *cpu) * then we will have cpus running in parallel. */ if (qemu_tcg_mttcg_enabled()) { - MachineState *ms = MACHINE(qdev_get_machine()); + MachineState *ms = current_machine; if (ms->smp.max_cpus > 1) { parallel_cpus = true; }
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> --- accel/tcg/tcg-cpus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)