hw/char/cmsdk-apb-uart.c | 8 ++++++++ 1 file changed, 8 insertions(+)
I don't want to admit how many hours I spent trying to figure out why
nothing was being printed (as the enable-ing code hadn't yet run,
even thought it existed).
Signed-off-by: julia <midnight@trainwit.ch>
---
hw/char/cmsdk-apb-uart.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/char/cmsdk-apb-uart.c b/hw/char/cmsdk-apb-uart.c
index 32090f3516f6accad32bcd9fe9b10d572f17ed12..26931ab6c5d36f0ec5aac7acf3677855a6dd5f22 100644
--- a/hw/char/cmsdk-apb-uart.c
+++ b/hw/char/cmsdk-apb-uart.c
@@ -159,6 +159,10 @@ static uint64_t uart_read(void *opaque, hwaddr offset, unsigned size)
switch (offset) {
case A_DATA:
r = s->rxbuf;
+ if (!(s->ctrl & R_CTRL_RX_EN_MASK)) {
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "CMSDK APB UART: receive data read with Rx disabled\n");
+ }
s->state &= ~R_STATE_RXFULL_MASK;
cmsdk_apb_uart_update(s);
qemu_chr_fe_accept_input(&s->chr);
@@ -248,6 +252,10 @@ static void uart_write(void *opaque, hwaddr offset, uint64_t value,
switch (offset) {
case A_DATA:
s->txbuf = value;
+ if (!(s->ctrl & R_CTRL_TX_EN_MASK)) {
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "CMSDK APB UART: transmit data write with Tx disabled\n");
+ }
if (s->state & R_STATE_TXFULL_MASK) {
/* Buffer already full -- note the overrun and let the
* existing pending transmit callback handle the new char.
---
base-commit: 7154e4df40468012fccb6687ecd2b288c56a4a2d
change-id: 20251217-cmsdk-uart-disabled-warning2-0072a44c2ea1
Best regards,
--
julia <midnight@trainwit.ch>
On Wed, 17 Dec 2025 at 07:10, julia <midnight@trainwit.ch> wrote: > > I don't want to admit how many hours I spent trying to figure out why > nothing was being printed (as the enable-ing code hadn't yet run, > even thought it existed). > > Signed-off-by: julia <midnight@trainwit.ch> Applied to target-arm.next, thanks. -- PMM
Hi Julia, On 17/12/25 08:10, julia wrote: > I don't want to admit how many hours I spent trying to figure out why > nothing was being printed (as the enable-ing code hadn't yet run, > even thought it existed). You are not alone, few of us have been there too :/ This is why I added this commit for the PL011: https://gitlab.com/qemu-project/qemu/-/commit/abf2b6a0 but it had to be reverted, see: https://gitlab.com/qemu-project/qemu/-/commit/5b14454d > > Signed-off-by: julia <midnight@trainwit.ch> > --- > hw/char/cmsdk-apb-uart.c | 8 ++++++++ > 1 file changed, 8 insertions(+) Anyway for your patch: Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Regards, Phil.
Hi Phil, Interesting that that's the case for the PL011. I've run into situations before where turns out it was never enabled and it was still printing, discovered this after turning guest errors on. Do people usually run with guest errors on? At least for this UART it doesn't print until it's enabled, (and if you're checking the TXFULL bit then the guest is essentially deadlocked if polling), so that's not an issue. Julia On Thu, 18 Dec 2025, at 01:59, Philippe Mathieu-Daudé wrote: > Hi Julia, > > On 17/12/25 08:10, julia wrote: >> I don't want to admit how many hours I spent trying to figure out why >> nothing was being printed (as the enable-ing code hadn't yet run, >> even thought it existed). > > You are not alone, few of us have been there too :/ > > This is why I added this commit for the PL011: > https://gitlab.com/qemu-project/qemu/-/commit/abf2b6a0 > but it had to be reverted, see: > https://gitlab.com/qemu-project/qemu/-/commit/5b14454d > >> >> Signed-off-by: julia <midnight@trainwit.ch> >> --- >> hw/char/cmsdk-apb-uart.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) > > Anyway for your patch: > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> > > Regards, > > Phil.
© 2016 - 2026 Red Hat, Inc.