On Thu, 9 Apr 2026 at 07:40, Vivian Wang <wangruikang@iscas.ac.cn> wrote:
>
> These unit addresses should have been in hex, not decimal, as per de
> facto convention [1]. Fix them.
>
> Link: https://lore.kernel.org/devicetree-spec/CAL_JsqJFv3+UJ-bjLGk0i7Wc+spsowCrqQZ_s3P4gN8r1W-Q-w@mail.gmail.com/ # [1]
> Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
> ---
> hw/or1k/or1k-sim.c | 2 +-
> hw/or1k/virt.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/or1k/or1k-sim.c b/hw/or1k/or1k-sim.c
> index f1b1f63274..b851e48c16 100644
> --- a/hw/or1k/or1k-sim.c
> +++ b/hw/or1k/or1k-sim.c
> @@ -138,7 +138,7 @@ static void openrisc_create_fdt(Or1ksimState *state,
> qemu_fdt_setprop_cell(fdt, "/cpus", "#address-cells", 0x1);
>
> for (cpu = 0; cpu < num_cpus; cpu++) {
> - nodename = g_strdup_printf("/cpus/cpu@%d", cpu);
> + nodename = g_strdup_printf("/cpus/cpu@%x", (unsigned)cpu);
> qemu_fdt_add_subnode(fdt, nodename);
> qemu_fdt_setprop_string(fdt, nodename, "compatible",
> "opencores,or1200-rtlsvn481");
> diff --git a/hw/or1k/virt.c b/hw/or1k/virt.c
> index 39f54058ab..ac644f128e 100644
> --- a/hw/or1k/virt.c
> +++ b/hw/or1k/virt.c
> @@ -162,7 +162,7 @@ static void openrisc_create_fdt(OR1KVirtState *state,
> qemu_fdt_setprop_cell(fdt, "/cpus", "#address-cells", 0x1);
>
> for (cpu = 0; cpu < num_cpus; cpu++) {
> - nodename = g_strdup_printf("/cpus/cpu@%d", cpu);
> + nodename = g_strdup_printf("/cpus/cpu@%x", (unsigned)cpu);
> qemu_fdt_add_subnode(fdt, nodename);
> qemu_fdt_setprop_string(fdt, nodename, "compatible",
> "opencores,or1200-rtlsvn481");
The maximum number of CPUs in both these boards is 4, so this makes
no actual difference to the node names we create. That would be
worth noting in the commit message.
-- PMM