Commit e4de9ea7a3 for qemu.org
commit e4de9ea7a3b76edceccace408df4b5a6bd4c5dc9
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Sun Oct 4 14:23:50 2026 +0400
hw/char/sh_serial: fix RDF flag clear on FIFO reset
The FCR write handler cleared bit 1 of the status register (sr) instead
of the SH_SERIAL_FLAG_RDF flag in the flags field. This meant the
"receive data full" condition was never actually cleared when the guest
reset the FIFO.
Reported-by: Pavee Hui <phui@google.com>
Fixes: 63242a007a18 ("SH4: Serial controller improvement")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Yoshinori Sato <yoshinori.sato@nifty.com>
Message-ID: <20261004-issue-4560-v1-36-ccbef537cbeb@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index 10f96e3a44..30a22ea2d1 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -175,7 +175,7 @@ static void sh_serial_write(void *opaque, hwaddr offs,
}
if (val & (1 << 1)) {
sh_serial_clear_fifo(s);
- s->sr &= ~(1 << 1);
+ s->flags &= ~SH_SERIAL_FLAG_RDF;
}
return;