From patchwork Tue Nov 8 12:19:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 17011 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2668852wru; Tue, 8 Nov 2022 04:21:20 -0800 (PST) X-Google-Smtp-Source: AMsMyM6+gyf54F8amb4MfWsCxsps+obyhpPzYYThCovMO9erqboCMU9LHxChc5gVGAOypshx+KAA X-Received: by 2002:a17:906:ccd1:b0:7ad:e22f:3ffc with SMTP id ot17-20020a170906ccd100b007ade22f3ffcmr41072769ejb.85.1667910080462; Tue, 08 Nov 2022 04:21:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667910080; cv=none; d=google.com; s=arc-20160816; b=IOLIyoXS6Z+R3jIFm+STqdK6loBPmEITeMF/ymXb/IEjxsk3U+wiRCu9rX5RNviSk4 KPcByXIH5wXRC80IUcjqkAu56DxOLfgQjVr3qBCiguH5ccYx93ZD6ySRq9GbPub4T0Rq cY9HtvmU0ra0+TOpJ1zOFp9kcvpqsKZhdA+gYnEzAEASrTARy+NQw1tSdsBaKrtoYNbF qzU88I/GfRCU3pdYtbcK8DQBC/1dBHjedOziaSaqC5NU2OVf3JWdx8NASqnTgL4EIo7P HBa2ypGr106EV4VX+QcSCcl4kt3gdvbSIBzkVcH9jPd9Yhd+H4ZEd7IWT+ViNat+vDtQ 0zCA== 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=5Y9CZQXR4SvLOfq2CZqnarubg1lnMp759V6jQvtdAMU=; b=di47E9E6Z15d+v1lL5ReyajYeS4nUsmlijgzIpPivjCliku7F13+PFbZIfiqbZg0DL ogbNh1uJTERFqc9cyjXTjCkLu8uU4Z12SOpf+98+ba7wB3BpX1FInbm1k94XliXppHEN f5l4sGQ5cwBIZ7kxQxdpyTP/lxaVUDp/c4eu7FsMBDM/F1G9Z8Seqen6bJGBGEVuWml3 +g8qfAaATHjbKAGonLwo53u01CVf/L41RL/37HITtp9vevmbQ94RbB4cLHGZvUfTGaTQ AbMnD1/vQEtFYQHBIKWwE0468XKyZ7HEviPJKnB6yI5qldhvuLoFSbboEo418ots9I0R 7cnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=f9dSnV9Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 17-20020a170906309100b007ade664ee53si9286613ejv.148.2022.11.08.04.20.53; Tue, 08 Nov 2022 04:21:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=f9dSnV9Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234165AbiKHMUV (ORCPT + 99 others); Tue, 8 Nov 2022 07:20:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234163AbiKHMUQ (ORCPT ); Tue, 8 Nov 2022 07:20:16 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1837C29C84; Tue, 8 Nov 2022 04:20:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667910012; x=1699446012; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kwbVN41tr92ZOfdbCaPY/Bzq8aetPvpbAPbc0F2INvo=; b=f9dSnV9YmZNy7/bwQhn2sPRCFDfzf6kZQuXy3lST9apAy8PezSQzqFL6 mSYFJNWd0X+IdGWDsgTls1ny42WciPPo9KuJja9YF9N5ZAxufKzP9n1Ww dyh866Q0Epm52aaAf48lEJzvutK/7OU0uzycZ5sqvMB6gboXhbcPIjNPm xXW06V4D25QmfbgnpS4/M4eYZ7sd0FXeXMwDFRzoze8mbf3U/9/IAcd8A 1p/uqG1Hxx4VlQoAoBojpDAZUVAuxt9ffn0phMMWKjJwUfTOMUhyWmxEK xFe4v4N8Fj9t4Uwky4KhQdaQ+OGRgbSbkQy0jAITc4DibIkEmFXAUh/ws g==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="311834671" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="311834671" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 04:20:11 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="741932192" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="741932192" Received: from ppkrause-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.249.44.73]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 04:20:08 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Heikki Krogerus , linux-kernel@vger.kernel.org Cc: Gilles BULOZ , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , stable@vger.kernel.org, Srikanth Thokala , Aman Kumar Subject: [PATCH v2 1/4] serial: 8250: Fall back to non-DMA Rx if IIR_RDI occurs Date: Tue, 8 Nov 2022 14:19:49 +0200 Message-Id: <20221108121952.5497-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221108121952.5497-1-ilpo.jarvinen@linux.intel.com> References: <20221108121952.5497-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748930480259606931?= X-GMAIL-MSGID: =?utf-8?q?1748930480259606931?= DW UART sometimes triggers IIR_RDI during DMA Rx when IIR_RX_TIMEOUT should have been triggered instead. Since IIR_RDI has higher priority than IIR_RX_TIMEOUT, this causes the Rx to hang into interrupt loop. The problem seems to occur at least with some combinations of small-sized transfers (I've reproduced the problem on Elkhart Lake PSE UARTs). If there's already an on-going Rx DMA and IIR_RDI triggers, fall graciously back to non-DMA Rx. That is, behave as if IIR_RX_TIMEOUT had occurred. 8250_omap already considers IIR_RDI similar to this change so its nothing unheard of. Fixes: 75df022b5f89 ("serial: 8250_dma: Fix RX handling") Cc: Co-developed-by: Srikanth Thokala Signed-off-by: Srikanth Thokala Co-developed-by: Aman Kumar Signed-off-by: Aman Kumar Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_port.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index fe8662cd9402..92dd18716169 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1897,6 +1897,10 @@ EXPORT_SYMBOL_GPL(serial8250_modem_status); static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir) { switch (iir & 0x3f) { + case UART_IIR_RDI: + if (!up->dma->rx_running) + break; + fallthrough; case UART_IIR_RX_TIMEOUT: serial8250_rx_dma_flush(up); fallthrough;