Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1316694pxj; Wed, 19 May 2021 03:20:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi2GVuZyF0rG8Tiv2WxRbvI15q/hCJYRpxHr1sd0NFfo4iF8B59PAEuS1mwgcz+qVEy+H6 X-Received: by 2002:aa7:c7d3:: with SMTP id o19mr13319557eds.142.1621419624647; Wed, 19 May 2021 03:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621419624; cv=none; d=google.com; s=arc-20160816; b=EgQOmfvRLWaw2fHidiqzMkm/Q5LB6F58J7MVsqjHO4FV/wiq9mgxQajqLVv6kEz19y Y6zOJtyu+uNcSPCGAuzY9Vsy/odJ1LgSJL++rPdWlzs+qv/U3JufyTepIpAtjNZvFyc2 Lw+ZMH1S/4Nlqo5jljXIjbQc3IPA2QbE9sMIV5xu0cdSsXFOGTBy8m7k+KAsg/+vt+fR WK8fyBBb3K87mqQ8hZyzEAsCRF0ZnjOsMisjKbrFOtfTEbr1woug3+4wogMHidcdB+TN TZYIKAXeionL7NNE+u/ymksmwLmyJkE7PehNLHgJ+uNbLVua4onruDeuqOZrT9r6rzJL 64iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:dkim-signature:dkim-signature; bh=0XYBfek4N1txXrYeiXMoQOHC8lS3/4SqSpfGCVp8qMo=; b=MBFIzHmedLpnmLroVth9weThCZOlx2STWdT1KlbYtjIWA9PH+NVdvNUlwSyV0RYQw6 xlY7KzVv3cnjS/HlS6HDKxuJliHD+k1L4KoIkwSqW/t/YFxJb6hrVctn3OkwtwgiE7U3 iLN/QHirA2PKWYXXDNC8mmHzKB3/QS3xf9qfTkUHLGGJuiVwyfnfKD4WhkslprmY9A5M RSA9PRMS/CCprJX90iUmz2UvDA309XWtNWcVX/jge85o7RzcN1o+db3drIjvEATkosmp NVAYq9uVC3SMk5oyq8CLFmO9wvYJSGFLpNRq22v71gjxP4Q8IQk9A8dZjm2hRK3H5TnK bDFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm2 header.b=aMzKAvTV; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=rsfkg6Gj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z21si12067791edq.367.2021.05.19.03.20.01; Wed, 19 May 2021 03:20:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm2 header.b=aMzKAvTV; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=rsfkg6Gj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345790AbhERBcU (ORCPT + 99 others); Mon, 17 May 2021 21:32:20 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:57273 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343677AbhERBcT (ORCPT ); Mon, 17 May 2021 21:32:19 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id C0ACF580FBB; Mon, 17 May 2021 21:31:01 -0400 (EDT) Received: from imap2 ([10.202.2.52]) by compute4.internal (MEProxy); Mon, 17 May 2021 21:31:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type; s=fm2; bh=0XYBfek4N1txXrYeiXMoQOHC8lS3/4S qSpfGCVp8qMo=; b=aMzKAvTVqrbFZlV3xb/oEkWBaNIEX2o+aYYBgch00bBDQ18 nkO2hWo/UmPcCVFr4nea8ca6/GLl479MAZsiOLrL2pxAd+3mOH1gqE89Ywgbpoza WjHdriaYYRfX4/gfgVH/3F3UXL7vneDi77eta9UDpHe1SB5339AH3CxHGWiQ9/cy f08ZVdPGIp5Bjk0Cq8f/U4EPi7znwOt+zWnHdYyTbNSFUeWbP9WRH7LUQ2PuCMkY HbapQwgbGOTgdVlsMEj8Q68qDn54nFyzQ6VLDszpPeHfC7JZessv4/IptV+RP1xY XyNEmOppI4uiQFES7xxzX3FagPm1J0BkK1D5Bdw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=0XYBfe k4N1txXrYeiXMoQOHC8lS3/4SqSpfGCVp8qMo=; b=rsfkg6GjjT9UmcnxXih8BD zi3KrOCpGEOV9FhcWD9jFmMDoaDWnKk+/VAxp63AAlwYwWGzcibNLS681AqKTrHd LTtMJaywBc7foBrqQVIGsYp15Espv8Adm/qxftrQIDWT6vf0yil/l4WBiHgGLkwk I/Ssx5Vm44/fKdhxOCyKWwVKWJ9AU51zhVVC9ioUh+OVcRF2I3My0U/VZ8i+VSn2 22yjhdG5oBEmAuXPXJaaMrqZWjuXB5zcn3smIsbEPtEpzWz7oN2TpdTp36gquuwD phhu9sdxTDaSqT1Jw9cQ3OwhEaNkvQXshKUDDTCqvGBBvEHcCLWpXJPM1uO7P/Ww == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeiiedggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreerjeenucfhrhhomhepfdetnhgu rhgvficulfgvfhhfvghrhidfuceorghnughrvgifsegrjhdrihgurdgruheqnecuggftrf grthhtvghrnhepffehuedvhefhgeekhfeigffftedtffefvedtueffteevfedttdetuedv hfffleegnecuffhomhgrihhnpehpohhrthdruggvvhenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvfiesrghjrdhiugdrrghu X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id F2E14A00079; Mon, 17 May 2021 21:31:00 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-448-gae190416c7-fm-20210505.004-gae190416 Mime-Version: 1.0 Message-Id: In-Reply-To: References: <20210517124105.3565860-1-andrew@aj.id.au> Date: Tue, 18 May 2021 11:00:39 +0930 From: "Andrew Jeffery" To: "Greg Kroah-Hartman" Cc: linux-serial@vger.kernel.org, "Jiri Slaby" , "Joel Stanley" , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, jenmin_yuan@aspeedtech.com, "Ryan Chen" , "Milton Miller II" , "Chia-Wei, Wang" Subject: =?UTF-8?Q?Re:_[PATCH]_tty:_8250:_Add_UART=5FBUG=5FTXRACE_workaround_for_?= =?UTF-8?Q?Aspeed_VUART?= Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 17 May 2021, at 23:45, Greg KH wrote: > On Mon, May 17, 2021 at 10:11:05PM +0930, Andrew Jeffery wrote: > > Aspeed Virtual UARTs directly bridge e.g. the system console UART on the > > LPC bus to the UART interface on the BMC's internal APB. As such there's > > no RS-232 signalling involved - the UART interfaces on each bus are > > directly connected as the producers and consumers of the one set of > > FIFOs. > > > > The APB in the AST2600 generally runs at 100MHz while the LPC bus peaks > > at 33MHz. The difference in clock speeds exposes a race in the VUART > > design where a Tx data burst on the APB interface can result in a byte > > lost on the LPC interface. The symptom is LSR[DR] remains clear on the > > LPC interface despite data being present in its Rx FIFO, while LSR[THRE] > > remains clear on the APB interface as the host has not consumed the data > > the BMC has transmitted. In this state, the UART has stalled and no > > further data can be transmitted without manual intervention (e.g. > > resetting the FIFOs, resulting in loss of data). > > > > The recommended work-around is to insert a read cycle on the APB > > interface between writes to THR. > > > > Cc: ChiaWei Wang > > Signed-off-by: Andrew Jeffery > > --- > > drivers/tty/serial/8250/8250.h | 1 + > > drivers/tty/serial/8250/8250_aspeed_vuart.c | 1 + > > drivers/tty/serial/8250/8250_port.c | 2 ++ > > 3 files changed, 4 insertions(+) > > > > diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h > > index 52bb21205bb6..4d6f5e0ecd4c 100644 > > --- a/drivers/tty/serial/8250/8250.h > > +++ b/drivers/tty/serial/8250/8250.h > > @@ -88,6 +88,7 @@ struct serial8250_config { > > #define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */ > > #define UART_BUG_THRE (1 << 3) /* UART has buggy THRE reassertion */ > > #define UART_BUG_PARITY (1 << 4) /* UART mishandles parity if FIFO enabled */ > > +#define UART_BUG_TXRACE (1 << 5) /* UART Tx fails to set remote DR */ > > BUG()? Can you please expand on what you mean here? I don't follow. At least, I think there might be a formatting issue (spaces vs tabs). > > > #ifdef CONFIG_SERIAL_8250_SHARE_IRQ > > diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c > > index a28a394ba32a..4caab8714e2c 100644 > > --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c > > +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c > > @@ -440,6 +440,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev) > > port.port.status = UPSTAT_SYNC_FIFO; > > port.port.dev = &pdev->dev; > > port.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); > > + port.bugs |= UART_BUG_TXRACE; > > > > rc = sysfs_create_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); > > if (rc < 0) > > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c > > index d45dab1ab316..6c032abfc321 100644 > > --- a/drivers/tty/serial/8250/8250_port.c > > +++ b/drivers/tty/serial/8250/8250_port.c > > @@ -1809,6 +1809,8 @@ void serial8250_tx_chars(struct uart_8250_port *up) > > count = up->tx_loadsz; > > do { > > serial_out(up, UART_TX, xmit->buf[xmit->tail]); > > + if (up->bugs & UART_BUG_TXRACE) > > + serial_in(up, UART_SCR); > > Can you document why you are doing a call here to serial_in(), otherwise > someone running "automated checking scripts" will remove it later as it > seems to be doing nothing. Good point, I'll add a comment. Thanks, Andrew