Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp452099pxb; Thu, 9 Sep 2021 04:56:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBt5yBP/3rJeCWPkR9PnsBVmgFi9NUx+jH6mk0V8JxcqJOIpp8tTEQukW2xwRgI+jn8fHG X-Received: by 2002:a5e:c609:: with SMTP id f9mr2355335iok.127.1631188580613; Thu, 09 Sep 2021 04:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631188580; cv=none; d=google.com; s=arc-20160816; b=WYQu0KC6utdHIS6Su6v4r6fQyuq5GFlMjBAWk88A3uxuiM256h60AeLD5iRxA5ttz3 sUqXNgfl4xGPL7Pvvsklp3Jo/1i1t23/PoDf0OF7sDJkeG+Rcmc+QSvpxlDNo9pmUjhA mGY8zziXtYxDuywJCTZcnFSdOwbYCrzfbJ8L2g1NFtH8GtchuwBavwCqa3K3ShD+YfIN 8Lj5OUrnA4IcK6AlFVHrocvH7qXfXIFmHJXLVJV13c7EUrdp5+f+TareEgDqNdiGnOld 1xuEofNjGlhAJG44tevQM1gomYfTZcscpy8iEnueOHbIc0Kz0eQPD53j7YYzNNb08KYT DNFw== 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=ZL1Yplhvt2dxGwU+8Kslks0N40x456tTMuRCIc1H2oY=; b=jHfIbz/yBmUP9GcEieN9cdMav4D7cGSo0cdNRsk/Wr0XxDFq0OHGOuhBo/MONkdMlO 8pQUkY4fjueOhSeQKToC/Ir7x5eM+/0wqJe2530YS+xnKPOVtnTXFQlt+8sLB7YRPyWE XE0V+1+uSsGV9yVh9z2I4WVvbAOxFmXMbrlWvBuDYmh92w/P2smsL8dIm6KmjaVCDiF/ b1h0AZmop6Wu1ay/rNGyUmko4jHZbtVSED0sv/VQn3Gg0iIkh33M3bTdPF7sdPKcgB2Z L6l6t7xgInZX7gA8Ns5RdeRGz6HdpWTj7pEQJ4+ciENke0lHPlHqhR5F3Ngmfabml/Kf fncA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oZ5rOXeZ; 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 t1si1351729jaj.102.2021.09.09.04.56.08; Thu, 09 Sep 2021 04:56:20 -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=oZ5rOXeZ; 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 S244190AbhIIL4b (ORCPT + 99 others); Thu, 9 Sep 2021 07:56:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:33232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243047AbhIILxj (ORCPT ); Thu, 9 Sep 2021 07:53:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 346E1611B0; Thu, 9 Sep 2021 11:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187879; bh=UGT06HFY6cJVUNZTU6SZBavz6mxaacF/9gOWJPzZD2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZ5rOXeZ1epn37WBlJBhsHZtc7eRT4gbcWE64hpI/+2Ym0MIV41G7YuY6JtKLkzNd XUpGg1vJrNOY+jwDYko1E89L08Un3klP7OyqNz+xBVC8t/u3+pvn/JyLpUQHBl2o6/ mawuF8e0gZbnwRGluYUxDSAaJnfNJmMvgVzxXblEXGiUTes7isdc5/AJdRkPcvUEBC 3EMo2S29abD79reF3PPlEHlMPqejodag3Ec49TvasBs8PBw+zZMfPazzpmQ84o5Sfl EAkhoNTIhKEOgxjV2NiTwyy4GZMwWerXniyzPIrRG4h7QvPYDyQGWEazPz56FFa7uo GMT8ctHTEzWHA== 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.14 163/252] serial: sh-sci: fix break handling for sysrq Date: Thu, 9 Sep 2021 07:39:37 -0400 Message-Id: <20210909114106.141462-163-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-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 07eb56294371..89ee43061d3a 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1758,6 +1758,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; @@ -1837,7 +1841,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