Message ID | 20250112231344.34632-3-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw/riscv/virt: Remove unnecessary use of &first_cpu | expand |
On Mon, Jan 13, 2025 at 9:14 AM Philippe Mathieu-Daudé <philmd@linaro.org> wrote: > > virt_machine_init() creates the HARTs vCPUs, then later > virt_machine_done() calls create_fdt_sockets(), so the > latter has access to the first vCPU via: > > RISCVVirtState { > RISCVHartArrayState { > RISCVCPU *harts; > ... > > } soc[VIRT_SOCKETS_MAX]; > ... > > } s; > > Directly use that instead of the &first_cpu global. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > hw/riscv/virt.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c > index 9e8876be29b..241389d72f8 100644 > --- a/hw/riscv/virt.c > +++ b/hw/riscv/virt.c > @@ -750,7 +750,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap, > qemu_fdt_add_subnode(ms->fdt, "/cpus"); > qemu_fdt_setprop_cell(ms->fdt, "/cpus", "timebase-frequency", > kvm_enabled() ? > - kvm_riscv_get_timebase_frequency(RISCV_CPU(first_cpu)) : > + kvm_riscv_get_timebase_frequency(&s->soc->harts[0]) : > RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ); > qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#size-cells", 0x0); > qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#address-cells", 0x1); > -- > 2.47.1 > >
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 9e8876be29b..241389d72f8 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -750,7 +750,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap, qemu_fdt_add_subnode(ms->fdt, "/cpus"); qemu_fdt_setprop_cell(ms->fdt, "/cpus", "timebase-frequency", kvm_enabled() ? - kvm_riscv_get_timebase_frequency(RISCV_CPU(first_cpu)) : + kvm_riscv_get_timebase_frequency(&s->soc->harts[0]) : RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ); qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#size-cells", 0x0); qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#address-cells", 0x1);
virt_machine_init() creates the HARTs vCPUs, then later virt_machine_done() calls create_fdt_sockets(), so the latter has access to the first vCPU via: RISCVVirtState { RISCVHartArrayState { RISCVCPU *harts; ... } soc[VIRT_SOCKETS_MAX]; ... } s; Directly use that instead of the &first_cpu global. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/riscv/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)