On Mon, 22 May 2023 at 16:32, Philippe Mathieu-Daudé <phi...@linaro.org> wrote: > > Do not transmit characters when UART or transmitter are disabled. > > Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
Last time somebody tried to add checks on the tx/rx enable bits for the PL011 it broke 'make check' because the hand-rolled UART code in boot-serial-test and migration-test doesn't set up the UART control register strictly correctly: https://lore.kernel.org/qemu-devel/cafeaca8zdmjp7g0evpxcb1jisgarzabqpv0xr5wqur213mb...@mail.gmail.com/ Given that imposing these checks doesn't help anything much and might break naive bare-metal tested-only-on-QEMU code, is it worthwhile ? > static void pl011_write_tx(PL011State *s, const uint8_t *buf, int length) > { > - /* ??? Check if transmitter is enabled. */ > + if (!(s->cr & (CR_UARTEN | CR_TXE))) { This will allow TX if either UARTEN or TXE is set, which probably isn't what you meant. > + return; > + } > > /* XXX this blocks entire thread. Rewrite to use > * qemu_chr_fe_write and background I/O callbacks */ thanks -- PMM