diff mbox series

[07/11] hw/mips/loongson3_virt: Propagate cpu_count to init_boot_param()

Message ID 20250112215835.29320-8-philmd@linaro.org
State Superseded
Headers show
Series hw/mips/loongson3: Remove uses of &first_cpu global | expand

Commit Message

Philippe Mathieu-Daudé Jan. 12, 2025, 9:58 p.m. UTC
Remove one use of the 'current_machine' global.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/mips/loongson3_virt.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Richard Henderson Jan. 15, 2025, 5:13 a.m. UTC | #1
On 1/12/25 13:58, Philippe Mathieu-Daudé wrote:
> Remove one use of the 'current_machine' global.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/mips/loongson3_virt.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

> 
> diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
> index af1937455b0..a240662016b 100644
> --- a/hw/mips/loongson3_virt.c
> +++ b/hw/mips/loongson3_virt.c
> @@ -173,7 +173,7 @@ static uint64_t get_cpu_freq_hz(const MIPSCPU *cpu)
>       return DEF_LOONGSON3_FREQ;
>   }
>   
> -static void init_boot_param(void)
> +static void init_boot_param(unsigned cpu_count)
>   {
>       static void *p;
>       struct boot_params *bp;
> @@ -184,8 +184,7 @@ static void init_boot_param(void)
>       bp->efi.smbios.vers = cpu_to_le16(1);
>       init_reset_system(&(bp->reset_system));
>       p += ROUND_UP(sizeof(struct boot_params), 64);
> -    init_loongson_params(&(bp->efi.smbios.lp), p,
> -                         current_machine->smp.cpus,
> +    init_loongson_params(&(bp->efi.smbios.lp), p, cpu_count,
>                            loaderparams.cpu_freq, loaderparams.ram_size);
>   
>       rom_add_blob_fixed("params_rom", bp,
> @@ -645,7 +644,7 @@ static void mips_loongson3_virt_init(MachineState *machine)
>           loaderparams.kernel_entry = load_kernel(&cpus[0]->env);
>   
>           init_boot_rom();
> -        init_boot_param();
> +        init_boot_param(machine->smp.cpus);
>       } else {
>           filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
>                                     machine->firmware ?: LOONGSON3_BIOSNAME);
diff mbox series

Patch

diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index af1937455b0..a240662016b 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -173,7 +173,7 @@  static uint64_t get_cpu_freq_hz(const MIPSCPU *cpu)
     return DEF_LOONGSON3_FREQ;
 }
 
-static void init_boot_param(void)
+static void init_boot_param(unsigned cpu_count)
 {
     static void *p;
     struct boot_params *bp;
@@ -184,8 +184,7 @@  static void init_boot_param(void)
     bp->efi.smbios.vers = cpu_to_le16(1);
     init_reset_system(&(bp->reset_system));
     p += ROUND_UP(sizeof(struct boot_params), 64);
-    init_loongson_params(&(bp->efi.smbios.lp), p,
-                         current_machine->smp.cpus,
+    init_loongson_params(&(bp->efi.smbios.lp), p, cpu_count,
                          loaderparams.cpu_freq, loaderparams.ram_size);
 
     rom_add_blob_fixed("params_rom", bp,
@@ -645,7 +644,7 @@  static void mips_loongson3_virt_init(MachineState *machine)
         loaderparams.kernel_entry = load_kernel(&cpus[0]->env);
 
         init_boot_rom();
-        init_boot_param();
+        init_boot_param(machine->smp.cpus);
     } else {
         filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
                                   machine->firmware ?: LOONGSON3_BIOSNAME);