linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.9 53/90] serial: 8250_port: Don't service RX FIFO if throttled
       [not found] <20200918021455.2067301-1-sashal@kernel.org>
@ 2020-09-18  2:14 ` Sasha Levin
  2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 54/90] serial: 8250_omap: Fix sleeping function called from invalid context during probe Sasha Levin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2020-09-18  2:14 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vignesh Raghavendra, Greg Kroah-Hartman, Sasha Levin, linux-serial

From: Vignesh Raghavendra <vigneshr@ti.com>

[ Upstream commit f19c3f6c8109b8bab000afd35580929958e087a9 ]

When port's throttle callback is called, it should stop pushing any more
data into TTY buffer to avoid buffer overflow. This means driver has to
stop HW from receiving more data and assert the HW flow control. For
UARTs with auto HW flow control (such as 8250_omap) manual assertion of
flow control line is not possible and only way is to allow RX FIFO to
fill up, thus trigger auto HW flow control logic.

Therefore make sure that 8250 generic IRQ handler does not drain data
when port is stopped (i.e UART_LSR_DR is unset in read_status_mask). Not
servicing, RX FIFO would trigger auto HW flow control when FIFO
occupancy reaches preset threshold, thus halting RX.
Since, error conditions in UART_LSR register are cleared just by reading
the register, data has to be drained in case there are FIFO errors, else
error information will lost.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Link: https://lore.kernel.org/r/20200319103230.16867-2-vigneshr@ti.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/8250/8250_port.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 5641b877dca53..827a641ac336e 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1806,6 +1806,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
 	unsigned char status;
 	unsigned long flags;
 	struct uart_8250_port *up = up_to_u8250p(port);
+	bool skip_rx = false;
 
 	if (iir & UART_IIR_NO_INT)
 		return 0;
@@ -1814,7 +1815,20 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
 
 	status = serial_port_in(port, UART_LSR);
 
-	if (status & (UART_LSR_DR | UART_LSR_BI)) {
+	/*
+	 * If port is stopped and there are no error conditions in the
+	 * FIFO, then don't drain the FIFO, as this may lead to TTY buffer
+	 * overflow. Not servicing, RX FIFO would trigger auto HW flow
+	 * control when FIFO occupancy reaches preset threshold, thus
+	 * halting RX. This only works when auto HW flow control is
+	 * available.
+	 */
+	if (!(status & (UART_LSR_FIFOE | UART_LSR_BRK_ERROR_BITS)) &&
+	    (port->status & (UPSTAT_AUTOCTS | UPSTAT_AUTORTS)) &&
+	    !(port->read_status_mask & UART_LSR_DR))
+		skip_rx = true;
+
+	if (status & (UART_LSR_DR | UART_LSR_BI) && !skip_rx) {
 		if (!up->dma || handle_rx_dma(up, iir))
 			status = serial8250_rx_chars(up, status);
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH AUTOSEL 4.9 54/90] serial: 8250_omap: Fix sleeping function called from invalid context during probe
       [not found] <20200918021455.2067301-1-sashal@kernel.org>
  2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 53/90] serial: 8250_port: Don't service RX FIFO if throttled Sasha Levin
@ 2020-09-18  2:14 ` Sasha Levin
  2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 55/90] serial: 8250: 8250_omap: Terminate DMA before pushing data on RX timeout Sasha Levin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2020-09-18  2:14 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Peter Ujfalusi, Tomi Valkeinen, Greg Kroah-Hartman, Sasha Levin,
	linux-serial

From: Peter Ujfalusi <peter.ujfalusi@ti.com>

[ Upstream commit 4ce35a3617c0ac758c61122b2218b6c8c9ac9398 ]

When booting j721e the following bug is printed:

[    1.154821] BUG: sleeping function called from invalid context at kernel/sched/completion.c:99
[    1.154827] in_atomic(): 0, irqs_disabled(): 128, non_block: 0, pid: 12, name: kworker/0:1
[    1.154832] 3 locks held by kworker/0:1/12:
[    1.154836]  #0: ffff000840030728 ((wq_completion)events){+.+.}, at: process_one_work+0x1d4/0x6e8
[    1.154852]  #1: ffff80001214fdd8 (deferred_probe_work){+.+.}, at: process_one_work+0x1d4/0x6e8
[    1.154860]  #2: ffff00084060b170 (&dev->mutex){....}, at: __device_attach+0x38/0x138
[    1.154872] irq event stamp: 63096
[    1.154881] hardirqs last  enabled at (63095): [<ffff800010b74318>] _raw_spin_unlock_irqrestore+0x70/0x78
[    1.154887] hardirqs last disabled at (63096): [<ffff800010b740d8>] _raw_spin_lock_irqsave+0x28/0x80
[    1.154893] softirqs last  enabled at (62254): [<ffff800010080c88>] _stext+0x488/0x564
[    1.154899] softirqs last disabled at (62247): [<ffff8000100fdb3c>] irq_exit+0x114/0x140
[    1.154906] CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.6.0-rc6-next-20200318-00094-g45e4089b0bd3 #221
[    1.154911] Hardware name: Texas Instruments K3 J721E SoC (DT)
[    1.154917] Workqueue: events deferred_probe_work_func
[    1.154923] Call trace:
[    1.154928]  dump_backtrace+0x0/0x190
[    1.154933]  show_stack+0x14/0x20
[    1.154940]  dump_stack+0xe0/0x148
[    1.154946]  ___might_sleep+0x150/0x1f0
[    1.154952]  __might_sleep+0x4c/0x80
[    1.154957]  wait_for_completion_timeout+0x40/0x140
[    1.154964]  ti_sci_set_device_state+0xa0/0x158
[    1.154969]  ti_sci_cmd_get_device_exclusive+0x14/0x20
[    1.154977]  ti_sci_dev_start+0x34/0x50
[    1.154984]  genpd_runtime_resume+0x78/0x1f8
[    1.154991]  __rpm_callback+0x3c/0x140
[    1.154996]  rpm_callback+0x20/0x80
[    1.155001]  rpm_resume+0x568/0x758
[    1.155007]  __pm_runtime_resume+0x44/0xb0
[    1.155013]  omap8250_probe+0x2b4/0x508
[    1.155019]  platform_drv_probe+0x50/0xa0
[    1.155023]  really_probe+0xd4/0x318
[    1.155028]  driver_probe_device+0x54/0xe8
[    1.155033]  __device_attach_driver+0x80/0xb8
[    1.155039]  bus_for_each_drv+0x74/0xc0
[    1.155044]  __device_attach+0xdc/0x138
[    1.155049]  device_initial_probe+0x10/0x18
[    1.155053]  bus_probe_device+0x98/0xa0
[    1.155058]  deferred_probe_work_func+0x74/0xb0
[    1.155063]  process_one_work+0x280/0x6e8
[    1.155068]  worker_thread+0x48/0x430
[    1.155073]  kthread+0x108/0x138
[    1.155079]  ret_from_fork+0x10/0x18

To fix the bug we need to first call pm_runtime_enable() prior to any
pm_runtime calls.

Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20200320125200.6772-1-peter.ujfalusi@ti.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/8250/8250_omap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index a3adf21f9dcec..7d4680ef5307d 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -1194,11 +1194,11 @@ static int omap8250_probe(struct platform_device *pdev)
 	spin_lock_init(&priv->rx_dma_lock);
 
 	device_init_wakeup(&pdev->dev, true);
+	pm_runtime_enable(&pdev->dev);
 	pm_runtime_use_autosuspend(&pdev->dev);
 	pm_runtime_set_autosuspend_delay(&pdev->dev, -1);
 
 	pm_runtime_irq_safe(&pdev->dev);
-	pm_runtime_enable(&pdev->dev);
 
 	pm_runtime_get_sync(&pdev->dev);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH AUTOSEL 4.9 55/90] serial: 8250: 8250_omap: Terminate DMA before pushing data on RX timeout
       [not found] <20200918021455.2067301-1-sashal@kernel.org>
  2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 53/90] serial: 8250_port: Don't service RX FIFO if throttled Sasha Levin
  2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 54/90] serial: 8250_omap: Fix sleeping function called from invalid context during probe Sasha Levin
@ 2020-09-18  2:14 ` Sasha Levin
  2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 64/90] serial: uartps: Wait for tx_empty in console setup Sasha Levin
  2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 73/90] tty: serial: samsung: Correct clock selection logic Sasha Levin
  4 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2020-09-18  2:14 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vignesh Raghavendra, Greg Kroah-Hartman, Sasha Levin, linux-serial

From: Vignesh Raghavendra <vigneshr@ti.com>

[ Upstream commit 7cf4df30a98175033e9849f7f16c46e96ba47f41 ]

Terminate and flush DMA internal buffers, before pushing RX data to
higher layer. Otherwise, this will lead to data corruption, as driver
would end up pushing stale buffer data to higher layer while actual data
is still stuck inside DMA hardware and has yet not arrived at the
memory.
While at that, replace deprecated dmaengine_terminate_all() with
dmaengine_terminate_async().

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Link: https://lore.kernel.org/r/20200319110344.21348-2-vigneshr@ti.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/8250/8250_omap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 7d4680ef5307d..d41be02abced2 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -773,7 +773,10 @@ static void __dma_rx_do_complete(struct uart_8250_port *p)
 	dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
 
 	count = dma->rx_size - state.residue;
-
+	if (count < dma->rx_size)
+		dmaengine_terminate_async(dma->rxchan);
+	if (!count)
+		goto unlock;
 	ret = tty_insert_flip_string(tty_port, dma->rx_buf, count);
 
 	p->port.icount.rx += ret;
@@ -811,7 +814,6 @@ static void omap_8250_rx_dma_flush(struct uart_8250_port *p)
 	spin_unlock_irqrestore(&priv->rx_dma_lock, flags);
 
 	__dma_rx_do_complete(p);
-	dmaengine_terminate_all(dma->rxchan);
 }
 
 static int omap_8250_rx_dma(struct uart_8250_port *p)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH AUTOSEL 4.9 64/90] serial: uartps: Wait for tx_empty in console setup
       [not found] <20200918021455.2067301-1-sashal@kernel.org>
                   ` (2 preceding siblings ...)
  2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 55/90] serial: 8250: 8250_omap: Terminate DMA before pushing data on RX timeout Sasha Levin
@ 2020-09-18  2:14 ` Sasha Levin
  2020-09-28 20:11   ` Naresh Kamboju
  2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 73/90] tty: serial: samsung: Correct clock selection logic Sasha Levin
  4 siblings, 1 reply; 9+ messages in thread
From: Sasha Levin @ 2020-09-18  2:14 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Raviteja Narayanam, Shubhrajyoti Datta, Greg Kroah-Hartman,
	Sasha Levin, linux-serial, linux-arm-kernel

From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>

[ Upstream commit 42e11948ddf68b9f799cad8c0ddeab0a39da33e8 ]

On some platforms, the log is corrupted while console is being
registered. It is observed that when set_termios is called, there
are still some bytes in the FIFO to be transmitted.

So, wait for tx_empty inside cdns_uart_console_setup before calling
set_termios.

Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
Reviewed-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Link: https://lore.kernel.org/r/1586413563-29125-2-git-send-email-raviteja.narayanam@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/xilinx_uartps.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index eb61a07fcbbc3..07ea71a611678 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -1268,6 +1268,7 @@ static int cdns_uart_console_setup(struct console *co, char *options)
 	int bits = 8;
 	int parity = 'n';
 	int flow = 'n';
+	unsigned long time_out;
 
 	if (co->index < 0 || co->index >= CDNS_UART_NR_PORTS)
 		return -EINVAL;
@@ -1281,6 +1282,13 @@ static int cdns_uart_console_setup(struct console *co, char *options)
 	if (options)
 		uart_parse_options(options, &baud, &parity, &bits, &flow);
 
+	/* Wait for tx_empty before setting up the console */
+	time_out = jiffies + usecs_to_jiffies(TX_TIMEOUT);
+
+	while (time_before(jiffies, time_out) &&
+	       cdns_uart_tx_empty(port) != TIOCSER_TEMT)
+		cpu_relax();
+
 	return uart_set_options(port, co, baud, parity, bits, flow);
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH AUTOSEL 4.9 73/90] tty: serial: samsung: Correct clock selection logic
       [not found] <20200918021455.2067301-1-sashal@kernel.org>
                   ` (3 preceding siblings ...)
  2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 64/90] serial: uartps: Wait for tx_empty in console setup Sasha Levin
@ 2020-09-18  2:14 ` Sasha Levin
  4 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2020-09-18  2:14 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jonathan Bakker, Krzysztof Kozlowski, Greg Kroah-Hartman,
	Sasha Levin, linux-serial

From: Jonathan Bakker <xc-racer2@live.ca>

[ Upstream commit 7d31676a8d91dd18e08853efd1cb26961a38c6a6 ]

Some variants of the samsung tty driver can pick which clock
to use for their baud rate generation.  In the DT conversion,
a default clock was selected to be used if a specific one wasn't
assigned and then a comparison of which clock rate worked better
was done.  Unfortunately, the comparison was implemented in such
a way that only the default clock was ever actually compared.
Fix this by iterating through all possible clocks, except when a
specific clock has already been picked via clk_sel (which is
only possible via board files).

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/BN6PR04MB06604E63833EA41837EBF77BA3A30@BN6PR04MB0660.namprd04.prod.outlook.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/samsung.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 4dfdb59061bea..8c89697c53573 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1157,14 +1157,14 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport,
 	struct s3c24xx_uart_info *info = ourport->info;
 	struct clk *clk;
 	unsigned long rate;
-	unsigned int cnt, baud, quot, clk_sel, best_quot = 0;
+	unsigned int cnt, baud, quot, best_quot = 0;
 	char clkname[MAX_CLK_NAME_LENGTH];
 	int calc_deviation, deviation = (1 << 30) - 1;
 
-	clk_sel = (ourport->cfg->clk_sel) ? ourport->cfg->clk_sel :
-			ourport->info->def_clk_sel;
 	for (cnt = 0; cnt < info->num_clks; cnt++) {
-		if (!(clk_sel & (1 << cnt)))
+		/* Keep selected clock if provided */
+		if (ourport->cfg->clk_sel &&
+			!(ourport->cfg->clk_sel & (1 << cnt)))
 			continue;
 
 		sprintf(clkname, "clk_uart_baud%d", cnt);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH AUTOSEL 4.9 64/90] serial: uartps: Wait for tx_empty in console setup
  2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 64/90] serial: uartps: Wait for tx_empty in console setup Sasha Levin
@ 2020-09-28 20:11   ` Naresh Kamboju
  2020-09-28 20:13     ` Naresh Kamboju
  0 siblings, 1 reply; 9+ messages in thread
From: Naresh Kamboju @ 2020-09-28 20:11 UTC (permalink / raw)
  To: Sasha Levin, Raviteja Narayanam
  Cc: open list, linux- stable, Shubhrajyoti Datta, Greg Kroah-Hartman,
	linux-serial, Linux ARM, lkft-triage

On Fri, 18 Sep 2020 at 07:55, Sasha Levin <sashal@kernel.org> wrote:
>
> From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
>
> [ Upstream commit 42e11948ddf68b9f799cad8c0ddeab0a39da33e8 ]
>
> On some platforms, the log is corrupted while console is being
> registered. It is observed that when set_termios is called, there
> are still some bytes in the FIFO to be transmitted.
>
> So, wait for tx_empty inside cdns_uart_console_setup before calling
> set_termios.
>
> Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
> Reviewed-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> Link: https://lore.kernel.org/r/1586413563-29125-2-git-send-email-raviteja.narayanam@xilinx.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Sasha Levin <sashal@kernel.org>

stable rc 4.9 arm64 build broken.

drivers/tty/serial/xilinx_uartps.c: In function 'cdns_uart_console_setup':
drivers/tty/serial/xilinx_uartps.c:1286:40: error: 'TX_TIMEOUT'
undeclared (first use in this function); did you mean 'ETIMEDOUT'?
  time_out = jiffies + usecs_to_jiffies(TX_TIMEOUT);
                                        ^~~~~~~~~~
                                        ETIMEDOUT
drivers/tty/serial/xilinx_uartps.c:1286:40: note: each undeclared
identifier is reported only once for each function it appears in
  CC      drivers/usb/core/port.o
scripts/Makefile.build:304: recipe for target
'drivers/tty/serial/xilinx_uartps.o' failed
make[5]: *** [drivers/tty/serial/xilinx_uartps.o] Error 1

Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>

full test log link,
https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.9/DISTRO=lkft,MACHINE=hikey,label=docker-lkft/996/consoleText


> ---
>  drivers/tty/serial/xilinx_uartps.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
> index eb61a07fcbbc3..07ea71a611678 100644
> --- a/drivers/tty/serial/xilinx_uartps.c
> +++ b/drivers/tty/serial/xilinx_uartps.c
> @@ -1268,6 +1268,7 @@ static int cdns_uart_console_setup(struct console *co, char *options)
>         int bits = 8;
>         int parity = 'n';
>         int flow = 'n';
> +       unsigned long time_out;
>
>         if (co->index < 0 || co->index >= CDNS_UART_NR_PORTS)
>                 return -EINVAL;
> @@ -1281,6 +1282,13 @@ static int cdns_uart_console_setup(struct console *co, char *options)
>         if (options)
>                 uart_parse_options(options, &baud, &parity, &bits, &flow);
>
> +       /* Wait for tx_empty before setting up the console */
> +       time_out = jiffies + usecs_to_jiffies(TX_TIMEOUT);
> +
> +       while (time_before(jiffies, time_out) &&
> +              cdns_uart_tx_empty(port) != TIOCSER_TEMT)
> +               cpu_relax();
> +
>         return uart_set_options(port, co, baud, parity, bits, flow);
>  }
>
> --
> 2.25.1
>


-- 
Linaro LKFT
https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH AUTOSEL 4.9 64/90] serial: uartps: Wait for tx_empty in console setup
  2020-09-28 20:11   ` Naresh Kamboju
@ 2020-09-28 20:13     ` Naresh Kamboju
  2020-09-29  6:59       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 9+ messages in thread
From: Naresh Kamboju @ 2020-09-28 20:13 UTC (permalink / raw)
  To: Sasha Levin, Raviteja Narayanam
  Cc: open list, linux- stable, Shubhrajyoti Datta, Greg Kroah-Hartman,
	linux-serial, Linux ARM, lkft-triage

On Tue, 29 Sep 2020 at 01:41, Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
>
> On Fri, 18 Sep 2020 at 07:55, Sasha Levin <sashal@kernel.org> wrote:
> >
> > From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
> >
> > [ Upstream commit 42e11948ddf68b9f799cad8c0ddeab0a39da33e8 ]
> >
> > On some platforms, the log is corrupted while console is being
> > registered. It is observed that when set_termios is called, there
> > are still some bytes in the FIFO to be transmitted.
> >
> > So, wait for tx_empty inside cdns_uart_console_setup before calling
> > set_termios.
> >
> > Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
> > Reviewed-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> > Link: https://lore.kernel.org/r/1586413563-29125-2-git-send-email-raviteja.narayanam@xilinx.com
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Sasha Levin <sashal@kernel.org>
>
> stable rc 4.9 arm64 build broken.

and stable rc 4.9 arm build broken.

>
> drivers/tty/serial/xilinx_uartps.c: In function 'cdns_uart_console_setup':
> drivers/tty/serial/xilinx_uartps.c:1286:40: error: 'TX_TIMEOUT'
> undeclared (first use in this function); did you mean 'ETIMEDOUT'?
>   time_out = jiffies + usecs_to_jiffies(TX_TIMEOUT);
>                                         ^~~~~~~~~~
>                                         ETIMEDOUT
> drivers/tty/serial/xilinx_uartps.c:1286:40: note: each undeclared
> identifier is reported only once for each function it appears in
>   CC      drivers/usb/core/port.o
> scripts/Makefile.build:304: recipe for target
> 'drivers/tty/serial/xilinx_uartps.o' failed
> make[5]: *** [drivers/tty/serial/xilinx_uartps.o] Error 1
>
> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
>
> full test log link,
> https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-stable-rc-4.9/DISTRO=lkft,MACHINE=hikey,label=docker-lkft/996/consoleText
>
>
> > ---
> >  drivers/tty/serial/xilinx_uartps.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
> > index eb61a07fcbbc3..07ea71a611678 100644
> > --- a/drivers/tty/serial/xilinx_uartps.c
> > +++ b/drivers/tty/serial/xilinx_uartps.c
> > @@ -1268,6 +1268,7 @@ static int cdns_uart_console_setup(struct console *co, char *options)
> >         int bits = 8;
> >         int parity = 'n';
> >         int flow = 'n';
> > +       unsigned long time_out;
> >
> >         if (co->index < 0 || co->index >= CDNS_UART_NR_PORTS)
> >                 return -EINVAL;
> > @@ -1281,6 +1282,13 @@ static int cdns_uart_console_setup(struct console *co, char *options)
> >         if (options)
> >                 uart_parse_options(options, &baud, &parity, &bits, &flow);
> >
> > +       /* Wait for tx_empty before setting up the console */
> > +       time_out = jiffies + usecs_to_jiffies(TX_TIMEOUT);
> > +
> > +       while (time_before(jiffies, time_out) &&
> > +              cdns_uart_tx_empty(port) != TIOCSER_TEMT)
> > +               cpu_relax();
> > +
> >         return uart_set_options(port, co, baud, parity, bits, flow);
> >  }
> >
> > --
> > 2.25.1
> >
>
>
> --
> Linaro LKFT
> https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH AUTOSEL 4.9 64/90] serial: uartps: Wait for tx_empty in console setup
  2020-09-28 20:13     ` Naresh Kamboju
@ 2020-09-29  6:59       ` Greg Kroah-Hartman
  2020-09-29 17:39         ` Sasha Levin
  0 siblings, 1 reply; 9+ messages in thread
From: Greg Kroah-Hartman @ 2020-09-29  6:59 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: Sasha Levin, Raviteja Narayanam, open list, linux- stable,
	Shubhrajyoti Datta, linux-serial, Linux ARM, lkft-triage

On Tue, Sep 29, 2020 at 01:43:22AM +0530, Naresh Kamboju wrote:
> On Tue, 29 Sep 2020 at 01:41, Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
> >
> > On Fri, 18 Sep 2020 at 07:55, Sasha Levin <sashal@kernel.org> wrote:
> > >
> > > From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
> > >
> > > [ Upstream commit 42e11948ddf68b9f799cad8c0ddeab0a39da33e8 ]
> > >
> > > On some platforms, the log is corrupted while console is being
> > > registered. It is observed that when set_termios is called, there
> > > are still some bytes in the FIFO to be transmitted.
> > >
> > > So, wait for tx_empty inside cdns_uart_console_setup before calling
> > > set_termios.
> > >
> > > Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
> > > Reviewed-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> > > Link: https://lore.kernel.org/r/1586413563-29125-2-git-send-email-raviteja.narayanam@xilinx.com
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > Signed-off-by: Sasha Levin <sashal@kernel.org>
> >
> > stable rc 4.9 arm64 build broken.
> 
> and stable rc 4.9 arm build broken.

Thanks, I've queued up the dependant patch, somehow Sasha's builders
must have missed this :)

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH AUTOSEL 4.9 64/90] serial: uartps: Wait for tx_empty in console setup
  2020-09-29  6:59       ` Greg Kroah-Hartman
@ 2020-09-29 17:39         ` Sasha Levin
  0 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2020-09-29 17:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Naresh Kamboju, Raviteja Narayanam, open list, linux- stable,
	Shubhrajyoti Datta, linux-serial, Linux ARM, lkft-triage

On Tue, Sep 29, 2020 at 08:59:02AM +0200, Greg Kroah-Hartman wrote:
>On Tue, Sep 29, 2020 at 01:43:22AM +0530, Naresh Kamboju wrote:
>> On Tue, 29 Sep 2020 at 01:41, Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
>> >
>> > On Fri, 18 Sep 2020 at 07:55, Sasha Levin <sashal@kernel.org> wrote:
>> > >
>> > > From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
>> > >
>> > > [ Upstream commit 42e11948ddf68b9f799cad8c0ddeab0a39da33e8 ]
>> > >
>> > > On some platforms, the log is corrupted while console is being
>> > > registered. It is observed that when set_termios is called, there
>> > > are still some bytes in the FIFO to be transmitted.
>> > >
>> > > So, wait for tx_empty inside cdns_uart_console_setup before calling
>> > > set_termios.
>> > >
>> > > Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
>> > > Reviewed-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
>> > > Link: https://lore.kernel.org/r/1586413563-29125-2-git-send-email-raviteja.narayanam@xilinx.com
>> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> > > Signed-off-by: Sasha Levin <sashal@kernel.org>
>> >
>> > stable rc 4.9 arm64 build broken.
>>
>> and stable rc 4.9 arm build broken.
>
>Thanks, I've queued up the dependant patch, somehow Sasha's builders
>must have missed this :)

Because it doesn't fail here with an allmodconfig :(

sasha@sasha-builder:~/data/linux$ git checkout queue-4.9
HEAD is now at 77d58b1b4d54 kprobes: Fix to check probe enabled before disarm_kprobe_ftrace()
sasha@sasha-builder:~/data/linux$ make ARCH=arm64 CROSS_COMPILE="/home/sasha/x-tools/aarch64-unknown-linux-android/bin/aarch64-unknown-linux-android-" allmodconfig
scripts/kconfig/conf  --allmodconfig Kconfig
#
# configuration written to .config
#
sasha@sasha-builder:~/data/linux$ make ARCH=arm64 CROSS_COMPILE="/home/sasha/x-tools/aarch64-unknown-linux-gnu/bin/aarch64-unknown-linux-gnu-" drivers/tty/serial/xilinx_uartps.o
   CHK     include/config/kernel.release
   CHK     include/generated/uapi/linux/version.h
   CHK     include/generated/utsrelease.h
   CHK     include/generated/bounds.h
   CHK     include/generated/timeconst.h
   CHK     include/generated/asm-offsets.h
   CALL    scripts/checksyscalls.sh
   CHK     scripts/mod/devicetable-offsets.h
   CC [M]  drivers/tty/serial/xilinx_uartps.o

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-09-29 17:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200918021455.2067301-1-sashal@kernel.org>
2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 53/90] serial: 8250_port: Don't service RX FIFO if throttled Sasha Levin
2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 54/90] serial: 8250_omap: Fix sleeping function called from invalid context during probe Sasha Levin
2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 55/90] serial: 8250: 8250_omap: Terminate DMA before pushing data on RX timeout Sasha Levin
2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 64/90] serial: uartps: Wait for tx_empty in console setup Sasha Levin
2020-09-28 20:11   ` Naresh Kamboju
2020-09-28 20:13     ` Naresh Kamboju
2020-09-29  6:59       ` Greg Kroah-Hartman
2020-09-29 17:39         ` Sasha Levin
2020-09-18  2:14 ` [PATCH AUTOSEL 4.9 73/90] tty: serial: samsung: Correct clock selection logic Sasha Levin

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).