Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4266213rdb; Thu, 14 Sep 2023 18:01:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGG5qgUWgS/RHtFHSYspfeo8YPsoyTiTWGFs+ZLibP7ToZYzSqsMB7Q0+UHB/bj7iTT1qnI X-Received: by 2002:a17:903:181:b0:1bb:55be:e198 with SMTP id z1-20020a170903018100b001bb55bee198mr370824plg.0.1694739668314; Thu, 14 Sep 2023 18:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694739668; cv=none; d=google.com; s=arc-20160816; b=bapdu9QxP/YQ4QPrq3HToyUSwE+8R0pFU9EwIupRKCZ7pinmcBmL+Cap6lV/gD1MbM yCZAJPKdFyl/EHJCkKC07A4S9bqz9OT1zRTiKiEW3m+Bxr6xuoOYki8dYCSRaTNItTgM V3ZwyA01zISaO7Q7jM37Z/M4f2pfDACrVhz7NnWXLJdLmDemoOqRl5n/p2HbP5sdnPDU bNwJdvlnfS4oir02w6I1AhUzakXUhafR1qEkf+7MiOxPewlJAIniZF8qCdkIp4vZNePV YZ7OJihqnZcUoHSrjhPjgHP3HkHatAA8UUyo50kXn1dlZL+BQ5JmTJ/cLsVKFltgtKvT KV2w== 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=YzGTH7vi1woKgPlT+ew1GuAaXeqKELiHy4YX6FZB2Ws=; fh=6Y8M5f78d5sR+KON/Uuh5VXB4Ad5zB/bByzt8MEE8lw=; b=MoYQIg1SOnVBv7Zr3RqePKJe4SDwGWultuC7s4OtbX4TnTHzav+cIcbGF9OA5hzVwl zlslKxmX0rYgLR70UZRbSdI9JHcd9GVfEuyKnHfRd7yPZ8ydz0ilRg4gJQ+am6g8MeW5 tvBWIcxglQtskrvAYbvPGsLaKA/r8dl8X0qw9uu6dprQ0XTl0TXWhsHhNHrUC5TZhH7F XM+4TWlBM7GNzRpXrMaHaQpEGT428XR8rdzhKQPdwykcky5tQGYKmEIa6fjQ8xkip8an VlOw1WVNRS/AdzunPvkYHWrViRyjFF6+YfGi7QIekxZMe/gLZU8Ae3SrlrW88E14nF3h 8hoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xI67S1N4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=EMockjhc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id i16-20020a170902c95000b001c34f81bb35si2628573pla.200.2023.09.14.18.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 18:01:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xI67S1N4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=EMockjhc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 9AEE98347B77; Thu, 14 Sep 2023 11:38:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240866AbjINSir (ORCPT + 99 others); Thu, 14 Sep 2023 14:38:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239212AbjINSiq (ORCPT ); Thu, 14 Sep 2023 14:38:46 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F17361FFC; Thu, 14 Sep 2023 11:38:41 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694716720; 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=YzGTH7vi1woKgPlT+ew1GuAaXeqKELiHy4YX6FZB2Ws=; b=xI67S1N4oC7yZQ9a9pniupQBCdXgHbJJUonVJdWsOkhhnFOa3cgAIkwfV4vuJtXSyJwzGS ruLvaJ23/nSLO9Ctn9PW8PFVTJdY8yeVPHpSgQYp9ZF1TwlDTauZliU85WtWCbaMi3Rba5 Mts0uuFAMmVvXYE9ku+eTUZi159cnJ2SyratQjN1nGHBxeJKcn0vSj4TMO6ufnyaiVBCia 81rJQ7Sziv0cKeEYwa2pleTD3/xlhdfQVaC+br4A+ErFX3p2fkPjiXSkNPTpjycU317yLV fMbzRFn+93V2pSpx/IXHoYVxiv8Q7qYIOtQ5MbR5aobUJbuT7RGBBVpUF5sMgw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694716720; 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=YzGTH7vi1woKgPlT+ew1GuAaXeqKELiHy4YX6FZB2Ws=; b=EMockjhcNy6AcG+UO3snhVjQB3YOEKFZrpHHn/aVPBYlDJ7RlYj5Zo30u0wb1oMlWhBLHQ GJWHincAnGHiCdDA== To: Greg Kroah-Hartman Cc: Jiri Slaby , linux-serial@vger.kernel.org, Petr Mladek , Thomas Gleixner , linux-kernel@vger.kernel.org, Joel Stanley , Andrew Jeffery , linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org Subject: [PATCH tty v1 04/74] serial: 8250_aspeed_vuart: Use port lock wrappers Date: Thu, 14 Sep 2023 20:43:21 +0206 Message-Id: <20230914183831.587273-5-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 (morse.vger.email [0.0.0.0]); Thu, 14 Sep 2023 11:38:56 -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 morse.vger.email 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_aspeed_vuart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c index 4a9e71b2dbbc..021949f252f8 100644 --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c @@ -288,9 +288,9 @@ static void aspeed_vuart_set_throttle(struct uart_port *port, bool throttle) struct uart_8250_port *up = up_to_u8250p(port); unsigned long flags; - spin_lock_irqsave(&port->lock, flags); + uart_port_lock_irqsave(port, &flags); __aspeed_vuart_set_throttle(up, throttle); - spin_unlock_irqrestore(&port->lock, flags); + uart_port_unlock_irqrestore(port, flags); } static void aspeed_vuart_throttle(struct uart_port *port) @@ -340,7 +340,7 @@ static int aspeed_vuart_handle_irq(struct uart_port *port) if (iir & UART_IIR_NO_INT) return 0; - spin_lock_irqsave(&port->lock, flags); + uart_port_lock_irqsave(port, &flags); lsr = serial_port_in(port, UART_LSR); -- 2.39.2