Skip to contentSkip to conversation

hw/riscv/virt: Add serial alias in DTB

PATCH Superseded Vasilis Liaskovitis 2 participants 2 messages Jan 16, 2025 RISC-V

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/riscv/virt: Add serial alias in DTB

This patch adds an "aliases" node with a "serial0" entry for the single UART in the riscv64 virt machine.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2774

---
 hw/riscv/virt.c | 3 +++
 1 file changed, 3 insertions(+)
hw/riscv/virt.c +3 -0
index 2bc5a9dd98..fb1928cebf 100644
@@ -971,6 +971,7 @@ static void create_fdt_uart(RISCVVirtState *s, const MemMapEntry *memmap,
     }
 
     qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", name);
+    qemu_fdt_setprop_string(ms->fdt, "/aliases", "serial0", name);
 }
 
 static void create_fdt_rtc(RISCVVirtState *s, const MemMapEntry *memmap,
@@ -1180,6 +1181,8 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap)
     qemu_fdt_setprop(ms->fdt, "/chosen", "rng-seed",
                      rng_seed, sizeof(rng_seed));
 
+    qemu_fdt_add_subnode(ms->fdt, "/aliases");
+
     create_fdt_flash(s, memmap);
     create_fdt_fw_cfg(s, memmap);
     create_fdt_pmu(s);
Signature · 1 line
2.46.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 1 line · Vasilis Liaskovitis

This patch adds an "aliases" node with a "serial0" entry for the

s/This patch adds/Add/

Quoted 1 line

single UART in the riscv64 virt machine.

s/riscv64/riscv/

Quoted 31 lines

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2774

---
 hw/riscv/virt.c | 3 +++
 1 file changed, 3 insertions(+)
hw/riscv/virt.c +3 -0
index 2bc5a9dd98..fb1928cebf 100644
@@ -971,6 +971,7 @@ static void create_fdt_uart(RISCVVirtState *s, const MemMapEntry *memmap,
     }
 
     qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", name);
+    qemu_fdt_setprop_string(ms->fdt, "/aliases", "serial0", name);
 }
 
 static void create_fdt_rtc(RISCVVirtState *s, const MemMapEntry *memmap,
@@ -1180,6 +1181,8 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap)
     qemu_fdt_setprop(ms->fdt, "/chosen", "rng-seed",
                      rng_seed, sizeof(rng_seed));
 
+    qemu_fdt_add_subnode(ms->fdt, "/aliases");
+
     create_fdt_flash(s, memmap);
     create_fdt_fw_cfg(s, memmap);
     create_fdt_pmu(s);
Signature · 1 line
2.46.0

Only fix the minor commit message issues if you need to respin for other reasons.