[PATCH 03/13] hw/riscv/virt: Use setprop_sized_cells for memory

Joel Stanley posted 13 patches 6 months, 2 weeks ago
There is a newer version of this series
[PATCH 03/13] hw/riscv/virt: Use setprop_sized_cells for memory
Posted by Joel Stanley 6 months, 2 weeks ago
Use qemu_fdt_setprop_sized_cells to do the job of splitting the upper
and lower 32 bits across cells.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 hw/riscv/virt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 873d41d10c70..ed28bc06114a 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -311,8 +311,7 @@ static void create_fdt_socket_memory(RISCVVirtState *s, int socket)
     size = riscv_socket_mem_size(ms, socket);
     mem_name = g_strdup_printf("/memory@%"PRIx64, addr);
     qemu_fdt_add_subnode(ms->fdt, mem_name);
-    qemu_fdt_setprop_cells(ms->fdt, mem_name, "reg",
-        addr >> 32, addr, size >> 32, size);
+    qemu_fdt_setprop_sized_cells(ms->fdt, mem_name, "reg", 2, addr, 2, size);
     qemu_fdt_setprop_string(ms->fdt, mem_name, "device_type", "memory");
     riscv_socket_fdt_write_id(ms, mem_name, socket);
 }
-- 
2.47.2
Re: [PATCH 03/13] hw/riscv/virt: Use setprop_sized_cells for memory
Posted by Daniel Henrique Barboza 6 months, 2 weeks ago

On 4/29/25 3:12 AM, Joel Stanley wrote:
> Use qemu_fdt_setprop_sized_cells to do the job of splitting the upper
> and lower 32 bits across cells.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---

Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

>   hw/riscv/virt.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 873d41d10c70..ed28bc06114a 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -311,8 +311,7 @@ static void create_fdt_socket_memory(RISCVVirtState *s, int socket)
>       size = riscv_socket_mem_size(ms, socket);
>       mem_name = g_strdup_printf("/memory@%"PRIx64, addr);
>       qemu_fdt_add_subnode(ms->fdt, mem_name);
> -    qemu_fdt_setprop_cells(ms->fdt, mem_name, "reg",
> -        addr >> 32, addr, size >> 32, size);
> +    qemu_fdt_setprop_sized_cells(ms->fdt, mem_name, "reg", 2, addr, 2, size);
>       qemu_fdt_setprop_string(ms->fdt, mem_name, "device_type", "memory");
>       riscv_socket_fdt_write_id(ms, mem_name, socket);
>   }