aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2024-06-10 17:23:41 +0100
committerPeter Maydell <peter.maydell@linaro.org>2024-06-21 14:01:59 +0100
commit9ed2fb65cc827904241dee189c801c10079c2fe3 (patch)
treea54bd837f30cbbf0721dc1df3df90a49f294990f
parent813b59e8b8ab5d284672e0bbd79173df2e25e01d (diff)
downloadqemu-9ed2fb65cc827904241dee189c801c10079c2fe3.zip
qemu-9ed2fb65cc827904241dee189c801c10079c2fe3.tar.gz
qemu-9ed2fb65cc827904241dee189c801c10079c2fe3.tar.bz2
hw/arm/virt: Add serial aliases in DTB
If there is more than one UART in the DTB, then there is no guarantee on which order a guest is supposed to initialise them. The standard solution to this is "serialN" entries in the "/aliases" node of the dtb which give the nodename of the UARTs. At the moment we only have two UARTs in the DTB when one is for the Secure world and one for the Non-Secure world, so this isn't really a problem. However if we want to add a second NS UART we'll need the aliases to ensure guests pick the right one. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20240610162343.2131524-2-peter.maydell@linaro.org
-rw-r--r--hw/arm/virt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index c7a1f75..61a9d47 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -284,6 +284,8 @@ static void create_fdt(VirtMachineState *vms)
}
}
+ qemu_fdt_add_subnode(fdt, "/aliases");
+
/* Clock node, for the benefit of the UART. The kernel device tree
* binding documentation claims the PL011 node clock properties are
* optional but in practice if you omit them the kernel refuses to
@@ -939,7 +941,9 @@ static void create_uart(const VirtMachineState *vms, int uart,
if (uart == VIRT_UART) {
qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", nodename);
+ qemu_fdt_setprop_string(ms->fdt, "/aliases", "serial0", nodename);
} else {
+ qemu_fdt_setprop_string(ms->fdt, "/aliases", "serial1", nodename);
/* Mark as not usable by the normal world */
qemu_fdt_setprop_string(ms->fdt, nodename, "status", "disabled");
qemu_fdt_setprop_string(ms->fdt, nodename, "secure-status", "okay");