From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
To: Joel Stanley <joel@jms.id.au>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
alistair.francis@wdc.com, liwei1518@gmail.com,
zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com
Subject: Re: [PATCH 9/9] hw/riscv/virt.c: remove 'long' casts in fmt strings
Date: Tue, 29 Apr 2025 14:11:39 -0300 [thread overview]
Message-ID: <45b9b66d-1aa7-47da-9458-04ab726d5aae@ventanamicro.com> (raw)
In-Reply-To: <d404d535-fc04-43ac-a7a7-2f216cad993c@ventanamicro.com>
On 4/29/25 9:40 AM, Daniel Henrique Barboza wrote:
> Joel,
>
> I'll make these changes in this patch to be consistent with what we've
> been discussing:
>
> - change addr to hwaddr
> - use HWADDR_PRIx instead of PRIx64
>
> i.e. this diff:
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 1eae84db15..0020d8f404 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -303,12 +303,13 @@ static void create_fdt_socket_cpus(RISCVVirtState *s, int socket,
> static void create_fdt_socket_memory(RISCVVirtState *s, int socket)
> {
> g_autofree char *mem_name = NULL;
> - uint64_t addr, size;
> + hwaddr addr;
> + uint64_t size;
> MachineState *ms = MACHINE(s);
>
> addr = s->memmap[VIRT_DRAM].base + riscv_socket_mem_offset(ms, socket);
> size = riscv_socket_mem_size(ms, socket);
> - mem_name = g_strdup_printf("/memory@%"PRIx64, addr);
> + mem_name = g_strdup_printf("/memory@%"HWADDR_PRIx, addr);
> qemu_fdt_add_subnode(ms->fdt, mem_name);
> qemu_fdt_setprop_cells(ms->fdt, mem_name, "reg",
> addr >> 32, addr, size >> 32, size);
>
>
> I did this change and applied your "hw/riscv/virt: device tree reg cleanups" series on top
> of it, and there are no conflicts. No change needed in your side.
It seems I was wrong. The v2 will conflict with your patch 03. I think a rebase from
your series can't be avoided ...
Daniel
>
>
> Thanks,
>
> Daniel
>
>
>
> On 4/24/25 6:41 AM, Joel Stanley wrote:
>> On Wed, 23 Apr 2025 at 20:39, Daniel Henrique Barboza
>> <dbarboza@ventanamicro.com> wrote:
>>>
>>> We can avoid the 'long' casts by using PRIx64 and HWADDR_PRIx on the fmt
>>> strings for uint64_t and hwaddr types.
>>>
>>> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
>>> ---
>>> hw/riscv/virt.c | 29 +++++++++++++++--------------
>>> 1 file changed, 15 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
>>> index 036a0a9bfb..075c035f25 100644
>>> --- a/hw/riscv/virt.c
>>> +++ b/hw/riscv/virt.c
>>> @@ -309,7 +309,7 @@ static void create_fdt_socket_memory(RISCVVirtState *s, int socket)
>>>
>>> addr = s->memmap[VIRT_DRAM].base + riscv_socket_mem_offset(ms, socket);
>>> size = riscv_socket_mem_size(ms, socket);
>>> - mem_name = g_strdup_printf("/memory@%lx", (long)addr);
>>> + mem_name = g_strdup_printf("/memory@%"PRIx64, addr);
>>
>> I wondered why this wasn't a HWADDR_PRIx.
>>
>> addr (and NodeInfo::node_mem?) could be a hwaddr? That would make
>> everything more consistent.
>>
>> Cheers,
>>
>> Joel
>
next prev parent reply other threads:[~2025-04-29 17:12 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 11:06 [PATCH 0/9] hw/riscv/virt.c: memmap usage cleanup Daniel Henrique Barboza
2025-04-23 11:06 ` [PATCH 1/9] hw/riscv/virt.c: enforce s->memmap use in machine_init() Daniel Henrique Barboza
2025-04-24 9:51 ` Joel Stanley
2025-04-25 11:52 ` Daniel Henrique Barboza
2025-04-29 5:25 ` Joel Stanley
2025-04-29 10:27 ` Conor Dooley
2025-04-24 10:39 ` Alistair Francis
2025-04-23 11:06 ` [PATCH 2/9] hw/riscv/virt.c: remove trivial virt_memmap references Daniel Henrique Barboza
2025-04-23 11:06 ` [PATCH 3/9] hw/riscv/virt.c: use s->memmap in virt_machine_done() Daniel Henrique Barboza
2025-04-23 11:06 ` [PATCH 4/9] hw/riscv/virt.c: add 'base' arg in create_fw_cfg() Daniel Henrique Barboza
2025-04-23 11:06 ` [PATCH 5/9] hw/riscv/virt.c: use s->memmap in create_fdt() path Daniel Henrique Barboza
2025-04-23 11:06 ` [PATCH 6/9] hw/riscv/virt.c: use s->memmap in create_fdt_sockets() path Daniel Henrique Barboza
2025-04-23 11:06 ` [PATCH 7/9] hw/riscv/virt.c: use s->memmap in create_fdt_virtio() Daniel Henrique Barboza
2025-04-23 11:06 ` [PATCH 8/9] hw/riscv/virt.c: use s->memmap in finalize_fdt() functions Daniel Henrique Barboza
2025-04-23 11:06 ` [PATCH 9/9] hw/riscv/virt.c: remove 'long' casts in fmt strings Daniel Henrique Barboza
2025-04-23 11:26 ` Philippe Mathieu-Daudé
2025-04-24 9:41 ` Joel Stanley
2025-04-25 12:33 ` Daniel Henrique Barboza
2025-04-29 5:26 ` Joel Stanley
2025-04-29 12:40 ` Daniel Henrique Barboza
2025-04-29 17:11 ` Daniel Henrique Barboza [this message]
2025-04-30 11:28 ` Joel Stanley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45b9b66d-1aa7-47da-9458-04ab726d5aae@ventanamicro.com \
--to=dbarboza@ventanamicro.com \
--cc=alistair.francis@wdc.com \
--cc=joel@jms.id.au \
--cc=liwei1518@gmail.com \
--cc=palmer@rivosinc.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.