From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B53BC38B7A0 for ; Mon, 20 Apr 2026 09:13:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.218.42 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776676417; cv=pass; b=LsPzuYx/EZYr+3tTMAgYQqrWakcWHbn87mhfK1mrQLg86TbVJCj9ytWqJduQ7/vQaG8svKpdS8VgfbbRxFBaTwhxbi2TzkrFDrvzbj780a6ED2cFAZuHXeUqvvJPBLoqhokKWZn2qLRFBlLfbB501Rm9Wuhi5DBYTQh4XEu16cM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776676417; c=relaxed/simple; bh=XxirBuD31Nt+C4zSZNg7TpINaJaCS1dX/jpy37erYco=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=k7pcjGIt7uSKlTff83XK1suMDGDOxogd1z/gSr9U/SKA/5yyOwovCdVwfC1q6YnnRIZ5J7FVGUmHDtzc1eowBR0oSaiETK82n2AkDREAyAgZKguhOtX3bDvd+EhHulhGDNXMDDyY24Gp6CxTvRVtAchy6t+1RxlFG+PymNHL7Ro= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=sgJrx6VZ; arc=pass smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sgJrx6VZ" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-ba61a0a2d26so224476766b.2 for ; Mon, 20 Apr 2026 02:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776676414; cv=none; d=google.com; s=arc-20240605; b=A0LIn20RbyBCn2NsdMnXWqHR2o4AnNvhHMA+Pn+IGW38NumEsiywtwhbTAxz8Ch3Tj w97DPBGUJq+IWomoLH6T9/5+hMhI88c93x3ooVzR2LZAcs4z5aleYsz30aH1ddP1tgBz Dybe9cTNgFUzijJSl1V+Z+jaaR4aD4l116UOGqpVijrdQAB+AOBaYH2tKd+1RVmzP1QM WiAH1mg3Z8c+sAz9hnOyyBNST/MMeO7p5e6xqXZSjpu6f6/dm5dLsluTlvbNKxeclCft Zi/EsPlhmBD5usIE2GvyxNDcHYa+B9rNtxL/YgWIYAkOU6g9vE2YI7WCWgte4GiT9ak+ jtHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6BugEHHQm4XvMDyPiuFQhMIfXiJY3WqflJplQr+j+bY=; fh=Fq9i6bb6+a6jlApv5bforacbKZq/eXSyL/ieXgYIzKo=; b=jh/OfNI0aqkwh6AKuMjaS/S15AKWt9WPKfCigoqRJ9eKrcs7kcbIBjZ2bNDMuHmi5E xso8E141o4t6gUhGmcWvIjmOC2bSm2u/kgAH8hL7euaAuXAQRtT22aC/iOti2EHmdgxg t+cGLABmJnw0Bdqqq+PCMgn5rTdTVag9HFAFf45a1pngPHkhNlgXaxtQSb9cEcXRMnZd sSt0uG9PrR46W+VRitvX7rp7DUDneaI6w+JpaH837NBahq6PTt2iF3wHPlBSmDjB2COc 8ELduDEE+1lDxryQsXAZPIoEA1cjwuVCDWY5a04EKd1ieJOr3M2LXY40t2yaITxgUeZh iltQ==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776676414; x=1777281214; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6BugEHHQm4XvMDyPiuFQhMIfXiJY3WqflJplQr+j+bY=; b=sgJrx6VZ1ly4fF6Q94CKKKEo7mI8MnfPDs4zApnknG8K5GTcieC2wMHndhsR1DZlZ9 ieFiaK29+wFF8qwNg7fUtG13U70v0f/L+huN4RdU7ZV/ZcZXxVTXdf77hYuvRt+ddbiW 64gpJVfOIRwENRajBeF0anfaCAO86vJ6Qd/YfnCLYupM5sN9KMyEsIlhCPDZFsBjgzSV uZJ3xV8YS0nW7NnlDmZR1zFC99dW9fio5iZ62USKCBkrD8gefWsiVK+GfRVRQxqWQqZ4 174d0bGzG1pOmLrdP8JVrTrbvovAoaOLa3O2L7gWtTJurC6YN9EpM/19gf9w0I97GWhS +Vpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776676414; x=1777281214; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6BugEHHQm4XvMDyPiuFQhMIfXiJY3WqflJplQr+j+bY=; b=piI6KpF/Z7CqsIs87EJ9JLV9ycnTwWxxJUuXHARyMvojZgQmUPUDFGFAtbw+nr7hC1 +BInksQZrVFCeN3xdIAy4bwV167163MSiP/yi1t0p9egya6d9i54E7YYjSw4lvAVrvTt x14zU0guYMCcorozRQPV0jxj/x0wUibGa4w7uKG1srJk6RL9X3/ksLbmb1LR45Y4DbKg PiaIZ5w9FVmxYHXdWP3k0tvylLEF6Ppk20njd9BErIBvHotm3YsNxbbm7PT0hiHJWL2S aYp6ep4g+fiRLsvIU+wheGq8BTM510W0hx63qtAo98YwhwgPMEZwcU8sKUIan6+dpor9 kZDg== X-Forwarded-Encrypted: i=1; AFNElJ8eVHomkbgz1BmeUMqs/2JFUu6TJAZ5xCjKLrHcqgdyTAQ74rd3o9ffm+6gW7iTd2AKa/J5nY1oYAsHMVA=@vger.kernel.org X-Gm-Message-State: AOJu0YxYkmfTEQxBB892CjU9CDr8lJcdahAAGSzIp5kcAqQ9/WOHBag4 bZan5tHOdSTdcue1iKrwIaqZ9ijwpzyApdOW1r4lG/I2rPiVIBw56XVfZeAWUkkT+UdxdTN/JS0 7MY4ei9L6o1QUSSt4EdtkAXRPdCLGdoQ= X-Gm-Gg: AeBDievMoHR/U/dsqFr7fQI3YfW5Q4tUqnfMe9OQikC9OQOyqIqCc+yzlg/oM1gTH6X 1UUB2ve0ZSuxIP48GXcJ9j26DI4GFTAfOehg/cWCi8SqQL+S2rX3ZFTPK3yEuBe/JolJh2Uegq8 aQSn+v8f3jYsLYEADQAKoqPkDGcwEpYnnjdJQW8s10lMs/+wvdtOwPnMo5Vuz+EDvjzrfc4Mt+/ DeNjh480q83JICr7yy6MQR3zi3j1l/I2EhmO47urPaF5Fv+z+3vfPV5LTKMVrSSuYkIMwnLhlLr Th52r2/KEkOTHc9bWwQswsZ0wUCg911c3+a16OG94CvNjUkhV/kldkuWrZD6NcgQpsdeIn6qs7W 7IWxycikJqtkUsN95Rg== X-Received: by 2002:a17:907:da7:b0:ba6:4e0f:e3a8 with SMTP id a640c23a62f3a-ba64e0fe96fmr255493366b.12.1776676413745; Mon, 20 Apr 2026 02:13:33 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260417102423.40984-1-john.ogness@linutronix.de> <20260417102423.40984-7-john.ogness@linutronix.de> In-Reply-To: <20260417102423.40984-7-john.ogness@linutronix.de> From: Andy Shevchenko Date: Mon, 20 Apr 2026 12:12:57 +0300 X-Gm-Features: AQROBzBFzwZjKnl1G1tdRS2Ou-R7AD946TWfN1m6T1SB5R7GYFhUWIOiSo5U3-U Message-ID: Subject: Re: [PATCH tty v3 6/6] serial: 8250: Add support for console flow control To: John Ogness Cc: Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org, =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Ingo Molnar , Osama Abdelkader , Krzysztof Kozlowski , Gerhard Engleder , Lukas Wunner , "Dr. David Alan Gilbert" , Joseph Tilahun , linux-serial@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 17, 2026 at 1:24=E2=80=AFPM John Ogness wrote: > > The kernel documentation specifies that the console option 'r' can > be used to enable hardware flow control for console writes. The 8250 > driver does include code for hardware flow control on the console if > cons_flow is set, but there is no code path that actually sets this. > However, that is not the only issue. The problems are: > > 1. Specifying the console option 'r' does not lead to cons_flow being > set. > > 2. Even if cons_flow would be set, serial8250_register_8250_port() > clears it. > > 3. When the console option 'r' is specified, uart_set_options() > attempts to initialize the port for CRTSCTS. However, afterwards > it does not set the UPSTAT_CTS_ENABLE status bit and therefore on > boot, uart_cts_enabled() is always false. This policy bit is > important for console drivers as a criteria if they may poll CTS. > > 4. Even though uart_set_options() attempts to initialize the port > for CRTSCTS, the 8250 set_termios() callback does not enable the > RTS signal (TIOCM_RTS) and thus the hardware is not properly > initialized for CTS polling. > > 5. Even if modem control was properly setup for CTS polling > (TIOCM_RTS), uart_configure_port() clears TIOCM_RTS, thus > breaking CTS polling. > > 6. wait_for_xmitr() and serial8250_console_write() use cons_flow > to decide if CTS polling should occur. However, the condition > should also include a check that it is not in RS485 mode and > CRTSCTS is actually enabled in the hardware. > > Address all these issues as conservatively as possible by gating them > behind checks focussed on the user specifying console hardware flow > control support and the hardware being configured for CTS polling > at the time of the write to the UART. > > Since checking the UPSTAT_CTS_ENABLE status bit is a part of the new > condition gate, these changes also support runtime termios updates to > disable/enable CRTSCTS. ... > struct uart_8250_port *uart; > + bool cons_flow; > + /* Preserve specified console flow control. */ > + cons_flow =3D uart_get_cons_flow(&uart->port); Sorry for nit-picking, but when I see 'bool' and see a getter, I got confused. I would rather see getter/setter to be something like cons_flow =3D uart_is_cons_flow_enabled(&uart->port); uart_enable_cons_flow(&uart->port); uart_disable_cons_flow(&uart->port); --=20 With Best Regards, Andy Shevchenko