Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp510293pxb; Thu, 9 Sep 2021 06:09:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwfdRoYZ7q5UFzWfFznqLTXH1wJShRjaGFiQ6tVwTRzxLWAFqRBA85hSJhJZx1m+hsb7NL X-Received: by 2002:a05:6e02:d43:: with SMTP id h3mr2278848ilj.112.1631192951926; Thu, 09 Sep 2021 06:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631192951; cv=none; d=google.com; s=arc-20160816; b=qcybC/UWT4z8hHQEU87QpXyw2tCsAoEsRYJzEaaCByprhAzKPfWtVKybUkPWeprI26 I6BECRnoE5ZhPwMOUq2loqUbWfs501vOZ+CCVl7XG0k82HU/RCXWP2owmvhl1h4RtaAC nkHUi3tCN2wqV1W6jNsCKOmrOquwf8wTQgn264HhVy/c62rExn8Q94IB/CKrL5LOZOxH 0WbocOEPXESghB4FpuupBh5BnUT+BQrIzjoHInI1O2TEzU/l256ONJT86SXjGUjaw3TG TriYvzpV1s4CpqpPvqLZwC6Si91kOH/Z04fnldSkG32aIv6sEYyt2w9a7+ccvlQfEs8+ 1EUA== 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:from :dkim-signature; bh=NfWiqCRalBEajnnv4jOuJhW3W8TFAPLQ4iHh1PZIkKo=; b=kMXixm6wpHfFFdM3+NaZkQTZ09bNza0RNOn66QVOVss8Rap/uLfU2C7cqgnCvuWi/Y ccWB99Z+bfRdHoICI2rt9Dgd5T+S2inkexlWEf+LHk5Cqc1GBg8BWCrFkMgQYG8MACpx fHZilFgck+xmXmybA5GxC6ogXa9oLtH8DoRfUM+ahHx3lNdUa+Xeep+rVYb50UaYUwim hZQIZxIEGKJwAe2/NlUgQSasyvgjc8aUMLBWVh7EausIX/JkYPErduEZzCqQ94zSjON2 V3j2Sgi05r+cCIQNi0FCk9/cUWSmH2TiNBp9cGlJqr//6cyuY/xjp3OPGDKbSmthJFHf fQ0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j2DzPeDp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y6si1488325ion.66.2021.09.09.06.09.00; Thu, 09 Sep 2021 06:09:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j2DzPeDp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350069AbhIINHp (ORCPT + 99 others); Thu, 9 Sep 2021 09:07:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:46028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351554AbhIIMtG (ORCPT ); Thu, 9 Sep 2021 08:49:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A649F61051; Thu, 9 Sep 2021 11:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631188599; bh=31chLHWe85bUi+JEnDwBmhCPpyPFPd0LQK87sK9/VtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2DzPeDprY+MCLSVE/T5AaD8uUPJJw36oqW0KacpnbrX4Q1QYNDtwxMwZ8opOX5FJ yMjlJXw9td7zlm8PbZGICTbbmjIZI/H69d06JW4g468yQCJRUQKdImCiWQKXtd9jPH qTDdqIoLdsE+WUB3r5w516aIzQCmGEz4KGbY9FttO9G7cpFTYFR0K5SxFRpDxPl0gm iIiZ7LTN0NKL7rWK51i8WOQqJPbxaZGJXXMnoJox2pIC+8FFLMr9D4JKUHBpz7FtzC 7EvZx4UAXjhn52kECAQeQV9D0Y9K5TKYJHe6t7rXpn/Z06Sz9yvELxuIWcNwV0EdvI JRc9fLSgjC4gA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ulrich Hecht , Greg Kroah-Hartman , Sasha Levin , linux-serial@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 072/109] serial: sh-sci: fix break handling for sysrq Date: Thu, 9 Sep 2021 07:54:29 -0400 Message-Id: <20210909115507.147917-72-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909115507.147917-1-sashal@kernel.org> References: <20210909115507.147917-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulrich Hecht [ Upstream commit 87b8061bad9bd4b549b2daf36ffbaa57be2789a2 ] This fixes two issues that cause the sysrq sequence to be inadvertently aborted on SCIF serial consoles: - a NUL character remains in the RX queue after a break has been detected, which is then passed on to uart_handle_sysrq_char() - the break interrupt is handled twice on controllers with multiplexed ERI and BRI interrupts Signed-off-by: Ulrich Hecht Link: https://lore.kernel.org/r/20210816162201.28801-1-uli+renesas@fpond.eu Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/sh-sci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 97ee1fc1cd24..ecff9b208808 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1763,6 +1763,10 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr) /* Handle BREAKs */ sci_handle_breaks(port); + + /* drop invalid character received before break was detected */ + serial_port_in(port, SCxRDR); + sci_clear_SCxSR(port, SCxSR_BREAK_CLEAR(port)); return IRQ_HANDLED; @@ -1842,7 +1846,8 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) ret = sci_er_interrupt(irq, ptr); /* Break Interrupt */ - if ((ssr_status & SCxSR_BRK(port)) && err_enabled) + if (s->irqs[SCIx_ERI_IRQ] != s->irqs[SCIx_BRI_IRQ] && + (ssr_status & SCxSR_BRK(port)) && err_enabled) ret = sci_br_interrupt(irq, ptr); /* Overrun Interrupt */ -- 2.30.2