On Fri, 2026-10-23 at 13:09 -0300, Daniel Henrique Barboza wrote: > The riscv-server 1.0 spec requires an UART with 115200 baud, per rule > "HPER_020" described in [1]. > > At this moment we're doing two things: the FDT is being created using > the default UART base baud of 230400, and the device itself is being > created using a baud of 399193. This odd value was inherited from > the > RISC-V 'virt' machine when implementing the first interaction of the > riscv-server-ref board. Linux doesn't seem to care: dmesg reports a > base baud of 230400, a value derived from what we're writing in the > DT, > and the serial seems to work fine. > > Straight everything up by setting the required base baud of 115200 > everywhere applicable. And for good measure let's also change the > boot > test to be sure that userpace is reading the intended serial base > baud. > > [1] > https://docs.riscv.org/reference/server-soc/v1.0/server_soc_requirements.html > > Fixes: c2fa4320803b ("hw/riscv: server platform reference machine") > Signed-off-by: Daniel Henrique Barboza > <[email protected]>
Reviewed-by: Alistair Francis <[email protected]> Alistair > --- > hw/riscv/server_platform_ref.c | 8 +++++--- > tests/functional/riscv64/test_server_ref.py | 3 +++ > 2 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/hw/riscv/server_platform_ref.c > b/hw/riscv/server_platform_ref.c > index 3191615c02..e86c37400d 100644 > --- a/hw/riscv/server_platform_ref.c > +++ b/hw/riscv/server_platform_ref.c > @@ -68,6 +68,7 @@ > > #define RVSERVER_PLATFORM_BUS_NUM_IRQS 8 > #define RVSERVER_IOMMU_HPM_COUNTERS 4 > +#define RVSERVER_UART_BASE_BAUD 115200 > > #define TYPE_RISCV_SERVER_REF_MACHINE MACHINE_TYPE_NAME("riscv- > server-ref") > OBJECT_DECLARE_SIMPLE_TYPE(RISCVServerRefMachineState, > RISCV_SERVER_REF_MACHINE) > @@ -315,7 +316,7 @@ static void > finalize_fdt(RISCVServerRefMachineState *s) > > riscv_create_fdt_uart(ms->fdt, > &rvserver_ref_memmap[RVSERVER_UART0], > RVSERVER_UART0_IRQ, AIA_TYPE_APLIC_IMSIC, > - 0, > + RVSERVER_UART_BASE_BAUD, > irq_mmio_phandle); > name = > riscv_fdt_get_uart_nodename(rvserver_ref_memmap[RVSERVER_UART0].base) > ; > qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", > name); > @@ -614,8 +615,9 @@ static void > rvserver_ref_machine_init(MachineState *machine) > > RVSERVER_PLATFORM_BUS_NUM_IRQS); > > serial_mm_init(system_memory, memmap[RVSERVER_UART0].base, > - 0, qdev_get_gpio_in(mmio_irqchip, RVSERVER_UART0_IRQ), > 399193, > - serial_hd(0), DEVICE_LITTLE_ENDIAN); > + 0, qdev_get_gpio_in(mmio_irqchip, > RVSERVER_UART0_IRQ), > + RVSERVER_UART_BASE_BAUD, > + serial_hd(0), DEVICE_LITTLE_ENDIAN); > > sysbus_create_simple("goldfish_rtc", memmap[RVSERVER_RTC].base, > qdev_get_gpio_in(mmio_irqchip, RVSERVER_RTC_IRQ)); > diff --git a/tests/functional/riscv64/test_server_ref.py > b/tests/functional/riscv64/test_server_ref.py > index ad29094dbe..fa7225ccc1 100755 > --- a/tests/functional/riscv64/test_server_ref.py > +++ b/tests/functional/riscv64/test_server_ref.py > @@ -71,6 +71,9 @@ def do_test_boot_linux_test(self, > tpmstate_dir=None): > wait_for_console_pattern(self, 'Linux version') > wait_for_console_pattern(self, 'Machine model: RISC-V Server > Platform') > > + # Check that we have the intended base baud for the serial > + wait_for_console_pattern(self, 'base_baud = 115200') > + > # Test e1000e network card functionality > wait_for_console_pattern(self, 'e1000e') > wait_for_console_pattern(self, 'Network Connection')
