Message ID | 20230111170948.316276-7-dbarboza@ventanamicro.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | riscv: create_fdt() related cleanups | expand |
On Thu, Jan 12, 2023 at 3:26 AM Daniel Henrique Barboza <dbarboza@ventanamicro.com> wrote: > > There's no need to use a MachineState pointer and a fdt pointer now that > all RISC-V machines are using the FDT from the MachineState. > > Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > hw/riscv/numa.c | 8 ++++---- > hw/riscv/spike.c | 2 +- > hw/riscv/virt.c | 2 +- > include/hw/riscv/numa.h | 4 ++-- > 4 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/hw/riscv/numa.c b/hw/riscv/numa.c > index f4343f5cde..4720102561 100644 > --- a/hw/riscv/numa.c > +++ b/hw/riscv/numa.c > @@ -164,7 +164,7 @@ void riscv_socket_fdt_write_id(const MachineState *ms, const char *node_name, > } > } > > -void riscv_socket_fdt_write_distance_matrix(const MachineState *ms, void *fdt) > +void riscv_socket_fdt_write_distance_matrix(const MachineState *ms) > { > int i, j, idx; > uint32_t *dist_matrix, dist_matrix_size; > @@ -184,10 +184,10 @@ void riscv_socket_fdt_write_distance_matrix(const MachineState *ms, void *fdt) > } > } > > - qemu_fdt_add_subnode(fdt, "/distance-map"); > - qemu_fdt_setprop_string(fdt, "/distance-map", "compatible", > + qemu_fdt_add_subnode(ms->fdt, "/distance-map"); > + qemu_fdt_setprop_string(ms->fdt, "/distance-map", "compatible", > "numa-distance-map-v1"); > - qemu_fdt_setprop(fdt, "/distance-map", "distance-matrix", > + qemu_fdt_setprop(ms->fdt, "/distance-map", "distance-matrix", > dist_matrix, dist_matrix_size); > g_free(dist_matrix); > } > diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c > index 05d34651cb..91bf194ec1 100644 > --- a/hw/riscv/spike.c > +++ b/hw/riscv/spike.c > @@ -174,7 +174,7 @@ static void create_fdt(SpikeState *s, const MemMapEntry *memmap, > g_free(clust_name); > } > > - riscv_socket_fdt_write_distance_matrix(mc, fdt); > + riscv_socket_fdt_write_distance_matrix(mc); > > qemu_fdt_add_subnode(fdt, "/chosen"); > qemu_fdt_setprop_string(fdt, "/chosen", "stdout-path", "/htif"); > diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c > index 1d3bd25cb5..e374b58f89 100644 > --- a/hw/riscv/virt.c > +++ b/hw/riscv/virt.c > @@ -805,7 +805,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap, > } > } > > - riscv_socket_fdt_write_distance_matrix(mc, mc->fdt); > + riscv_socket_fdt_write_distance_matrix(mc); > } > > static void create_fdt_virtio(RISCVVirtState *s, const MemMapEntry *memmap, > diff --git a/include/hw/riscv/numa.h b/include/hw/riscv/numa.h > index 634df6673f..8f5280211d 100644 > --- a/include/hw/riscv/numa.h > +++ b/include/hw/riscv/numa.h > @@ -100,9 +100,9 @@ void riscv_socket_fdt_write_id(const MachineState *ms, const char *node_name, > * @ms: pointer to machine state > * @socket_id: socket index > * > - * Write NUMA distance matrix in FDT for given machine > + * Write NUMA distance matrix in MachineState->fdt > */ > -void riscv_socket_fdt_write_distance_matrix(const MachineState *ms, void *fdt); > +void riscv_socket_fdt_write_distance_matrix(const MachineState *ms); > > CpuInstanceProperties > riscv_numa_cpu_index_to_props(MachineState *ms, unsigned cpu_index); > -- > 2.39.0 > >
diff --git a/hw/riscv/numa.c b/hw/riscv/numa.c index f4343f5cde..4720102561 100644 --- a/hw/riscv/numa.c +++ b/hw/riscv/numa.c @@ -164,7 +164,7 @@ void riscv_socket_fdt_write_id(const MachineState *ms, const char *node_name, } } -void riscv_socket_fdt_write_distance_matrix(const MachineState *ms, void *fdt) +void riscv_socket_fdt_write_distance_matrix(const MachineState *ms) { int i, j, idx; uint32_t *dist_matrix, dist_matrix_size; @@ -184,10 +184,10 @@ void riscv_socket_fdt_write_distance_matrix(const MachineState *ms, void *fdt) } } - qemu_fdt_add_subnode(fdt, "/distance-map"); - qemu_fdt_setprop_string(fdt, "/distance-map", "compatible", + qemu_fdt_add_subnode(ms->fdt, "/distance-map"); + qemu_fdt_setprop_string(ms->fdt, "/distance-map", "compatible", "numa-distance-map-v1"); - qemu_fdt_setprop(fdt, "/distance-map", "distance-matrix", + qemu_fdt_setprop(ms->fdt, "/distance-map", "distance-matrix", dist_matrix, dist_matrix_size); g_free(dist_matrix); } diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c index 05d34651cb..91bf194ec1 100644 --- a/hw/riscv/spike.c +++ b/hw/riscv/spike.c @@ -174,7 +174,7 @@ static void create_fdt(SpikeState *s, const MemMapEntry *memmap, g_free(clust_name); } - riscv_socket_fdt_write_distance_matrix(mc, fdt); + riscv_socket_fdt_write_distance_matrix(mc); qemu_fdt_add_subnode(fdt, "/chosen"); qemu_fdt_setprop_string(fdt, "/chosen", "stdout-path", "/htif"); diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 1d3bd25cb5..e374b58f89 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -805,7 +805,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap, } } - riscv_socket_fdt_write_distance_matrix(mc, mc->fdt); + riscv_socket_fdt_write_distance_matrix(mc); } static void create_fdt_virtio(RISCVVirtState *s, const MemMapEntry *memmap, diff --git a/include/hw/riscv/numa.h b/include/hw/riscv/numa.h index 634df6673f..8f5280211d 100644 --- a/include/hw/riscv/numa.h +++ b/include/hw/riscv/numa.h @@ -100,9 +100,9 @@ void riscv_socket_fdt_write_id(const MachineState *ms, const char *node_name, * @ms: pointer to machine state * @socket_id: socket index * - * Write NUMA distance matrix in FDT for given machine + * Write NUMA distance matrix in MachineState->fdt */ -void riscv_socket_fdt_write_distance_matrix(const MachineState *ms, void *fdt); +void riscv_socket_fdt_write_distance_matrix(const MachineState *ms); CpuInstanceProperties riscv_numa_cpu_index_to_props(MachineState *ms, unsigned cpu_index);
There's no need to use a MachineState pointer and a fdt pointer now that all RISC-V machines are using the FDT from the MachineState. Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> --- hw/riscv/numa.c | 8 ++++---- hw/riscv/spike.c | 2 +- hw/riscv/virt.c | 2 +- include/hw/riscv/numa.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-)