Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4163555rdb; Thu, 14 Sep 2023 13:54:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGPI7ANf4nwpA0/V/cF04OOqEVkLrRYdavixB6oc9E6YWC1V1gV93YO4T/wBsDbuxXCVNG X-Received: by 2002:a05:6a20:7486:b0:13a:fa9e:787b with SMTP id p6-20020a056a20748600b0013afa9e787bmr7334226pzd.12.1694724841451; Thu, 14 Sep 2023 13:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694724841; cv=none; d=google.com; s=arc-20160816; b=UIpmdYOC2ZUvbHpseutqcuiy5+o6CTdWpXrVdNhgBdSexhZ4Ow2Y/iQRSA1IZsdhp0 ykFarQzp5TKC1tDYmdm3W22CEhRTpkFy3bWPIvpiKgYaoo44pIWoKtJp4aS5uKMNReTj nVt67++sQHc8DASvPedYgcnYLN7B9AmeKbyWqYQC2EXRqywVdPH/Qal3gG0tzf7JLtyj 9blIhcNLuJKKGjwIrMQ8f4JVRpnK4g9v6ecG/v4Jxg8DABY8dwyHHLtbCMUe5jHd/RZq TcAjGe4goFpw24ontn1HK13tsbkoauXirYCeGxkHSOL2HXnA0nzaNeHKHl36+tfr8DUw ziew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=wXz8JGMJt54lxBpqvVsLQWaGP0tVfnWkCc3ahu/OaTk=; fh=2L4u733dumTYTLrJZfnHktn8EweyP0WM8thhat0QdrQ=; b=bUtFZf0YPP5BqZKrfvptq68s+rhIQAEgchb7ViV3SaJ/PZSuAdO2QLcvUsIydtGn1f l5RbbiG03qPvLffXVq15BTfao7D1F6iVIy43w3hUlLxSvULuH5ObZuiWEeM1+/TpzZTv QCZNuVdkYKhn/4EqzyCe+2Hsti/oGcMFfCbv8SlRdgwcLF4Mla0A/FadSVTWSYg/JggY 9nL8CRUcIhNooI5n/mSUIVjjt8NHhY+Y9wkcXiuyyjVHOKHgoL2oNKoY/fBvoFv1e8P4 UDWEIa8YOFAE0QbpzB275Jj+dYYHJXDd7w9dBOTYxpNhX2v2rWHg75iU0UxmbeCRxr8q mNRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vmCnTqOs; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id p126-20020a634284000000b0056536fc7901si1553256pga.593.2023.09.14.13.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 13:54:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vmCnTqOs; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 6E35E85FEDBD; Thu, 14 Sep 2023 11:39:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241863AbjINSjH (ORCPT + 99 others); Thu, 14 Sep 2023 14:39:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241566AbjINSiw (ORCPT ); Thu, 14 Sep 2023 14:38:52 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D9591FFD; Thu, 14 Sep 2023 11:38:44 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694716723; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wXz8JGMJt54lxBpqvVsLQWaGP0tVfnWkCc3ahu/OaTk=; b=vmCnTqOsrLD4owKMnmfvtt1mBVdB6YqBmGZYVNCuNttix45bbD9ZYBKfLxWRoBxQcBrNFS ULCYyVAqLXI4WuA9/BsruLgLGbEQI0qOqenpk/mUGPr+fPvVS+xGWUKS7kYFDYc0WhUm27 aVTjiT5owCNSXMMUD6DKhb7HMUIh7wEVB3Z5nSl559BN3e+O7kuLsiSfuog8zZMXDWHAjs 5zUaC5XtIkdT+69XNmr/KvqG8mTwRsZEuLyoS0zyLneujo8Xe6IZvjTY2OaCkQ9Dneu7rx rxPzEpc7LJxm0RT3M6KzjMRuQiQm6AL2MbwkL48z/fbQ2VixAGYrORAhlzhwFw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694716723; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wXz8JGMJt54lxBpqvVsLQWaGP0tVfnWkCc3ahu/OaTk=; b=oELZSVWpujrqq3F+QVn6Xal+m55lYszHQlaRnpJvhYUD7X9S9LcC3ptf/FaXfToMUvP96p 2Q76arcWnsSNdHAg== To: Greg Kroah-Hartman Cc: Jiri Slaby , linux-serial@vger.kernel.org, Petr Mladek , Thomas Gleixner , linux-kernel@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Johan Hovold , Andy Shevchenko Subject: [PATCH tty v1 10/74] serial: 8250_fsl: Use port lock wrappers Date: Thu, 14 Sep 2023 20:43:27 +0206 Message-Id: <20230914183831.587273-11-john.ogness@linutronix.de> In-Reply-To: <20230914183831.587273-1-john.ogness@linutronix.de> References: <20230914183831.587273-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Sep 2023 11:39:11 -0700 (PDT) From: Thomas Gleixner When a serial port is used for kernel console output, then all modifications to the UART registers which are done from other contexts, e.g. getty, termios, are interference points for the kernel console. So far this has been ignored and the printk output is based on the principle of hope. The rework of the console infrastructure which aims to support threaded and atomic consoles, requires to mark sections which modify the UART registers as unsafe. This allows the atomic write function to make informed decisions and eventually to restore operational state. It also allows to prevent the regular UART code from modifying UART registers while printk output is in progress. All modifications of UART registers are guarded by the UART port lock, which provides an obvious synchronization point with the console infrastructure. To avoid adding this functionality to all UART drivers, wrap the spin_[un]lock*() invocations for uart_port::lock into helper functions which just contain the spin_[un]lock*() invocations for now. In a subsequent step these helpers will gain the console synchronization mechanisms. Converted with coccinelle. No functional change. Signed-off-by: Thomas Gleixner --- drivers/tty/serial/8250/8250_fsl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/8250/8250_fsl.c b/drivers/tty/serial/8250/8250_fsl.c index 6af4e1c1210a..f522eb5026c9 100644 --- a/drivers/tty/serial/8250/8250_fsl.c +++ b/drivers/tty/serial/8250/8250_fsl.c @@ -30,11 +30,11 @@ int fsl8250_handle_irq(struct uart_port *port) unsigned int iir; struct uart_8250_port *up = up_to_u8250p(port); - spin_lock_irqsave(&up->port.lock, flags); + uart_port_lock_irqsave(&up->port, &flags); iir = port->serial_in(port, UART_IIR); if (iir & UART_IIR_NO_INT) { - spin_unlock_irqrestore(&up->port.lock, flags); + uart_port_unlock_irqrestore(&up->port, flags); return 0; } @@ -54,7 +54,7 @@ int fsl8250_handle_irq(struct uart_port *port) if (unlikely(up->lsr_saved_flags & UART_LSR_BI)) { up->lsr_saved_flags &= ~UART_LSR_BI; port->serial_in(port, UART_RX); - spin_unlock_irqrestore(&up->port.lock, flags); + uart_port_unlock_irqrestore(&up->port, flags); return 1; } -- 2.39.2