[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 5/7] hw/char/pl011: Consider TX FIFO overrun error
From: |
Peter Maydell |
Subject: |
Re: [PATCH v6 5/7] hw/char/pl011: Consider TX FIFO overrun error |
Date: |
Mon, 17 Feb 2025 14:29:51 +0000 |
On Sat, 8 Feb 2025 at 16:39, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> When transmission is disabled, characters are still queued
> to the FIFO which eventually overruns. Report that error
> condition in the status register.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/char/pl011.c | 20 ++++++++++++++++++++
> hw/char/trace-events | 2 ++
> 2 files changed, 22 insertions(+)
>
> diff --git a/hw/char/pl011.c b/hw/char/pl011.c
> index 447f185e2d5..ef39ab666a2 100644
> --- a/hw/char/pl011.c
> +++ b/hw/char/pl011.c
> @@ -61,6 +61,9 @@ DeviceState *pl011_create(hwaddr addr, qemu_irq irq,
> Chardev *chr)
> /* Data Register, UARTDR */
> #define DR_BE (1 << 10)
>
> +/* Receive Status Register/Error Clear Register, UARTRSR/UARTECR */
> +#define RSR_OE (1 << 3)
> +
> /* Interrupt status bits in UARTRIS, UARTMIS, UARTIMSC */
> #define INT_OE (1 << 10)
> #define INT_BE (1 << 9)
> @@ -158,6 +161,16 @@ static inline unsigned pl011_get_fifo_depth(PL011State
> *s)
> return pl011_is_fifo_enabled(s) ? PL011_FIFO_DEPTH : 1;
> }
>
> +static bool pl011_is_tx_fifo_full(PL011State *s)
> +{
> + if (pl011_is_fifo_enabled(s)) {
> + trace_pl011_fifo_tx_is_full("FIFO", fifo8_is_full(&s->xmit_fifo));
> + return fifo8_is_full(&s->xmit_fifo);
> + }
> + trace_pl011_fifo_tx_is_full("CHAR", !fifo8_is_empty(&s->xmit_fifo));
> + return !fifo8_is_empty(&s->xmit_fifo);
More repetition of expressions, but anyway
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
[PATCH v6 6/7] hw/char/pl011: Drain TX FIFO when no backend connected, Philippe Mathieu-Daudé, 2025/02/08
[PATCH v6 7/7] hw/char/pl011: Implement TX FIFO, Philippe Mathieu-Daudé, 2025/02/08
Re: [PATCH v6 0/7] hw/char/pl011: Implement TX (async) FIFO to avoid blocking the main loop, Peter Maydell, 2025/02/17