[PATCH 01/13] riscv/virt: Fix address type in create_fdt_socket_clint

Joel Stanley posted 13 patches 6 months, 2 weeks ago
There is a newer version of this series
[PATCH 01/13] riscv/virt: Fix address type in create_fdt_socket_clint
Posted by Joel Stanley 6 months, 2 weeks ago
The address is a hardware address, so use hwaddr for consistency with
the rest of the machine.

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

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 17a790821484..e4c0ac8a2a9a 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -324,7 +324,7 @@ static void create_fdt_socket_clint(RISCVVirtState *s,
     int cpu;
     g_autofree char *clint_name = NULL;
     g_autofree uint32_t *clint_cells = NULL;
-    unsigned long clint_addr;
+    hwaddr clint_addr;
     MachineState *ms = MACHINE(s);
     static const char * const clint_compat[2] = {
         "sifive,clint0", "riscv,clint0"
@@ -340,8 +340,8 @@ static void create_fdt_socket_clint(RISCVVirtState *s,
     }
 
     clint_addr = s->memmap[VIRT_CLINT].base +
-                 (s->memmap[VIRT_CLINT].size * socket);
-    clint_name = g_strdup_printf("/soc/clint@%lx", clint_addr);
+                 s->memmap[VIRT_CLINT].size * socket;
+    clint_name = g_strdup_printf("/soc/clint@%"HWADDR_PRIx, clint_addr);
     qemu_fdt_add_subnode(ms->fdt, clint_name);
     qemu_fdt_setprop_string_array(ms->fdt, clint_name, "compatible",
                                   (char **)&clint_compat,
-- 
2.47.2
Re: [PATCH 01/13] riscv/virt: Fix address type in create_fdt_socket_clint
Posted by Daniel Henrique Barboza 6 months, 2 weeks ago

On 4/29/25 3:12 AM, Joel Stanley wrote:
> The address is a hardware address, so use hwaddr for consistency with
> the rest of the machine.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---

I believe you have 2 patches #1 in this series:

[PATCH 01/13] hw/riscv/virt: Fix clint base address type
[PATCH 01/13] riscv/virt: Fix address type in create_fdt_socket_clint

You probably renamed the commit subject to "hw/riscv/virt" and forgot to remove
the generated patch, since both patches do the same changes.

I believe we can ignore this patch and stick withe the first #1. Thanks,


Daniel



>   hw/riscv/virt.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 17a790821484..e4c0ac8a2a9a 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -324,7 +324,7 @@ static void create_fdt_socket_clint(RISCVVirtState *s,
>       int cpu;
>       g_autofree char *clint_name = NULL;
>       g_autofree uint32_t *clint_cells = NULL;
> -    unsigned long clint_addr;
> +    hwaddr clint_addr;
>       MachineState *ms = MACHINE(s);
>       static const char * const clint_compat[2] = {
>           "sifive,clint0", "riscv,clint0"
> @@ -340,8 +340,8 @@ static void create_fdt_socket_clint(RISCVVirtState *s,
>       }
>   
>       clint_addr = s->memmap[VIRT_CLINT].base +
> -                 (s->memmap[VIRT_CLINT].size * socket);
> -    clint_name = g_strdup_printf("/soc/clint@%lx", clint_addr);
> +                 s->memmap[VIRT_CLINT].size * socket;
> +    clint_name = g_strdup_printf("/soc/clint@%"HWADDR_PRIx, clint_addr);
>       qemu_fdt_add_subnode(ms->fdt, clint_name);
>       qemu_fdt_setprop_string_array(ms->fdt, clint_name, "compatible",
>                                     (char **)&clint_compat,
Re: [PATCH 01/13] riscv/virt: Fix address type in create_fdt_socket_clint
Posted by Joel Stanley 6 months, 2 weeks ago
On Tue, 29 Apr 2025 at 21:56, Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
>
>
> On 4/29/25 3:12 AM, Joel Stanley wrote:
> > The address is a hardware address, so use hwaddr for consistency with
> > the rest of the machine.
> >
> > Signed-off-by: Joel Stanley <joel@jms.id.au>
> > ---
>
> I believe you have 2 patches #1 in this series:
>
> [PATCH 01/13] hw/riscv/virt: Fix clint base address type
> [PATCH 01/13] riscv/virt: Fix address type in create_fdt_socket_clint
>
> You probably renamed the commit subject to "hw/riscv/virt" and forgot to remove
> the generated patch, since both patches do the same changes.
>
> I believe we can ignore this patch and stick withe the first #1. Thanks,

Guilty! Thanks for the close review.

You're correct, the first one is the correct one. I pushed a branch
here if it helps:

 https://gitlab.com/shenki/qemu/-/tree/riscv-dt-props-v1