qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 09/12] hw/char/pl011: Check if transmitter is enabled


From: Peter Maydell
Subject: Re: [PATCH 09/12] hw/char/pl011: Check if transmitter is enabled
Date: Thu, 25 May 2023 13:30:50 +0100

On Mon, 22 May 2023 at 16:32, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Do not transmit characters when UART or transmitter are disabled.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@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/CAFEAcA8ZDmjP7G0eVpxcB1jiSGarZAbqPV0xr5WquR213mBUBg@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]