diff mbox series

[v8,17/17] accel/tcg: use current_machine as it is always set for softmmu

Message ID 20200916142004.27429-18-cfontana@suse.de
State New
Headers show
Series QEMU cpus.c refactoring part2 | expand

Commit Message

Claudio Fontana Sept. 16, 2020, 2:20 p.m. UTC
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(-)

Comments

Philippe Mathieu-Daudé Sept. 16, 2020, 3:24 p.m. UTC | #1
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 mbox series

Patch

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;
             }