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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B10EC433E2 for ; Fri, 10 Jul 2020 12:46:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 28D112077D for ; Fri, 10 Jul 2020 12:46:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="smBqWpdQ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="1R8xitnT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28D112077D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=i439fa9qYpCtOK2TbapdUS8Ed6UqhVold1U/4RxbSyU=; b=smBqWpdQg+ZkhjCCqCLM2wXTJ oWWjfPYqEiABwD1lf8u4U799RL/G66Km6uQrUIajHVjuZONRkTGPWPl/CAjKa9L/OnyKzk2jG+rHC VZZWjI7RaHMf974A4kQ82N5n9/n0ooXJlgE/aJdWbhV3qYvPaWdaVbyH4FnbVmySk+tesvViqJ9lQ bcio5Yx03pxRXtaqN+2uLEY5ZWcQMI9Uq5jHJqZpf4voBAU9TwrrlojplCvQeqbXGUbJKzCkQNO2T Y3DJITPd0ev85krPAy4giBPHmSvoLc7jLvtSeQ9uoGqUeSjR5qcp0vbsp2nObUyqMgKev90VobpO2 wy5Nts6QQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtsPG-0004hE-GF; Fri, 10 Jul 2020 12:45:34 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtsPD-0004ge-8G for linux-arm-kernel@lists.infradead.org; Fri, 10 Jul 2020 12:45:32 +0000 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E091B20772; Fri, 10 Jul 2020 12:45:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594385130; bh=wpzRKbUTJ/D3MmU91mmC4uz1sijQouiUeKMqPeNEd/o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1R8xitnTXa3oSg9fDtr2o5emN1GLUKOibPm+qc9PLC6WOxnvMTnwjmexyt81cEa+R l2UYLf91Km9GTOykFMiHmSPFeTPrO8dt38xBmRkR52bQO3mgOp0WxqVm59DCGiGhD0 ssdcwKThgXXVg7KTCPCzxaOY2rkATFQCNkFrkg3o= Date: Fri, 10 Jul 2020 14:45:35 +0200 From: Greg Kroah-Hartman To: Helmut Grohne Subject: Re: [PATCH] tty: xilinx_uartps: Really fix id assignment Message-ID: <20200710124535.GA1584780@kroah.com> References: <20200709074849.GA28968@laureti-dev> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200709074849.GA28968@laureti-dev> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200710_084531_505010_B3B2F9C2 X-CRM114-Status: GOOD ( 25.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shubhrajyoti Datta , Michal Simek , Jan Kiszka , linux-serial@vger.kernel.org, Jiri Slaby , linux-arm-kernel@lists.infradead.org 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 Thu, Jul 09, 2020 at 09:48:53AM +0200, Helmut Grohne wrote: > The problems started with the revert (18cc7ac8a28e28). The > cdns_uart_console.index is statically assigned -1. When the port is > registered, Linux assigns consecutive numbers to it. It turned out that > when using ttyPS1 as console, the index is not updated as we are reusing > the same cdns_uart_console instance for multiple ports. When registering > ttyPS0, it gets updated from -1 to 0, but when registering ttyPS1, it > already is 0 and not updated. > > That led to 2ae11c46d5fdc4. It assigns the index prior to registering > the uart_driver once. Unfortunately, that ended up breaking the > situation where the probe order does not match the id order. When using > the same device tree for both uboot and linux, it is important that the > serial0 alias points to the console. So some boards reverse those > aliases. This was reported by Jan Kiszka. The proposed fix was reverting > the index assignment and going back to the previous iteration. > > However such a reversed assignement (serial0 -> uart1, serial1 -> uart0) > was already partially broken by the revert (18cc7ac8a28e28). While the > ttyPS device works, the kmsg connection is already broken and kernel > messages go missing. Reverting the id assignment does not fix this. > > >From the xilinx_uartps driver pov (after reverting the refactoring > commits), there can be only one console. This manifests in static > variables console_pprt and cdns_uart_console. These variables are not > properly linked and can go out of sync. The cdns_uart_console.index is > important for uart_add_one_port. We call that function for each port - > one of which hopefully is the console. If it isn't, the CON_ENABLED flag > is not set and console_port is cleared. The next cdns_uart_probe call > then tries to register the next port using that same cdns_uart_console. > > It is important that console_port and cdns_uart_console (and its index > in particular) stay in sync. The index assignment implemented by > Shubhrajyoti Datta is correct in principle. It just may have to happen a > second time if the first cdns_uart_probe call didn't encounter the > console device. And we shouldn't change the index once the console uart > is registered. > > Reported-by: Shubhrajyoti Datta > Reported-by: Jan Kiszka > Link: https://lore.kernel.org/linux-serial/f4092727-d8f5-5f91-2c9f-76643aace993@siemens.com/ > Fixes: 18cc7ac8a28e28 ("Revert "serial: uartps: Register own uart console and driver structures"") > Fixes: 2ae11c46d5fdc4 ("tty: xilinx_uartps: Fix missing id assignment to the console") > Signed-off-by: Helmut Grohne > --- > drivers/tty/serial/xilinx_uartps.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) What tree/branch is this against? It doesn't seem to apply to my tty-linus branch which is where I would think it should go to, right? thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel