From nobody Sun Nov 9 16:20:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551762701705230.78729387552892; Mon, 4 Mar 2019 21:11:41 -0800 (PST) Received: from localhost ([127.0.0.1]:37560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h12MR-0000w0-Hi for importer@patchew.org; Tue, 05 Mar 2019 00:11:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h12LT-0000Wm-Ux for qemu-devel@nongnu.org; Tue, 05 Mar 2019 00:10:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h12LS-0004kW-Lg for qemu-devel@nongnu.org; Tue, 05 Mar 2019 00:10:27 -0500 Received: from mail-it1-x141.google.com ([2607:f8b0:4864:20::141]:40658) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h12LS-0004hW-C4 for qemu-devel@nongnu.org; Tue, 05 Mar 2019 00:10:26 -0500 Received: by mail-it1-x141.google.com with SMTP id l139so2474758ita.5 for ; Mon, 04 Mar 2019 21:10:25 -0800 (PST) Received: from worksec.oberlin.net (ip-210-181.oberlin.net. [208.66.210.181]) by smtp.gmail.com with ESMTPSA id b16sm4231545itb.26.2019.03.04.21.10.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Mar 2019 21:10:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oberlin-edu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=PK7QaXcW2z3RLKlFr1TIfOFVNgtL+K1a3H3n3C2YYkM=; b=G48hdU9oikaG2h2oS2OZ/J6UGIzG+oS6/ky5kItGoKFeW3B8RgbdSZvWtMCgX9Uqou 2TdtnEY6FQsv49LTnUY3UvFLCsZZtWpW9qPq4jO0HvLkn4ccgBcDC4qzb576GVNnF5uC GkdWiu+RxVlXDEXb1M1MaguRBmlmFidhphPcUaE9Q2BIW6vqq05VZNFYC89CtRzzR58q FcaqHA1Dx4Zkwfxp229YVF80yPkKIYMza0j/1ZNRKm6CHGj+nQQY2aWBZ5FwIFrmY7vm xulokV1gOHWjptWGexkQgk8F0oH9gZB4XKx+YiESSuteg4VDC3GJDSuKFT9Dgmk+CW3I IgfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PK7QaXcW2z3RLKlFr1TIfOFVNgtL+K1a3H3n3C2YYkM=; b=oYqz3pL4JgZGYeqgZ++WVHgGGagMpr2EQAyekymFNEOSmStKEoqGJmHI+Di/tACSiq jEc6Fzuq+LyaX9QRZLkIlmVVN3voWBCdMGa2CPQD99r017cRKM4vgi0OmsP+R0l1ly0K UGhOq+F5EWNTpthUvZO7Sx0DNeqG3P/+FkMFFes1HedtIEr8f31aYgicFPhNWkHxWlGK TYb5Va8+XmZNOnwjg+AoCWbeCE1o4MhkesHSz+garWXz9eUCQO6zXioHTQjs+MwlhTTh xVQoR7w5IE/IimAvUnFWJZrdXoFwgJo4sD58+xBR6lXrmquNzhaRNGU3tdDZ4ieBzrMi dFlg== X-Gm-Message-State: APjAAAVT8NLy0TWdoFcsL0UJ9myRyd9YCdMwidGCn6Xr0H+xypYtDZwq rVWIX6JpZ3b6E4VMvVZHDlHUWVHgnyU= X-Google-Smtp-Source: APXvYqxXA3bzbg6ryyzNIEnEqiavtI2b+PpmvhfvSJKkQhgpOvgTAwQwvnyBtOEaD+jwe46XDpMBWA== X-Received: by 2002:a02:228f:: with SMTP id o137mr168736jao.76.1551762623849; Mon, 04 Mar 2019 21:10:23 -0800 (PST) From: Stephen Checkoway To: qemu-devel@nongnu.org Date: Tue, 5 Mar 2019 00:10:07 -0500 Message-Id: <20190305051007.56009-1-stephen.checkoway@oberlin.edu> X-Mailer: git-send-email 2.17.2 (Apple Git-113) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::141 Subject: [Qemu-devel] [PATCH] hw/char/escc: Lower irq when transmit buffer is filled X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stephen Checkoway , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- 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 =3D val; if (s->wregs[W_TXCTRL2] & TXCTRL2_TXEN) { // tx enabled if (qemu_chr_fe_backend_connected(&s->chr)) { --=20 2.17.2 (Apple Git-113)