diff mbox series

[02/23] hw/mips/malta: Check CPU index instead of using &first_cpu

Message ID 20250113004748.41658-3-philmd@linaro.org
State New
Headers show
Series hw/mips: Remove all uses of &first_cpu | expand

Commit Message

Philippe Mathieu-Daudé Jan. 13, 2025, 12:47 a.m. UTC
Since create_cpu_without_cps() creates the vCPUs iterating
up to the machine SMP count, it knows the first CPU is
created upon the first iteration, at index #0 :)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/mips/malta.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index 4e9cccaa347..37be2330eda 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -1042,12 +1042,13 @@  static void create_cpu_without_cps(MachineState *ms, MaltaState *s,
         cpu_mips_irq_init_cpu(cpu);
         cpu_mips_clock_init(cpu);
         qemu_register_reset(main_cpu_reset, cpu);
-    }
 
-    cpu = MIPS_CPU(first_cpu);
-    env = &cpu->env;
-    *i8259_irq = env->irq[2];
-    *cbus_irq = env->irq[4];
+        if (i == 0) {
+            env = &cpu->env;
+            *i8259_irq = env->irq[2];
+            *cbus_irq = env->irq[4];
+        }
+    }
 }
 
 static void create_cps(MachineState *ms, MaltaState *s,