[PATCH] hw/arm/virt: use alias and baudrate in stdout-path

Enric Balletbo i Serra posted 1 patch 3 weeks, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261028-stdout-path-baudrate-v1-1-34281c1f34ad@redhat.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>
hw/arm/virt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
[PATCH] hw/arm/virt: use alias and baudrate in stdout-path
Posted by Enric Balletbo i Serra 3 weeks, 4 days ago
Set stdout-path to "serial0:115200n8" instead of the raw device node
path, so that Linux can automatically configure the console from the
device tree without requiring an explicit console= kernel argument.
Apply the same fix to the secure UART stdout-path using "serial1:115200n8".

Signed-off-by: Enric Balletbo i Serra <eballetb@redhat.com>
---
 hw/arm/virt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 0d56197dacee..d93850feafa4 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1529,8 +1529,9 @@ static void create_uart(const VirtMachineState *vms, int uart,
                          clocknames, sizeof(clocknames));
 
     if (uart == VIRT_UART0) {
-        qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", nodename);
         qemu_fdt_setprop_string(ms->fdt, "/aliases", "serial0", nodename);
+        qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path",
+                                "serial0:115200n8");
     } else {
         qemu_fdt_setprop_string(ms->fdt, "/aliases", "serial1", nodename);
     }
@@ -1540,7 +1541,7 @@ static void create_uart(const VirtMachineState *vms, int uart,
         qemu_fdt_setprop_string(ms->fdt, nodename, "secure-status", "okay");
 
         qemu_fdt_setprop_string(ms->fdt, "/secure-chosen", "stdout-path",
-                                nodename);
+                                "serial1:115200n8");
     }
 
     g_free(nodename);

---
base-commit: 29b1dc631d6ac6bfc39464e0be8bf4cad556a591
change-id: 20261028-stdout-path-baudrate-cc53866f7f81

Best regards,
-- 
Enric Balletbo i Serra <eballetb@redhat.com>
Re: [PATCH] hw/arm/virt: use alias and baudrate in stdout-path
Posted by Peter Maydell 3 weeks, 4 days ago
On Wed, 28 Oct 2026 at 18:29, Enric Balletbo i Serra
<eballetb@redhat.com> wrote:
>
> Set stdout-path to "serial0:115200n8" instead of the raw device node
> path, so that Linux can automatically configure the console from the
> device tree without requiring an explicit console= kernel argument.
> Apply the same fix to the secure UART stdout-path using "serial1:115200n8".
>
> Signed-off-by: Enric Balletbo i Serra <eballetb@redhat.com>
> ---
>  hw/arm/virt.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 0d56197dacee..d93850feafa4 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1529,8 +1529,9 @@ static void create_uart(const VirtMachineState *vms, int uart,
>                           clocknames, sizeof(clocknames));
>
>      if (uart == VIRT_UART0) {
> -        qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", nodename);
>          qemu_fdt_setprop_string(ms->fdt, "/aliases", "serial0", nodename);
> +        qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path",
> +                                "serial0:115200n8");

Where is this binding documented? The kernel's Documentation/devicetree
doesn't mention chosen/stdout-path. The "Devicetree Specification"
v0.4 from devicetree.org says

"A string that specifies the full path to the node representing the device
to be used for boot console output. If the character “:” is present in the
value it terminates the path. The value may be an alias. If the stdin-path
property is not specified, stdout-path should be assumed to define the
input device."

Which doesn't mention needing to specify baud rates at all, and sounds to
me like our current "nodename" is correct.

More generally, if the virt board's serial port is connected to something
virtual like stdout then the nominal baud rate is irrelevant, and if
it's connected passthrough to a real serial port then (a) our pl011
model doesn't actually implement that yet and (b) you would need to
match the actual baud rate the other end is expecting, which might
or might not be 115200. So what does this get us?

thanks
-- PMM