From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3E2552F7E for ; Wed, 27 Mar 2024 15:10:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711552221; cv=none; b=iWrz51OCUfUF+s4fRoBdFfVAaoZge4AbBhdKxBcRhZkMdzIwqm3y1i4WCDBQFDpLOOgfRBaOCWWSM2o9cs0/LRYKoN5m7IMN6cawHOxsayZnEHB3Lf3tFuyjYE+nda9gArOdIBnCLbnPdD4/rcIejnyXtBCenaj5daA8m1Xut0k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711552221; c=relaxed/simple; bh=5BkjpfGrWMk/ddHm3PH9X7C5WfuQvZSMOBdSfquQGns=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=PmXtcgua4rNQ2oxpgbPTecN6ZtlU8wpYs8DTPa7nooPLuYPZZ40UmAXuEaPGQirHLgLPpOAUAJl3msTWm9xHgfU5+pNT5PV3TqjFBuiT0sQS9lHHgqzXfLYYWAmdj5WJp5s+oeJBCGTz994yCD1YxF2WtWdGVp6+l8DE8g8fAak= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=e9VjoWRW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="e9VjoWRW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC770C433F1; Wed, 27 Mar 2024 15:10:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711552221; bh=5BkjpfGrWMk/ddHm3PH9X7C5WfuQvZSMOBdSfquQGns=; h=Subject:To:Cc:From:Date:From; b=e9VjoWRWYM0Jq4NwWVjxFXpP/7KIAs63t0MALgGUyUKY9PfUYURUTVWTtgyJz3qVW G8MRlFbo1MXQARR25aclzoXvY6dsVvjmEcv+ngHBuUwR27I0c0m8GMWYjqWh+exxDl r8ILpoizPO7sYC7oMN8Lk5Clpc4myt8WtOSwDWBc= Subject: FAILED: patch "[PATCH] serial: 8250_dw: Do not reclock if already at correct rate" failed to apply to 5.10-stable tree To: pcc@google.com,andriy.shevchenko@linux.intel.com,gregkh@linuxfoundation.org Cc: From: Date: Wed, 27 Mar 2024 16:10:16 +0100 Message-ID: <2024032716-jaywalker-strainer-d5dc@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x e5d6bd25f93d6ae158bb4cd04956cb497a85b8ef # git commit -s git send-email --to '' --in-reply-to '2024032716-jaywalker-strainer-d5dc@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: e5d6bd25f93d ("serial: 8250_dw: Do not reclock if already at correct rate") 74365bc138ab ("serial: 8250_dw: drop bogus uartclk optimisation") 0eb9da9cf201 ("serial: 8250_dw: Fix the trivial typo in the comment") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From e5d6bd25f93d6ae158bb4cd04956cb497a85b8ef Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 22 Feb 2024 11:26:34 -0800 Subject: [PATCH] serial: 8250_dw: Do not reclock if already at correct rate When userspace opens the console, we call set_termios() passing a termios with the console's configured baud rate. Currently this causes dw8250_set_termios() to disable and then re-enable the UART clock at the same frequency as it was originally. This can cause corruption of any concurrent console output. Fix it by skipping the reclocking if we are already at the correct rate. Signed-off-by: Peter Collingbourne Fixes: 4e26b134bd17 ("serial: 8250_dw: clock rate handling for all ACPI platforms") Cc: stable@vger.kernel.org Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20240222192635.1050502-1-pcc@google.com Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 2d1f350a4bea..c1d43f040c43 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -357,9 +357,9 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, long rate; int ret; - clk_disable_unprepare(d->clk); rate = clk_round_rate(d->clk, newrate); - if (rate > 0) { + if (rate > 0 && p->uartclk != rate) { + clk_disable_unprepare(d->clk); /* * Note that any clock-notifer worker will block in * serial8250_update_uartclk() until we are done. @@ -367,8 +367,8 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, ret = clk_set_rate(d->clk, newrate); if (!ret) p->uartclk = rate; + clk_prepare_enable(d->clk); } - clk_prepare_enable(d->clk); dw8250_do_set_termios(p, termios, old); }