Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3286327pxk; Mon, 28 Sep 2020 13:15:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfxwOEYsNnUJzqGZtS1euCuojcJB5dmnauKr/jIOhTq2L+u1SlQGxdGI1HWtLV3+yygQd4 X-Received: by 2002:a17:906:d787:: with SMTP id pj7mr468609ejb.340.1601324117165; Mon, 28 Sep 2020 13:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601324117; cv=none; d=google.com; s=arc-20160816; b=wlAbgpqBOq2f3c1pDIM6or2WIPrO7eQByblclCMQY1snwIK9Of2muFU1bt4yqqYLPA XoI1SBmlYUabjH2taZeb8QwIUqXGXU8aTewPtbn5/HUOfdsK/p/IO6fc65FETuBZiQg6 1Vaw3IPkvI4d9z9fYKfJRgIpHQTMvxsT96oFnqhu3Kk+/0h4HvTmbGdBNDBQXplD/ALF FcfNkgoGT85N8TGVpNnxZfi5b1cu1dUtqrgOtv4btd8xMsLRGP3AQKmL7kq3n46HDIDm KiQuMe0QX8VYsAULgtXJoSgN0g37lj6RUao+Q6zefQJoI73mgWVPUFFEb5LwOYxMYAEd xYWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KKmy3/ej2CG/v3dkID5ukRA7UHlXu83nJYoCeRGRTRo=; b=a1upsh8iASFHbZ5yL898dJ3uNX9amsFaem5Y73VpAUVC/X0LdGr1NIzUQhsP8TGGtw Q0tjUK9n72N2tk7Bzipkc1tj520h0af4kECUKjc0wn99vomLE6O0iDnwvC7LMXVP/VU+ AP2nCVq2qAjn1+AuNJqp1RJa8cn/3g0Vm/7CAxPpKrt4dVzTJl6rDA3MIoLajetzQf2l YifKx9qsO/ASHiJuxaEQjOcT2S5bfxft9iD230EeuCnTARPGKHXka9U3rOr37N2fPWUq NLPl5UVvmKvjdZ51GMZktB/zFRpunoNG0HpSJ7rm/uLhQMVKyWBk7GtV+8nAqoSIMTG7 3+aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NhgBjcSW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp1si1356661ejc.307.2020.09.28.13.14.53; Mon, 28 Sep 2020 13:15:17 -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=@linaro.org header.s=google header.b=NhgBjcSW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726551AbgI1UNg (ORCPT + 99 others); Mon, 28 Sep 2020 16:13:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726325AbgI1UNf (ORCPT ); Mon, 28 Sep 2020 16:13:35 -0400 Received: from mail-ua1-x941.google.com (mail-ua1-x941.google.com [IPv6:2607:f8b0:4864:20::941]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91C51C061755 for ; Mon, 28 Sep 2020 13:13:35 -0700 (PDT) Received: by mail-ua1-x941.google.com with SMTP id g16so2645755uan.5 for ; Mon, 28 Sep 2020 13:13:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KKmy3/ej2CG/v3dkID5ukRA7UHlXu83nJYoCeRGRTRo=; b=NhgBjcSWcCYK10M+tDx1DDwEk6saRHYtvQn59YqnUfvnHVEsjdmilUF+vAUFKNYLGO 6+TNQntYCawfDFXwINjvm7om9UoL6Dss7U+J8Wwrdl4WU1uaCyNFG+L49KJKgtwvgH0A b8mMxxbeh2QZFZ6eshOWl+iaLY/zchPMuZ2WxSUDreGjobMd8CsEKUteNwBT6+DdYy8W 3Wyxor8traemXBLiIwZvoRZa+QCN+WnOdYuWqqIXTPIr/CkDkgntnH+TghUuPLJ567s1 2eTQV1lxJ/my3nOSTTVCrDyL/XNFD40eUW5dvgdPCm1HhAewyYKL9qfPO7NHNxMItAXh YBGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KKmy3/ej2CG/v3dkID5ukRA7UHlXu83nJYoCeRGRTRo=; b=OL3D/M+b8w0alJWAZlELu/lR8uSoWF8ZG3CiJdqIE/vyX3hHG3UdW0p5GCDGONCdGY BWhGelrqIzVChZaLwl65glzIsa5CQ9Q8MI1Vl3iZ3wxFfnDDB6qYkycsUbo/2YKIVzLU W0nTH5GqkEnCehPdKUFRo6OuW0fjcz5suv7zYiYC39lcImbKVsog1al1K8zd0pZXDX0q xaCojBzexqa2//8m0HQuBPjNbpH8fpVuaMjNipelUkVyMbGVCJ0I6AMYmv+qV9XhUvGl ybKWFqphD1P0JPiWLw2Byivwqgpwd1d+xhizqlMLVrYMbYD06kABPt9/09GVFedzU9x2 gaRQ== X-Gm-Message-State: AOAM533m3wYlsxG49NzLQhlMjtI0zveuOLU7i4MSXPIqPO0k88D5pNI8 0ugCwKgH/cph2lgLcRpQ+S6tvohbghmaKcutiV7RDA== X-Received: by 2002:ab0:2c1a:: with SMTP id l26mr2140518uar.6.1601324014711; Mon, 28 Sep 2020 13:13:34 -0700 (PDT) MIME-Version: 1.0 References: <20200918021455.2067301-1-sashal@kernel.org> <20200918021455.2067301-64-sashal@kernel.org> In-Reply-To: From: Naresh Kamboju Date: Tue, 29 Sep 2020 01:43:22 +0530 Message-ID: Subject: Re: [PATCH AUTOSEL 4.9 64/90] serial: uartps: Wait for tx_empty in console setup To: Sasha Levin , Raviteja Narayanam Cc: open list , linux- stable , Shubhrajyoti Datta , Greg Kroah-Hartman , linux-serial@vger.kernel.org, Linux ARM , lkft-triage@lists.linaro.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 29 Sep 2020 at 01:41, Naresh Kamboju wrote: > > On Fri, 18 Sep 2020 at 07:55, Sasha Levin wrote: > > > > From: Raviteja Narayanam > > > > [ 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 > > Reviewed-by: Shubhrajyoti Datta > > Link: https://lore.kernel.org/r/1586413563-29125-2-git-send-email-raviteja.narayanam@xilinx.com > > Signed-off-by: Greg Kroah-Hartman > > Signed-off-by: Sasha Levin > > 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 > > 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