QEMU-Arm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/char/stm32l4x5_usart: Accept character input upon RDR read
@ 2026-09-02 16:59 Alex Bennée
  2026-09-08 15:51 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Bennée @ 2026-09-02 16:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alex Bennée, Samuel Tardieu, Marc-André Lureau,
	Paolo Bonzini, open list:STM32L4x5 SoC Family

Looking through existing serial devices this seems to be a common
pattern so it makes sense to me this is the right fix and matches the
API description.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/4389
Reported-by: Jan Brittenson (@bson)
Suggested-by: Jan Brittenson (@bson)
AI-used-for: fetch issue, apply proposed patch, verify build and qtests
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
NOTE
  - testing with the AGENTS.md patches - I asked the agent to:
  "grab the details for 4389 and apply the fix to the local tree"
  which it did. However it did remind me at the end:

  *(Reminder per QEMU policy: this is a draft for you to review, adjust, and commit. Remember to check whether `Resolves:` and `Reported-by:` headers match your preferred attribution.)*

  ```text
  hw/char/stm32l4x5_usart: Accept character input upon RDR read

  When the guest reads from the USART Receive Data Register (RDR), the
  RXNE flag is cleared to allow receiving subsequent characters. However,
  without notifying the chardev backend via qemu_chr_fe_accept_input(),
  backends such as socket-based chardevs in polling mode may stall and
  only deliver characters once per second upon poll timeouts.

  Call qemu_chr_fe_accept_input() after clearing RXNE in
  stm32l4x5_usart_base_read().

  Resolves: https://gitlab.com/qemu-project/qemu/-/issues/4389
  Reported-by: bson
  Suggested-by: bson
  AI-used-for: fetch issue, apply proposed patch, verify build and qtests
  Signed-off-by: Your Name <your.email@domain.com>
  ```
---
 hw/char/stm32l4x5_usart.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/char/stm32l4x5_usart.c b/hw/char/stm32l4x5_usart.c
index dd1b0991956..0b02dde1f8c 100644
--- a/hw/char/stm32l4x5_usart.c
+++ b/hw/char/stm32l4x5_usart.c
@@ -441,6 +441,7 @@ static uint64_t stm32l4x5_usart_base_read(void *opaque, hwaddr addr,
         /* Reset RXNE flag */
         s->isr &= ~R_ISR_RXNE_MASK;
         stm32l4x5_update_irq(s);
+        qemu_chr_fe_accept_input(&s->chr);
         break;
     case A_TDR:
         retvalue = FIELD_EX32(s->tdr, TDR, TDR);
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-08 16:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-02 16:59 [PATCH] hw/char/stm32l4x5_usart: Accept character input upon RDR read Alex Bennée
2026-09-08 15:51 ` Peter Maydell
2026-09-08 16:30   ` Alex Bennée

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox