From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Kroah-Hartman Date: Thu, 10 Feb 2022 09:20:12 +0100 Subject: [PATCH] serial: 8250_aspeed_vuart: add PORT_ASPEED_VUART port type In-Reply-To: References: <20220209203414.23491-1-zev@bewilderbeest.net> Message-ID: List-Id: To: linux-aspeed@lists.ozlabs.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Wed, Feb 09, 2022 at 11:49:47PM -0800, Zev Weiss wrote: > On Wed, Feb 09, 2022 at 11:40:42PM PST, Greg Kroah-Hartman wrote: > > On Wed, Feb 09, 2022 at 12:34:14PM -0800, Zev Weiss wrote: > > > Commit 54da3e381c2b ("serial: 8250_aspeed_vuart: use UPF_IOREMAP to > > > set up register mapping") fixed a bug that had, as a side-effect, > > > prevented the 8250_aspeed_vuart driver from enabling the VUART's > > > FIFOs. However, fixing that (and hence enabling the FIFOs) has in > > > turn revealed what appears to be a hardware bug in the ASPEED VUART in > > > which the host-side THRE bit doesn't get if the BMC-side receive FIFO > > > trigger level is set to anything but one byte. This causes problems > > > for polled-mode writes from the host -- for example, Linux kernel > > > console writes proceed at a glacial pace (less than 100 bytes per > > > second) because the write path waits for a 10ms timeout to expire > > > after every character instead of being able to continue on to the next > > > character upon seeing THRE asserted. (GRUB behaves similarly.) > > > > > > As a workaround, introduce a new port type for the ASPEED VUART that's > > > identical to PORT_16550A as it had previously been using, but with > > > UART_FCR_R_TRIG_00 instead to set the receive FIFO trigger level to > > > one byte, which (experimentally) seems to avoid the problematic THRE > > > behavior. > > > > > > Signed-off-by: Zev Weiss > > > Tested-by: Konstantin Aladyshev > > > > Do we need a "Fixes:" tag here as well? > > I was wondering the same -- I left it out because it didn't seem like it was > strictly a bug in the earlier commit that's really being fixed per se, but > perhaps that's an overly pedantic distinction. I can certainly add it if > you'd prefer. This obviously fixes an issue, if you don't have a specific commit that caused it, a cc: stable at vger.kernel.org should be added so we know to backport this to all stable kernels. > > > > > > --- > > > drivers/tty/serial/8250/8250_aspeed_vuart.c | 2 +- > > > drivers/tty/serial/8250/8250_port.c | 8 ++++++++ > > > include/uapi/linux/serial_core.h | 3 +++ > > > 3 files changed, 12 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c > > > index 2350fb3bb5e4..c2cecc6f47db 100644 > > > --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c > > > +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c > > > @@ -487,7 +487,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev) > > > port.port.irq = irq_of_parse_and_map(np, 0); > > > port.port.handle_irq = aspeed_vuart_handle_irq; > > > port.port.iotype = UPIO_MEM; > > > - port.port.type = PORT_16550A; > > > + port.port.type = PORT_ASPEED_VUART; > > > port.port.uartclk = clk; > > > port.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP > > > | UPF_FIXED_PORT | UPF_FIXED_TYPE | UPF_NO_THRE_TEST; > > > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c > > > index 3b12bfc1ed67..973870ebff69 100644 > > > --- a/drivers/tty/serial/8250/8250_port.c > > > +++ b/drivers/tty/serial/8250/8250_port.c > > > @@ -307,6 +307,14 @@ static const struct serial8250_config uart_config[] = { > > > .rxtrig_bytes = {1, 32, 64, 112}, > > > .flags = UART_CAP_FIFO | UART_CAP_SLEEP, > > > }, > > > + [PORT_ASPEED_VUART] = { > > > + .name = "ASPEED VUART", > > > + .fifo_size = 16, > > > + .tx_loadsz = 16, > > > + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00, > > > + .rxtrig_bytes = {1, 4, 8, 14}, > > > + .flags = UART_CAP_FIFO, > > > + }, > > > }; > > > > > > /* Uart divisor latch read */ > > > diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h > > > index c4042dcfdc0c..cd11748833e6 100644 > > > --- a/include/uapi/linux/serial_core.h > > > +++ b/include/uapi/linux/serial_core.h > > > @@ -274,4 +274,7 @@ > > > /* Freescale LINFlexD UART */ > > > #define PORT_LINFLEXUART 122 > > > > > > +/* ASPEED AST2x00 virtual UART */ > > > +#define PORT_ASPEED_VUART 123 > > > > Why does this value have to be in a uapi header file? What userspace > > tool is going to need this? > > > > I only put it there because that was where all the other port type constants > were defined, and wondered the same thing about the lot of them. Is there a > userspace tool that makes use of any of these? Not really, please don't add it if you do not require it. thanks, greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDE6AC433EF for ; Thu, 10 Feb 2022 08:20:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237294AbiBJIUU (ORCPT ); Thu, 10 Feb 2022 03:20:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233615AbiBJIUQ (ORCPT ); Thu, 10 Feb 2022 03:20:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5391DA9; Thu, 10 Feb 2022 00:20:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8D00BB82423; Thu, 10 Feb 2022 08:20:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C442C004E1; Thu, 10 Feb 2022 08:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644481215; bh=8gIcfyW0sMk2anZv0r3OTynsNPwDNEkdR7Q4n+X25TA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VASQNFNAN2Xg9L8/Klk8/VrzOEmUx0wMjG2l+z74A2KESayDfgZ2ciFz8nJCH/93f X+oZwtCEpF4rRrnbOPqj1w7nO4kUY0Qz+OZQ09xQyGr/TaO/rP50YMMvRLlaSeYYqD qDoabWhqURNMnseklYF4Uf4lG6rSLHORINqWwFQw= Date: Thu, 10 Feb 2022 09:20:12 +0100 From: Greg Kroah-Hartman To: Zev Weiss Cc: Joel Stanley , Andrew Jeffery , Jiri Slaby , Andy Shevchenko , Konstantin Aladyshev , Oskar Senft , openbmc@lists.ozlabs.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] serial: 8250_aspeed_vuart: add PORT_ASPEED_VUART port type Message-ID: References: <20220209203414.23491-1-zev@bewilderbeest.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org On Wed, Feb 09, 2022 at 11:49:47PM -0800, Zev Weiss wrote: > On Wed, Feb 09, 2022 at 11:40:42PM PST, Greg Kroah-Hartman wrote: > > On Wed, Feb 09, 2022 at 12:34:14PM -0800, Zev Weiss wrote: > > > Commit 54da3e381c2b ("serial: 8250_aspeed_vuart: use UPF_IOREMAP to > > > set up register mapping") fixed a bug that had, as a side-effect, > > > prevented the 8250_aspeed_vuart driver from enabling the VUART's > > > FIFOs. However, fixing that (and hence enabling the FIFOs) has in > > > turn revealed what appears to be a hardware bug in the ASPEED VUART in > > > which the host-side THRE bit doesn't get if the BMC-side receive FIFO > > > trigger level is set to anything but one byte. This causes problems > > > for polled-mode writes from the host -- for example, Linux kernel > > > console writes proceed at a glacial pace (less than 100 bytes per > > > second) because the write path waits for a 10ms timeout to expire > > > after every character instead of being able to continue on to the next > > > character upon seeing THRE asserted. (GRUB behaves similarly.) > > > > > > As a workaround, introduce a new port type for the ASPEED VUART that's > > > identical to PORT_16550A as it had previously been using, but with > > > UART_FCR_R_TRIG_00 instead to set the receive FIFO trigger level to > > > one byte, which (experimentally) seems to avoid the problematic THRE > > > behavior. > > > > > > Signed-off-by: Zev Weiss > > > Tested-by: Konstantin Aladyshev > > > > Do we need a "Fixes:" tag here as well? > > I was wondering the same -- I left it out because it didn't seem like it was > strictly a bug in the earlier commit that's really being fixed per se, but > perhaps that's an overly pedantic distinction. I can certainly add it if > you'd prefer. This obviously fixes an issue, if you don't have a specific commit that caused it, a cc: stable@vger.kernel.org should be added so we know to backport this to all stable kernels. > > > > > > --- > > > drivers/tty/serial/8250/8250_aspeed_vuart.c | 2 +- > > > drivers/tty/serial/8250/8250_port.c | 8 ++++++++ > > > include/uapi/linux/serial_core.h | 3 +++ > > > 3 files changed, 12 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c > > > index 2350fb3bb5e4..c2cecc6f47db 100644 > > > --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c > > > +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c > > > @@ -487,7 +487,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev) > > > port.port.irq = irq_of_parse_and_map(np, 0); > > > port.port.handle_irq = aspeed_vuart_handle_irq; > > > port.port.iotype = UPIO_MEM; > > > - port.port.type = PORT_16550A; > > > + port.port.type = PORT_ASPEED_VUART; > > > port.port.uartclk = clk; > > > port.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP > > > | UPF_FIXED_PORT | UPF_FIXED_TYPE | UPF_NO_THRE_TEST; > > > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c > > > index 3b12bfc1ed67..973870ebff69 100644 > > > --- a/drivers/tty/serial/8250/8250_port.c > > > +++ b/drivers/tty/serial/8250/8250_port.c > > > @@ -307,6 +307,14 @@ static const struct serial8250_config uart_config[] = { > > > .rxtrig_bytes = {1, 32, 64, 112}, > > > .flags = UART_CAP_FIFO | UART_CAP_SLEEP, > > > }, > > > + [PORT_ASPEED_VUART] = { > > > + .name = "ASPEED VUART", > > > + .fifo_size = 16, > > > + .tx_loadsz = 16, > > > + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00, > > > + .rxtrig_bytes = {1, 4, 8, 14}, > > > + .flags = UART_CAP_FIFO, > > > + }, > > > }; > > > > > > /* Uart divisor latch read */ > > > diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h > > > index c4042dcfdc0c..cd11748833e6 100644 > > > --- a/include/uapi/linux/serial_core.h > > > +++ b/include/uapi/linux/serial_core.h > > > @@ -274,4 +274,7 @@ > > > /* Freescale LINFlexD UART */ > > > #define PORT_LINFLEXUART 122 > > > > > > +/* ASPEED AST2x00 virtual UART */ > > > +#define PORT_ASPEED_VUART 123 > > > > Why does this value have to be in a uapi header file? What userspace > > tool is going to need this? > > > > I only put it there because that was where all the other port type constants > were defined, and wondered the same thing about the lot of them. Is there a > userspace tool that makes use of any of these? Not really, please don't add it if you do not require it. thanks, greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9441BC433F5 for ; Thu, 10 Feb 2022 08:20:58 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JvV7X4vNdz3bb2 for ; Thu, 10 Feb 2022 19:20:56 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=VASQNFNA; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linuxfoundation.org (client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=gregkh@linuxfoundation.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=VASQNFNA; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4JvV6p1lN0z30Pf; Thu, 10 Feb 2022 19:20:16 +1100 (AEDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D250615D3; Thu, 10 Feb 2022 08:20:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C442C004E1; Thu, 10 Feb 2022 08:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644481215; bh=8gIcfyW0sMk2anZv0r3OTynsNPwDNEkdR7Q4n+X25TA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VASQNFNAN2Xg9L8/Klk8/VrzOEmUx0wMjG2l+z74A2KESayDfgZ2ciFz8nJCH/93f X+oZwtCEpF4rRrnbOPqj1w7nO4kUY0Qz+OZQ09xQyGr/TaO/rP50YMMvRLlaSeYYqD qDoabWhqURNMnseklYF4Uf4lG6rSLHORINqWwFQw= Date: Thu, 10 Feb 2022 09:20:12 +0100 From: Greg Kroah-Hartman To: Zev Weiss Subject: Re: [PATCH] serial: 8250_aspeed_vuart: add PORT_ASPEED_VUART port type Message-ID: References: <20220209203414.23491-1-zev@bewilderbeest.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-aspeed@lists.ozlabs.org, Konstantin Aladyshev , Andrew Jeffery , openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, Oskar Senft , linux-serial@vger.kernel.org, Andy Shevchenko , Jiri Slaby , linux-arm-kernel@lists.infradead.org Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" On Wed, Feb 09, 2022 at 11:49:47PM -0800, Zev Weiss wrote: > On Wed, Feb 09, 2022 at 11:40:42PM PST, Greg Kroah-Hartman wrote: > > On Wed, Feb 09, 2022 at 12:34:14PM -0800, Zev Weiss wrote: > > > Commit 54da3e381c2b ("serial: 8250_aspeed_vuart: use UPF_IOREMAP to > > > set up register mapping") fixed a bug that had, as a side-effect, > > > prevented the 8250_aspeed_vuart driver from enabling the VUART's > > > FIFOs. However, fixing that (and hence enabling the FIFOs) has in > > > turn revealed what appears to be a hardware bug in the ASPEED VUART in > > > which the host-side THRE bit doesn't get if the BMC-side receive FIFO > > > trigger level is set to anything but one byte. This causes problems > > > for polled-mode writes from the host -- for example, Linux kernel > > > console writes proceed at a glacial pace (less than 100 bytes per > > > second) because the write path waits for a 10ms timeout to expire > > > after every character instead of being able to continue on to the next > > > character upon seeing THRE asserted. (GRUB behaves similarly.) > > > > > > As a workaround, introduce a new port type for the ASPEED VUART that's > > > identical to PORT_16550A as it had previously been using, but with > > > UART_FCR_R_TRIG_00 instead to set the receive FIFO trigger level to > > > one byte, which (experimentally) seems to avoid the problematic THRE > > > behavior. > > > > > > Signed-off-by: Zev Weiss > > > Tested-by: Konstantin Aladyshev > > > > Do we need a "Fixes:" tag here as well? > > I was wondering the same -- I left it out because it didn't seem like it was > strictly a bug in the earlier commit that's really being fixed per se, but > perhaps that's an overly pedantic distinction. I can certainly add it if > you'd prefer. This obviously fixes an issue, if you don't have a specific commit that caused it, a cc: stable@vger.kernel.org should be added so we know to backport this to all stable kernels. > > > > > > --- > > > drivers/tty/serial/8250/8250_aspeed_vuart.c | 2 +- > > > drivers/tty/serial/8250/8250_port.c | 8 ++++++++ > > > include/uapi/linux/serial_core.h | 3 +++ > > > 3 files changed, 12 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c > > > index 2350fb3bb5e4..c2cecc6f47db 100644 > > > --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c > > > +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c > > > @@ -487,7 +487,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev) > > > port.port.irq = irq_of_parse_and_map(np, 0); > > > port.port.handle_irq = aspeed_vuart_handle_irq; > > > port.port.iotype = UPIO_MEM; > > > - port.port.type = PORT_16550A; > > > + port.port.type = PORT_ASPEED_VUART; > > > port.port.uartclk = clk; > > > port.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP > > > | UPF_FIXED_PORT | UPF_FIXED_TYPE | UPF_NO_THRE_TEST; > > > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c > > > index 3b12bfc1ed67..973870ebff69 100644 > > > --- a/drivers/tty/serial/8250/8250_port.c > > > +++ b/drivers/tty/serial/8250/8250_port.c > > > @@ -307,6 +307,14 @@ static const struct serial8250_config uart_config[] = { > > > .rxtrig_bytes = {1, 32, 64, 112}, > > > .flags = UART_CAP_FIFO | UART_CAP_SLEEP, > > > }, > > > + [PORT_ASPEED_VUART] = { > > > + .name = "ASPEED VUART", > > > + .fifo_size = 16, > > > + .tx_loadsz = 16, > > > + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00, > > > + .rxtrig_bytes = {1, 4, 8, 14}, > > > + .flags = UART_CAP_FIFO, > > > + }, > > > }; > > > > > > /* Uart divisor latch read */ > > > diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h > > > index c4042dcfdc0c..cd11748833e6 100644 > > > --- a/include/uapi/linux/serial_core.h > > > +++ b/include/uapi/linux/serial_core.h > > > @@ -274,4 +274,7 @@ > > > /* Freescale LINFlexD UART */ > > > #define PORT_LINFLEXUART 122 > > > > > > +/* ASPEED AST2x00 virtual UART */ > > > +#define PORT_ASPEED_VUART 123 > > > > Why does this value have to be in a uapi header file? What userspace > > tool is going to need this? > > > > I only put it there because that was where all the other port type constants > were defined, and wondered the same thing about the lot of them. Is there a > userspace tool that makes use of any of these? Not really, please don't add it if you do not require it. thanks, greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4FA4BC433EF for ; Thu, 10 Feb 2022 08:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZgVzfMtrYzVMY+P1hAMO3zafQ988xVNTuipoRy75FEI=; b=qL32w5+dL4qobA kfEvCJXzOi4zvrVMPHwA4QHc+DTDGbv+ukvi8adPmQHtQBKgkmXb1hApj9XWJcCWu/pRFjZfx3DTz MLXwGJdTb/hUTAjtxF8mMP2vMrTeJk76RXfHVw9Sq+FnqwTRaeoXj7Jee8o/3cwzYDpM0OTZ5lX4H 58lIcEMSvNe9m1AItJgV6qo184Tcy2L8aP8TUCOxz+Q9Bx7SDF5pXYX7FzslCxeVL3o+bk3dSYcBp Ze9qHTaocR/f9pvwTRah5pTUpDtnTbVFH9zXlxyY9hiyWdUIbfNmrrcMjN7kOeEvM1YmPGcZlatED zGSkcVvcTSUTch1yUxBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nI4ge-0033U2-Ez; Thu, 10 Feb 2022 08:20:20 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nI4gZ-0033TE-RQ for linux-arm-kernel@lists.infradead.org; Thu, 10 Feb 2022 08:20:17 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D250615D3; Thu, 10 Feb 2022 08:20:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C442C004E1; Thu, 10 Feb 2022 08:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644481215; bh=8gIcfyW0sMk2anZv0r3OTynsNPwDNEkdR7Q4n+X25TA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VASQNFNAN2Xg9L8/Klk8/VrzOEmUx0wMjG2l+z74A2KESayDfgZ2ciFz8nJCH/93f X+oZwtCEpF4rRrnbOPqj1w7nO4kUY0Qz+OZQ09xQyGr/TaO/rP50YMMvRLlaSeYYqD qDoabWhqURNMnseklYF4Uf4lG6rSLHORINqWwFQw= Date: Thu, 10 Feb 2022 09:20:12 +0100 From: Greg Kroah-Hartman To: Zev Weiss Cc: Joel Stanley , Andrew Jeffery , Jiri Slaby , Andy Shevchenko , Konstantin Aladyshev , Oskar Senft , openbmc@lists.ozlabs.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] serial: 8250_aspeed_vuart: add PORT_ASPEED_VUART port type Message-ID: References: <20220209203414.23491-1-zev@bewilderbeest.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220210_002016_011075_2E817809 X-CRM114-Status: GOOD ( 40.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 09, 2022 at 11:49:47PM -0800, Zev Weiss wrote: > On Wed, Feb 09, 2022 at 11:40:42PM PST, Greg Kroah-Hartman wrote: > > On Wed, Feb 09, 2022 at 12:34:14PM -0800, Zev Weiss wrote: > > > Commit 54da3e381c2b ("serial: 8250_aspeed_vuart: use UPF_IOREMAP to > > > set up register mapping") fixed a bug that had, as a side-effect, > > > prevented the 8250_aspeed_vuart driver from enabling the VUART's > > > FIFOs. However, fixing that (and hence enabling the FIFOs) has in > > > turn revealed what appears to be a hardware bug in the ASPEED VUART in > > > which the host-side THRE bit doesn't get if the BMC-side receive FIFO > > > trigger level is set to anything but one byte. This causes problems > > > for polled-mode writes from the host -- for example, Linux kernel > > > console writes proceed at a glacial pace (less than 100 bytes per > > > second) because the write path waits for a 10ms timeout to expire > > > after every character instead of being able to continue on to the next > > > character upon seeing THRE asserted. (GRUB behaves similarly.) > > > > > > As a workaround, introduce a new port type for the ASPEED VUART that's > > > identical to PORT_16550A as it had previously been using, but with > > > UART_FCR_R_TRIG_00 instead to set the receive FIFO trigger level to > > > one byte, which (experimentally) seems to avoid the problematic THRE > > > behavior. > > > > > > Signed-off-by: Zev Weiss > > > Tested-by: Konstantin Aladyshev > > > > Do we need a "Fixes:" tag here as well? > > I was wondering the same -- I left it out because it didn't seem like it was > strictly a bug in the earlier commit that's really being fixed per se, but > perhaps that's an overly pedantic distinction. I can certainly add it if > you'd prefer. This obviously fixes an issue, if you don't have a specific commit that caused it, a cc: stable@vger.kernel.org should be added so we know to backport this to all stable kernels. > > > > > > --- > > > drivers/tty/serial/8250/8250_aspeed_vuart.c | 2 +- > > > drivers/tty/serial/8250/8250_port.c | 8 ++++++++ > > > include/uapi/linux/serial_core.h | 3 +++ > > > 3 files changed, 12 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c > > > index 2350fb3bb5e4..c2cecc6f47db 100644 > > > --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c > > > +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c > > > @@ -487,7 +487,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev) > > > port.port.irq = irq_of_parse_and_map(np, 0); > > > port.port.handle_irq = aspeed_vuart_handle_irq; > > > port.port.iotype = UPIO_MEM; > > > - port.port.type = PORT_16550A; > > > + port.port.type = PORT_ASPEED_VUART; > > > port.port.uartclk = clk; > > > port.port.flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP > > > | UPF_FIXED_PORT | UPF_FIXED_TYPE | UPF_NO_THRE_TEST; > > > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c > > > index 3b12bfc1ed67..973870ebff69 100644 > > > --- a/drivers/tty/serial/8250/8250_port.c > > > +++ b/drivers/tty/serial/8250/8250_port.c > > > @@ -307,6 +307,14 @@ static const struct serial8250_config uart_config[] = { > > > .rxtrig_bytes = {1, 32, 64, 112}, > > > .flags = UART_CAP_FIFO | UART_CAP_SLEEP, > > > }, > > > + [PORT_ASPEED_VUART] = { > > > + .name = "ASPEED VUART", > > > + .fifo_size = 16, > > > + .tx_loadsz = 16, > > > + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00, > > > + .rxtrig_bytes = {1, 4, 8, 14}, > > > + .flags = UART_CAP_FIFO, > > > + }, > > > }; > > > > > > /* Uart divisor latch read */ > > > diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h > > > index c4042dcfdc0c..cd11748833e6 100644 > > > --- a/include/uapi/linux/serial_core.h > > > +++ b/include/uapi/linux/serial_core.h > > > @@ -274,4 +274,7 @@ > > > /* Freescale LINFlexD UART */ > > > #define PORT_LINFLEXUART 122 > > > > > > +/* ASPEED AST2x00 virtual UART */ > > > +#define PORT_ASPEED_VUART 123 > > > > Why does this value have to be in a uapi header file? What userspace > > tool is going to need this? > > > > I only put it there because that was where all the other port type constants > were defined, and wondered the same thing about the lot of them. Is there a > userspace tool that makes use of any of these? Not really, please don't add it if you do not require it. thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel