From: Stephen Checkoway <stephen.checkoway@oberlin.edu>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org,
"Stephen Checkoway" <stephen.checkoway@oberlin.edu>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Qemu-trivial] [PATCH] hw/char/escc: Lower irq when transmit buffer is filled
Date: Tue, 5 Mar 2019 00:10:07 -0500 [thread overview]
Message-ID: <20190305051007.56009-1-stephen.checkoway@oberlin.edu> (raw)
The SCC/ESCC will briefly stop asserting an interrupt when the
transmit FIFO is filled.
This code doesn't model the transmit FIFO/shift register so the
pending transmit interrupt is never deasserted which means that an
edge-triggered interrupt controller will never see the low-to-high
transition it needs to raise another interrupt. The practical
consequence of this is that guest firmware with an interrupt service
routine for the ESCC that does not send all of the data it has
immediately will stop sending data if the following sequence of
events occurs:
1. Disable processor interrupts
2. Write a character to the ESCC
3. Add additional characters to a buffer which is drained by the ISR
4. Enable processor interrupts
In this case, the first character will be sent, the interrupt will
fire and the ISR will output the second character. Since the pending
transmit interrupt remains asserted, no additional interrupts will
ever fire.
This fixes that situation by explicitly lowering the IRQ when a
character is written to the buffer.
Signed-off-by: Stephen Checkoway <stephen.checkoway@oberlin.edu>
---
hw/char/escc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/char/escc.c b/hw/char/escc.c
index 628f5f81f7..bea55ad8da 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -509,6 +509,7 @@ static void escc_mem_write(void *opaque, hwaddr addr,
break;
case SERIAL_DATA:
trace_escc_mem_writeb_data(CHN_C(s), val);
+ qemu_irq_lower(s->irq);
s->tx = val;
if (s->wregs[W_TXCTRL2] & TXCTRL2_TXEN) { // tx enabled
if (qemu_chr_fe_backend_connected(&s->chr)) {
--
2.17.2 (Apple Git-113)
next reply other threads:[~2019-03-05 5:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-05 5:10 Stephen Checkoway [this message]
2019-03-06 11:01 ` [Qemu-trivial] [PATCH] hw/char/escc: Lower irq when transmit buffer is filled Paolo Bonzini
2019-04-10 20:01 ` [Qemu-trivial] [Qemu-devel] " Philippe Mathieu-Daudé
2019-04-10 21:22 ` Stephen Checkoway
2019-04-17 0:55 ` Stephen Checkoway
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190305051007.56009-1-stephen.checkoway@oberlin.edu \
--to=stephen.checkoway@oberlin.edu \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).