[PATCH v3 3/4] hw/char: sifive_uart: Update IRQ when rxctrl is written

frank.chang@sifive.com posted 4 patches 3 weeks, 5 days ago
Maintainers: Alistair Francis <Alistair.Francis@wdc.com>, Palmer Dabbelt <palmer@dabbelt.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
[PATCH v3 3/4] hw/char: sifive_uart: Update IRQ when rxctrl is written
Posted by frank.chang@sifive.com 3 weeks, 5 days ago
From: Frank Chang <frank.chang@sifive.com>

When rxctl is updated, we also need to check whether the IRQ should be
raised, as the user may activate the Rx channel or change the Rx FIFO
watermark level.

Signed-off-by: Frank Chang <frank.chang@sifive.com>
---
 hw/char/sifive_uart.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/char/sifive_uart.c b/hw/char/sifive_uart.c
index ae71a15a2a4..f255cca960d 100644
--- a/hw/char/sifive_uart.c
+++ b/hw/char/sifive_uart.c
@@ -216,6 +216,7 @@ sifive_uart_write(void *opaque, hwaddr addr,
         return;
     case SIFIVE_UART_RXCTRL:
         s->rxctrl = val64;
+        sifive_uart_update_irq(s);
         return;
     case SIFIVE_UART_DIV:
         s->div = val64;
-- 
2.43.0
Re: [PATCH v3 3/4] hw/char: sifive_uart: Update IRQ when rxctrl is written
Posted by Chao Liu 3 weeks, 3 days ago
On Thu, Mar 12, 2026 at 11:32:00AM +0800, frank.chang@sifive.com wrote:
> From: Frank Chang <frank.chang@sifive.com>
> 
> When rxctl is updated, we also need to check whether the IRQ should be
> raised, as the user may activate the Rx channel or change the Rx FIFO
> watermark level.
> 
> Signed-off-by: Frank Chang <frank.chang@sifive.com>
> ---
>  hw/char/sifive_uart.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/char/sifive_uart.c b/hw/char/sifive_uart.c
> index ae71a15a2a4..f255cca960d 100644
> --- a/hw/char/sifive_uart.c
> +++ b/hw/char/sifive_uart.c
> @@ -216,6 +216,7 @@ sifive_uart_write(void *opaque, hwaddr addr,
>          return;
>      case SIFIVE_UART_RXCTRL:
>          s->rxctrl = val64;
> +        sifive_uart_update_irq(s);
This is correct. As noted in the 1/4 review, the same treatment
should be applied to the SIFIVE_UART_TXCTRL case for consistency
-- the user may also change the Tx watermark level or toggle txen,
which affects the txwm pending state.

Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>

Thanks,
Chao
>          return;
>      case SIFIVE_UART_DIV:
>          s->div = val64;
> -- 
> 2.43.0
> 
>
Re: [PATCH v3 3/4] hw/char: sifive_uart: Update IRQ when rxctrl is written
Posted by Alistair Francis 3 weeks, 4 days ago
On Thu, Mar 12, 2026 at 1:33 PM <frank.chang@sifive.com> wrote:
>
> From: Frank Chang <frank.chang@sifive.com>
>
> When rxctl is updated, we also need to check whether the IRQ should be
> raised, as the user may activate the Rx channel or change the Rx FIFO
> watermark level.
>
> Signed-off-by: Frank Chang <frank.chang@sifive.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/char/sifive_uart.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/char/sifive_uart.c b/hw/char/sifive_uart.c
> index ae71a15a2a4..f255cca960d 100644
> --- a/hw/char/sifive_uart.c
> +++ b/hw/char/sifive_uart.c
> @@ -216,6 +216,7 @@ sifive_uart_write(void *opaque, hwaddr addr,
>          return;
>      case SIFIVE_UART_RXCTRL:
>          s->rxctrl = val64;
> +        sifive_uart_update_irq(s);
>          return;
>      case SIFIVE_UART_DIV:
>          s->div = val64;
> --
> 2.43.0
>
>