From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA260C43381 for ; Thu, 21 Mar 2019 06:57:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73F44218B0 for ; Thu, 21 Mar 2019 06:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553151466; bh=U+UE48Letu9lIMdA2NVlEoKsMHapeofHJqYLVH8TgUE=; h=Subject:To:Cc:From:Date:List-ID:From; b=cII9rUC9FHT/YVoENEEA14CmFrD+7PGmkfyQQIZ9IdVIxvuk4PVacs2ogxv97OGSb QL+AZYFP9+c3VShVV5unnax+EvKMHZGrYJHhnXte5pmASpBcvZUNgaYp61219blCjE lQoYhbOjPl4N1YQ9uVlTKz/zew1sIzFxxpSsv060= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726509AbfCUG5p (ORCPT ); Thu, 21 Mar 2019 02:57:45 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:42877 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726253AbfCUG5p (ORCPT ); Thu, 21 Mar 2019 02:57:45 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 6A2FD21E07; Thu, 21 Mar 2019 02:57:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 21 Mar 2019 02:57:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=5RV0BW uBjgyewz5cdKWa3KbEWo4H4Ujim2nhWZrbAVg=; b=6lDJvUeY0YM/48ZEMvZXkh Qha4dV4zdN5mR3j0plSXJLRO6IJH90qRwHOH+N4+NtRwzh4U7DkwLeQaLCStdV59 X0X/ru3H3R9IKdPfdhmiLT6tyxs809Nq3gqC49CgYAuDLox5d8CLqOTp1zk7PZDj Xb/DQ3qxeXSXqAi0pbId2qF2YFL3FCa82PL8sLH5cJ79+BbLzN2WfIdUN6Xg38Jj nWiS48OgYcfPTHTQQMw6uRa/Hiyb3a2tdTwhbXBhXgWMfkaUnsuZ95Wjw+VEfDZI iaX8PC3keQxLA5AUMVCMy9rTRJ3Bch71FTl5DKUTEvzexb6KNgAk31BnwEu9XgCQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrieejgddutdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (5356596b.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id E7BD8E4549; Thu, 21 Mar 2019 02:57:42 -0400 (EDT) Subject: FAILED: patch "[PATCH] serial: uartps: Fix stuck ISR if RX disabled with non-empty" failed to apply to 4.4-stable tree To: anssi.hannula@bitwise.fi, gregkh@linuxfoundation.org Cc: From: Date: Thu, 21 Mar 2019 07:57:41 +0100 Message-ID: <155315146128255@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.4-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 . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 7abab1605139bc41442864c18f9573440f7ca105 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Fri, 15 Feb 2019 18:45:08 +0200 Subject: [PATCH] serial: uartps: Fix stuck ISR if RX disabled with non-empty FIFO If RX is disabled while there are still unprocessed bytes in RX FIFO, cdns_uart_handle_rx() called from interrupt handler will get stuck in the receive loop as read bytes will not get removed from the RX FIFO and CDNS_UART_SR_RXEMPTY bit will never get set. Avoid the stuck handler by checking first if RX is disabled. port->lock protects against race with RX-disabling functions. This HW behavior was mentioned by Nathan Rossi in 43e98facc4a3 ("tty: xuartps: Fix RX hang, and TX corruption in termios call") which fixed a similar issue in cdns_uart_set_termios(). The behavior can also be easily verified by e.g. setting CDNS_UART_CR_RX_DIS at the beginning of cdns_uart_handle_rx() - the following loop will then get stuck. Resetting the FIFO using RXRST would not set RXEMPTY either so simply issuing a reset after RX-disable would not work. I observe this frequently on a ZynqMP board during heavy RX load at 1M baudrate when the reader process exits and thus RX gets disabled. Fixes: 61ec9016988f ("tty/serial: add support for Xilinx PS UART") Signed-off-by: Anssi Hannula Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 094f2958cb2b..ee9f18c52d29 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -364,7 +364,13 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) cdns_uart_handle_tx(dev_id); isrstatus &= ~CDNS_UART_IXR_TXEMPTY; } - if (isrstatus & CDNS_UART_IXR_RXMASK) + + /* + * Skip RX processing if RX is disabled as RXEMPTY will never be set + * as read bytes will not be removed from the FIFO. + */ + if (isrstatus & CDNS_UART_IXR_RXMASK && + !(readl(port->membase + CDNS_UART_CR) & CDNS_UART_CR_RX_DIS)) cdns_uart_handle_rx(dev_id, isrstatus); spin_unlock(&port->lock);