From patchwork Thu Sep 14 18:37:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Ogness X-Patchwork-Id: 139810 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp587310vqi; Thu, 14 Sep 2023 12:50:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpIEkG3UlrnwvrFSm0xZHMLJQbUd/k3m78wuUUpmQMFAgO3W9JJjohAqgZE3Pqnvx3diKL X-Received: by 2002:a17:902:8c8d:b0:1c4:1343:8329 with SMTP id t13-20020a1709028c8d00b001c413438329mr2214034plo.27.1694721003442; Thu, 14 Sep 2023 12:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694721003; cv=none; d=google.com; s=arc-20160816; b=o8r+tY/AhWTl9Ct2yyUmu0iN6PtVfZbKVI9nH1an6RvjS3a3cy9XX0kagf9CgnVO9F 2+GoTV+0P5+NCvyGwGg+IF29c+SHauBfJaV3xUmRBUDGjOC1aj8j9stpbQxDLOzfoDzX 26EVRWVauzrDtnIXjfJE6NQCrBUEu/eHuYZNh2JLcznNQgedHb4r+y7wy6WvpQMF8yBa L6ogsSaHCmQZPG33dptGgzzNTDR6Ib4vE+uTS6tS/EY8Hc8ri8CwRKs6uHCQ47d4pH0N N+STCieABgyHPblpGPSWp+ulSAYovTmWbRV3sR8CTQkrDF+gye/zmhjQ0RBIo+Cmoytk 07ig== 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=VwAuYpYc3fWXqol8AKchJjd2gF2BZfWOXYVLA/beRQc=; fh=Y+QjKVSLZ017m4vxECn4y0ZLKbCUXIIL53OD6nLnLGg=; b=dST6EbBawpwC7DkKW+g3VxSvJDSvMXzubAEQhcUGF+DCas5wyXyPYca776Mc1WsKSJ 3rDbrynUrydQlSqYLuifHdy+wROEpXbDT/llnm84EOcEA8Xj1SIMtNQRLQ9eXpN3X79v HwctCtLpJUyH9I59s6ne2vbk9ICjBeuAQNZMu8Yf/7FkQBf7KqtcPdp9bgG5Zq9j0FH7 zjqFin/dbjQR6IfrP6KNh8A+GgXFXuCSciQvFhOa8jrxBCe5Jfa9PNG1OsSFoPoniw39 bjAlSPt/laure1kyo44qCBCuF/HooAPs4ddirnCzSeBqxs7K5UyVvNDNqwMGWlZuIHw5 zglQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vSKwIdxZ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id d10-20020a170902654a00b001b222cd9826si2012331pln.349.2023.09.14.12.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 12:50:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vSKwIdxZ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 7CAC582A1F74; Thu, 14 Sep 2023 11:39:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241718AbjINSi7 (ORCPT + 33 others); Thu, 14 Sep 2023 14:38:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241423AbjINSis (ORCPT ); Thu, 14 Sep 2023 14:38:48 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED74C1FFC; Thu, 14 Sep 2023 11:38:43 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694716722; 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=VwAuYpYc3fWXqol8AKchJjd2gF2BZfWOXYVLA/beRQc=; b=vSKwIdxZS0Wy8y0+/xBxwuLThTEsw4FHoB6EHTIG1aUZ/vnNzHzcVNEuoBNexfguoPfsUG AuuyuU3K3dRpSywuVrx6WMcLVtPGSQeGW9r86rAxNTjYZ9IVPS27lt77osMrXyqSC1bvRm o4Ea6eBOgx0An5Xfej5rhguuAlR6FU3QURdKKa3w/qSU1NgHZ4hpp5ouzAH1P2Fjy8qS2v GvlBKyD32A4oDfzVMtEbAeSmNv6nrMJn/xfUL/8+6B9N6cUdThGb44P9DyJL96z3lvV1jh zOgajJ2htEmcYmbcCqvWAYjS13lgL7oWQG0+gr/0zGI25LwYeN0J4QzjWCjO8A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694716722; 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=VwAuYpYc3fWXqol8AKchJjd2gF2BZfWOXYVLA/beRQc=; b=i5GRywZjHj1wrVT3sjOj3uMBjzzxZVwAf9xbXgkUxQ5dZtMNghRLuxeKwuRpV4hrBVCmwr meSdgbwTEVR38SAQ== To: Greg Kroah-Hartman Cc: Jiri Slaby , linux-serial@vger.kernel.org, Petr Mladek , Thomas Gleixner , linux-kernel@vger.kernel.org, Andrew Davis , Andy Shevchenko , Matthew Howell Subject: [PATCH tty v1 09/74] serial: 8250_exar: Use port lock wrappers Date: Thu, 14 Sep 2023 20:43:26 +0206 Message-Id: <20230914183831.587273-10-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 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 (lipwig.vger.email [0.0.0.0]); Thu, 14 Sep 2023 11:39:11 -0700 (PDT) X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INVALID_DATE_TZ_ABSURD, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777043770865815438 X-GMAIL-MSGID: 1777043770865815438 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_exar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c index 077c3ba3539e..07ad21336301 100644 --- a/drivers/tty/serial/8250/8250_exar.c +++ b/drivers/tty/serial/8250/8250_exar.c @@ -201,9 +201,9 @@ static int xr17v35x_startup(struct uart_port *port) * * Synchronize UART_IER access against the console. */ - spin_lock_irq(&port->lock); + uart_port_lock_irq(port); serial_port_out(port, UART_IER, 0); - spin_unlock_irq(&port->lock); + uart_port_unlock_irq(port); return serial8250_do_startup(port); }