diff mbox series

[v2,2/4] hw/char/stm32f2xx_usart: Update IRQ when SR is read

Message ID 20231020170009.86870-3-philmd@linaro.org
State New
Headers show
Series stm32f2xx_usart: implement TX interrupts | expand

Commit Message

Philippe Mathieu-Daudé Oct. 20, 2023, 5 p.m. UTC
From: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>

Signed-off-by: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
[PMD: Split from bigger patch]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Is this required?
---
 hw/char/stm32f2xx_usart.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Richard Henderson Oct. 22, 2023, 4:54 p.m. UTC | #1
On 10/20/23 10:00, Philippe Mathieu-Daudé wrote:
> From: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
> 
> Signed-off-by: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
> [PMD: Split from bigger patch]
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> Is this required?
> ---
>   hw/char/stm32f2xx_usart.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c
> index 519d3461a3..46e29089bc 100644
> --- a/hw/char/stm32f2xx_usart.c
> +++ b/hw/char/stm32f2xx_usart.c
> @@ -109,6 +109,7 @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr,
>       case USART_SR:
>           retvalue = s->usart_sr;
>           qemu_chr_fe_accept_input(&s->chr);
> +        stm32f2xx_update_irq(s);
>           return retvalue;
>       case USART_DR:
>           DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr);

Is there a status bit change missing?  There doesn't seem to be anything to update here.


r~
Alistair Francis Oct. 23, 2023, 1:36 a.m. UTC | #2
On Sat, Oct 21, 2023 at 4:12 AM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> From: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
>
> Signed-off-by: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
> [PMD: Split from bigger patch]
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> Is this required?

I don't think this is required

Alistair

> ---
>  hw/char/stm32f2xx_usart.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c
> index 519d3461a3..46e29089bc 100644
> --- a/hw/char/stm32f2xx_usart.c
> +++ b/hw/char/stm32f2xx_usart.c
> @@ -109,6 +109,7 @@ static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr,
>      case USART_SR:
>          retvalue = s->usart_sr;
>          qemu_chr_fe_accept_input(&s->chr);
> +        stm32f2xx_update_irq(s);
>          return retvalue;
>      case USART_DR:
>          DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr);
> --
> 2.41.0
>
>
Hans-Erik Floryd Oct. 23, 2023, 9:38 a.m. UTC | #3
On Mon, 23 Oct 2023 at 03:37, Alistair Francis <alistair23@gmail.com> wrote:
>
> On Sat, Oct 21, 2023 at 4:12 AM Philippe Mathieu-Daudé
> <philmd@linaro.org> wrote:
> >
> > From: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
> >
> > Signed-off-by: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
> > [PMD: Split from bigger patch]
> > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> > ---
> > Is this required?
>
> I don't think this is required
>
> Alistair

I agree this should be removed. It was added because the manual says
that some irq:s are cleared by a combination of reading SR and writing
to DR. However, those bits are not implemented yet, and probably the
clearing should be done when writing DR anyway.

Thanks for reviewing,
 Hans-Erik
diff mbox series

Patch

diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c
index 519d3461a3..46e29089bc 100644
--- a/hw/char/stm32f2xx_usart.c
+++ b/hw/char/stm32f2xx_usart.c
@@ -109,6 +109,7 @@  static uint64_t stm32f2xx_usart_read(void *opaque, hwaddr addr,
     case USART_SR:
         retvalue = s->usart_sr;
         qemu_chr_fe_accept_input(&s->chr);
+        stm32f2xx_update_irq(s);
         return retvalue;
     case USART_DR:
         DB_PRINT("Value: 0x%" PRIx32 ", %c\n", s->usart_dr, (char) s->usart_dr);