diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-01-12 21:01:24 +0100 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-01-31 19:36:42 +0100 |
commit | 2bf8545603e3388c33745b41dc797fef7b2224aa (patch) | |
tree | 6309ab956ac8739f2adb179c57a7c8ed6b06b486 | |
parent | 6286423b8bae2dafb5209a2e45d3ad30d75d146d (diff) | |
download | qemu-2bf8545603e3388c33745b41dc797fef7b2224aa.zip qemu-2bf8545603e3388c33745b41dc797fef7b2224aa.tar.gz qemu-2bf8545603e3388c33745b41dc797fef7b2224aa.tar.bz2 |
hw/mips/loongson3_virt: Invert vCPU creation order to remove &first_cpu
Create vCPUs from the last one to the first one.
No need to use the &first_cpu global since we already
have it referenced.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250115232952.31166-3-philmd@linaro.org>
-rw-r--r-- | hw/mips/loongson3_virt.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 47d1129..28d4eaf 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -492,9 +492,8 @@ static void mips_loongson3_virt_init(MachineState *machine) { int i; long bios_size; - MIPSCPU *cpu; + MIPSCPU *cpu = NULL; Clock *cpuclk; - CPUMIPSState *env; DeviceState *liointc; DeviceState *ipi = NULL; char *filename; @@ -569,7 +568,7 @@ static void mips_loongson3_virt_init(MachineState *machine) cpuclk = clock_new(OBJECT(machine), "cpu-refclk"); clock_set_hz(cpuclk, DEF_LOONGSON3_FREQ); - for (i = 0; i < machine->smp.cpus; i++) { + for (i = machine->smp.cpus - 1; i >= 0; --i) { int node = i / LOONGSON3_CORE_PER_NODE; int core = i % LOONGSON3_CORE_PER_NODE; int ip; @@ -609,7 +608,7 @@ static void mips_loongson3_virt_init(MachineState *machine) pin, cpu->env.irq[ip + 2]); } } - env = &MIPS_CPU(first_cpu)->env; + assert(cpu); /* This variable points to the first created cpu. */ /* Allocate RAM/BIOS, 0x00000000~0x10000000 is alias of 0x80000000~0x90000000 */ memory_region_init_rom(bios, NULL, "loongson3.bios", @@ -640,7 +639,7 @@ static void mips_loongson3_virt_init(MachineState *machine) loaderparams.kernel_filename = kernel_filename; loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; - loaderparams.kernel_entry = load_kernel(env); + loaderparams.kernel_entry = load_kernel(&cpu->env); init_boot_rom(); init_boot_param(); |