]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/char: Check interrupt after txctrl register is written
authorFrank Chang <frank.chang@sifive.com>
Wed, 13 May 2026 03:05:03 +0000 (11:05 +0800)
committerAlistair Francis <alistair.francis@wdc.com>
Thu, 21 May 2026 23:45:46 +0000 (09:45 +1000)
It's possible that the transmit watermark level (txctrl.txcnt) is
updated when the user writes to txctrl register, which may decrease the
transmit watermark level to less than the number of entries in the
transmit FIFO. In such a case, the interrupt should be raised so we need to
call sifive_uart_update_irq() to check and update interrupt when txctrl
register is written. Otherwise, the interrupt will have to be delayed
until next TX FIFO transmission is processed.

Suggested-by: Chao Liu <chao.liu.zevorn@gmail.com>
Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Jim Shu <jim.shu@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260513030503.3665414-1-frank.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
hw/char/sifive_uart.c

index b4de662d61643776eb220bae313fce04a2dbba50..b9bbaaef595e11363892091609035c3a77f0b164 100644 (file)
@@ -213,6 +213,7 @@ sifive_uart_write(void *opaque, hwaddr addr,
         if (SIFIVE_UART_TXEN(s->txctrl) && !fifo8_is_empty(&s->tx_fifo)) {
             sifive_uart_trigger_tx_fifo(s);
         }
+        sifive_uart_update_irq(s);
         return;
     case SIFIVE_UART_RXCTRL:
         s->rxctrl = val64;