Skip to contentSkip to conversation

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

PATCH In review Enric Balletbo i Serra 2 participants 2 messages Oct 28

lore
Share & tools
lore
#0 lore raw

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

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".

---
 hw/arm/virt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/arm/virt.c +3 -2
index 0d56197dacee..d93850feafa4 100644
@@ -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,

Signature · 1 line
Enric Balletbo i Serra <[email protected]>
#1 lore raw
Quoted 16 lines · Enric Balletbo i Serra

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".

---
 hw/arm/virt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/arm/virt.c +0 -0
index 0d56197dacee..d93850feafa4 100644

hw/arm/virt.c static void create_uart(const VirtMachineState *vms, int uart, · line 1534

Quoted 7 lines
hw/arm/virt.c +2 -1
@@ -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