On Wed, 12 Mar 2025 at 13:36, Peter Maydell <[email protected]> wrote:
>
> On Tue, 11 Mar 2025 at 15:37, Paolo Bonzini <[email protected]> wrote:
> >
> > The guest does not control whether characters are sent on the UART.
> > Sending them before the guest happens to boot will now result in a
> > "guest error" log entry that is only because of timing, even if the
> > guest _would_ later setup the receiver correctly.
> >
> > This reverts commit abf2b6a028670bd2890bb3aee7e103fe53e4b0df, apart
> > from adding the comment.
> >
> > Cc: Philippe Mathieu-Daudé <[email protected]>
> > Cc: Peter Maydell <[email protected]>
> > Signed-off-by: Paolo Bonzini <[email protected]>
> > ---
> >  hw/char/pl011.c | 12 ++----------
> >  1 file changed, 2 insertions(+), 10 deletions(-)
> >
> > diff --git a/hw/char/pl011.c b/hw/char/pl011.c
> > index 23a9db8c57c..efca8baecd7 100644
> > --- a/hw/char/pl011.c
> > +++ b/hw/char/pl011.c
> > @@ -85,7 +85,6 @@ DeviceState *pl011_create(hwaddr addr, qemu_irq irq, 
> > Chardev *chr)
> >  #define CR_OUT1     (1 << 12)
> >  #define CR_RTS      (1 << 11)
> >  #define CR_DTR      (1 << 10)
> > -#define CR_RXE      (1 << 9)
> >  #define CR_TXE      (1 << 8)
> >  #define CR_LBE      (1 << 7)
> >  #define CR_UARTEN   (1 << 0)
> > @@ -490,16 +489,9 @@ static int pl011_can_receive(void *opaque)
> >      unsigned fifo_depth = pl011_get_fifo_depth(s);
> >      unsigned fifo_available = fifo_depth - s->read_count;
> >
> > -    if (!(s->cr & CR_UARTEN)) {
> > -        qemu_log_mask(LOG_GUEST_ERROR,
> > -                      "PL011 receiving data on disabled UART\n");
> > -    }
> > -    if (!(s->cr & CR_RXE)) {
> > -        qemu_log_mask(LOG_GUEST_ERROR,
> > -                      "PL011 receiving data on disabled RX UART\n");
> > -    }
> > +    /* Should check enable and return 0? */
>
> We decided deliberately not to check the enable and return 0
> here, as described in the commit message of abf2b6a028670bd:
> we think there's too likely to be existing works-on-QEMU code
> out there that doesn't ever set the enable bits.
>
> Otherwise, yes, agreed with the revert.

Oh, and I just realized that the right place to diagnose
"guest didn't enable the UART" would be when it reads/writes
the data register while the enable bits are clear.

-- PMM

Reply via email to