From patchwork Fri Aug 24 14:24:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Lei" X-Patchwork-Id: 10575437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B0FF51390 for ; Fri, 24 Aug 2018 15:02:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F2D92C89B for ; Fri, 24 Aug 2018 15:02:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 938222CA0F; Fri, 24 Aug 2018 15:02:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 95DD12C89B for ; Fri, 24 Aug 2018 15:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=XE3n0kbvKWuKr91/l+G2TzywxLfM2K2U1Gled559BFQ=; b=P43dytdw025vA1 D+h6kIQ7FQGZFa/IurCbNbEgVMA+Ncnm18gOBox4QF2soryVKw/WJYxcEYFezSUCn18QBtUYUES6d DSAPTVtckltBYUL0NRY76zQQ83ZM1YOI+Gpj7C+kGK1ohMIqJFFfK+cHKWgcwNmcv6L+B58zT10W8 RMXs12xwGeMYcV4+hlib8wFqMEiKy/hVqTNWQXp2YvfYRBv0/CO36CnWjlfIIcRP7tbE2oDYOk0Vd kDcO0YCgUBgxb2XygWQUl3Y7joqe184Uo/EAkhESX3Wm5GFmxGPBcvR3wmr2mEhlwt66hiE5EqVBd DYckkp0GOxQfFQLYp6GA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ftDbB-0006XA-R1; Fri, 24 Aug 2018 15:02:05 +0000 Received: from mgwkm02.jp.fujitsu.com ([202.219.69.169]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ftDBr-0007wM-By for linux-arm-kernel@lists.infradead.org; Fri, 24 Aug 2018 14:35:57 +0000 Received: from kw-mxoi2.gw.nic.fujitsu.com (unknown [192.168.231.133]) by mgwkm02.jp.fujitsu.com with smtp id 6e4f_bcaa_6bafa5ad_2071_415b_8ce9_332b3324768f; Fri, 24 Aug 2018 23:24:20 +0900 Received: from g01jpfmpwkw01.exch.g01.fujitsu.local (g01jpfmpwkw01.exch.g01.fujitsu.local [10.0.193.38]) by kw-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id B00A9AC0172 for ; Fri, 24 Aug 2018 23:24:19 +0900 (JST) Received: from G01JPEXCHKW13.g01.fujitsu.local (G01JPEXCHKW13.g01.fujitsu.local [10.0.194.52]) by g01jpfmpwkw01.exch.g01.fujitsu.local (Postfix) with ESMTP id 1611B692403 for ; Fri, 24 Aug 2018 23:24:19 +0900 (JST) Received: from G01JPEXMBKW03.g01.fujitsu.local ([10.0.194.67]) by g01jpexchkw13 ([10.0.194.52]) with mapi id 14.03.0352.000; Fri, 24 Aug 2018 23:24:19 +0900 From: "Zhang, Lei" To: "'linux-arm-kernel@lists.infradead.org'" Subject: [PATCH] tty: pl011:write to TXFIFO may miss some characters form interrupt routine Thread-Topic: [PATCH] tty: pl011:write to TXFIFO may miss some characters form interrupt routine Thread-Index: AdQ7tEaGU+yPCTllT7OsSBXGJMyuSQ== Date: Fri, 24 Aug 2018 14:24:17 +0000 Message-ID: <8898674D84E3B24BA3A2D289B872026A69F95F68@G01JPEXMBKW03> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-securitypolicycheck: OK by SHieldMailChecker v2.2.3 x-shieldmailcheckerpolicyversion: FJ-ISEC-20140219 x-originating-ip: [10.18.70.198] MIME-Version: 1.0 X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180824_073556_329866_3BEC7369 X-CRM114-Status: GOOD ( 10.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Write to TXFIFO form interrupt routine is not check the UART01x_FR_TXFF bit. However the writing will not stop until circ_buf(xmit) become empty. So when writing to TXFIFO, UART01x_FR_TXFF bit maybe set. The result is miss some characters form interrupt routine. Below is my patch to fix this problem. --- amba-pl011.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Best Regards, Lei Zhang zhang.lei@jp.fujitsu.com diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 4b40a5b..9ca9f37 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -1380,8 +1380,8 @@ __acquires(&uap->port.lock) static bool pl011_tx_char(struct uart_amba_port *uap, unsigned char c, bool from_irq) { - if (unlikely(!from_irq) && - pl011_read(uap, REG_FR) & UART01x_FR_TXFF) + /* Even from irq routine, we need to check UART01x_FR_TXFF bit */ + if ( pl011_read(uap, REG_FR) & UART01x_FR_TXFF) return false; /* unable to transmit character */ pl011_write(c, uap, REG_DR);