Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3624269pxj; Tue, 11 May 2021 08:24:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPF7KAYj4A04tWjXlT5YaZN90DpIzSJ/GV87h7xtOxZvypqA1jQaIfczSwwVQSgSA9gpe8 X-Received: by 2002:a05:6512:1283:: with SMTP id u3mr20906282lfs.386.1620746683771; Tue, 11 May 2021 08:24:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620746683; cv=none; d=google.com; s=arc-20160816; b=Hkv8wq1EpPKVOfotVbfK/GOE3kfArC0uq8LHAuA+JrdZCKgflX8hgaTx5vGLRTcre2 OukH23W6DUFXm5m8Kxd12jrltCsMY0qX+p50azJW9r4cj4SxBYlUAZM8olA/qefB4imF B0JZ95na0YKDzyii7eC+WIuu3qPD3fqIsJT94Mc2BoOgmDxYaiZwyCVWOYuLngz7SaiF GuEVMqr7ON5kpy1K6YUfejTzBKv/zACAHqm3hdx/dfd0txHwCe+0UDeRM9qHDBHbb9BB OXMGjhhG/NdaSvWjiLW3fgAMeD1sxPsO0ZWNJN7pzH5vEAd5KHiiEtzwgX6YAPc5ugVY qUaw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Rz6bXU6XS7j+KrR9SbLWdgtPtvzU7RGsksFsLi91ok0=; b=WSLgfefrCDWsltD3DSh8Q2HXNS1otwQGP0pfEtmr62nye91oBtfgJJ+jT6Hz+Gnssf tNkLuvXQGT15QQk7SiU/Qs8pIXQYD68PDNe9YZftbtPqrzBD0qUP3OJfBsf7yD3OfDqQ DXrjPL+tJK4e05Ln67SezUb12ah2DtK/zgJq88HjzIS9fPzi9eVUpyWT7Ur8jj2XO4NK 4L0vqAU0xfaikCNtUjFS5emyv5ZITZ8CW+WCTWduhi1h6D8ec8dqi+4M5HSfuBECT4r4 9DfmpA7s2rustqC0G7U9fUCmtDE7fCWz+VeY5RSR6hD1og7LReqwwR2JRStE/nFwaews hLXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=aGhMb5FW; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si12384905ljg.513.2021.05.11.08.24.13; Tue, 11 May 2021 08:24:43 -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=@ti.com header.s=ti-com-17Q1 header.b=aGhMb5FW; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231800AbhEKPVP (ORCPT + 99 others); Tue, 11 May 2021 11:21:15 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:60942 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231461AbhEKPVP (ORCPT ); Tue, 11 May 2021 11:21:15 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 14BFK1ID104690; Tue, 11 May 2021 10:20:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1620746401; bh=Rz6bXU6XS7j+KrR9SbLWdgtPtvzU7RGsksFsLi91ok0=; h=From:To:CC:Subject:Date; b=aGhMb5FWFWTaB+lqKOUzIpi70y0df5odSGMm3gxUmY3H2wuyqV/q4tL7aK+EqChA7 5M+moxI73OJKm6pSoEHhZITbIZb71BloZfdcqOlCOb9r2oPNLzrmQKNvH2c+PWX+JA EXP4z8UQQ1YpF9LzMdyk6dhoe39inqprq4uTr1HE= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 14BFK1uJ062601 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 11 May 2021 10:20:01 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Tue, 11 May 2021 10:20:01 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Tue, 11 May 2021 10:20:01 -0500 Received: from ula0132425.ent.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 14BFJwuG121251; Tue, 11 May 2021 10:19:59 -0500 From: Vignesh Raghavendra To: Greg Kroah-Hartman , Jiri Slaby CC: Vignesh Raghavendra , Jan Kiszka , , , Linux ARM Mailing List , Subject: [PATCH] serial: 8250: 8250_omap: Fix possible interrupt storm Date: Tue, 11 May 2021 20:49:55 +0530 Message-ID: <20210511151955.28071-1-vigneshr@ti.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is possible that RX TIMEOUT is signalled after RX FIFO has been drained, in which case a dummy read of RX FIFO is required to clear RX TIMEOUT condition. Otherwise, RX TIMEOUT condition is not cleared leading to an interrupt storm Cc: stable@vger.kernel.org Reported-by: Jan Kiszka Signed-off-by: Vignesh Raghavendra --- drivers/tty/serial/8250/8250_omap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index 8ac11eaeca51..c71bd766fa56 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -104,6 +104,9 @@ #define UART_OMAP_EFR2 0x23 #define UART_OMAP_EFR2_TIMEOUT_BEHAVE BIT(6) +/* RX FIFO occupancy indicator */ +#define UART_OMAP_RX_LVL 0x64 + struct omap8250_priv { int line; u8 habit; @@ -625,6 +628,15 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id) serial8250_rpm_get(up); iir = serial_port_in(port, UART_IIR); ret = serial8250_handle_irq(port, iir); + /* + * It is possible that RX TIMEOUT is signalled after FIFO + * has been drained, in which case a dummy read of RX FIFO is + * required to clear RX TIMEOUT condition. + */ + if ((iir & UART_IIR_RX_TIMEOUT) == UART_IIR_RX_TIMEOUT) { + if (serial_port_in(port, UART_OMAP_RX_LVL) == 0) + serial_port_in(port, UART_RX); + } serial8250_rpm_put(up); return IRQ_RETVAL(ret); -- 2.31.1