diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-01-12 21:42:10 +0100 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-01-31 19:36:43 +0100 |
commit | 72a4da938680edeef2be454a67c0f7db22176a2d (patch) | |
tree | 089ad16d513ef21b3f0a8e1ffbc4f6e7193b6c9e | |
parent | 87fd8a80c734781865318d7d511e735b6f49f8c3 (diff) | |
download | qemu-72a4da938680edeef2be454a67c0f7db22176a2d.zip qemu-72a4da938680edeef2be454a67c0f7db22176a2d.tar.gz qemu-72a4da938680edeef2be454a67c0f7db22176a2d.tar.bz2 |
hw/mips/loongson3_virt: Pass CPU argument to get_cpu_freq_hz()
Pass the first vCPU as argument, allowing to remove
another &first_cpu global use.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250115232952.31166-5-philmd@linaro.org>
-rw-r--r-- | hw/mips/loongson3_virt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 45a524c..9f6fdd0 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -153,7 +153,7 @@ static const MemoryRegionOps loongson3_pm_ops = { #define DEF_LOONGSON3_FREQ (800 * 1000 * 1000) -static uint64_t get_cpu_freq_hz(void) +static uint64_t get_cpu_freq_hz(const MIPSCPU *cpu) { #ifdef CONFIG_KVM int ret; @@ -164,7 +164,7 @@ static uint64_t get_cpu_freq_hz(void) }; if (kvm_enabled()) { - ret = kvm_vcpu_ioctl(first_cpu, KVM_GET_ONE_REG, &freq_reg); + ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_ONE_REG, &freq_reg); if (ret >= 0) { return freq * 2; } @@ -633,7 +633,7 @@ static void mips_loongson3_virt_init(MachineState *machine) * Please use -L to set the BIOS path and -bios to set bios name. */ - loaderparams.cpu_freq = get_cpu_freq_hz(); + loaderparams.cpu_freq = get_cpu_freq_hz(cpu); loaderparams.ram_size = ram_size; if (kernel_filename) { loaderparams.kernel_filename = kernel_filename; |