From patchwork Mon Nov 7 11:07:05 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: 16375 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1980992wru; Mon, 7 Nov 2022 03:08:37 -0800 (PST) X-Google-Smtp-Source: AMsMyM6kUW+jjAWHVVNAteoXXR3dp9HrPECbadQSORBAp/xqnURSPOO5Lgsw4Fiq0wVeVJ8WaEdE X-Received: by 2002:a65:6148:0:b0:458:88cd:f46 with SMTP id o8-20020a656148000000b0045888cd0f46mr41917250pgv.303.1667819316721; Mon, 07 Nov 2022 03:08:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667819316; cv=none; d=google.com; s=arc-20160816; b=WRx9gtwe9QfaL2eLHiNSaDg1GkS+pdtqQIo5QdVOA4ROjozPKrEY1k8/EhFdMOLeu5 cf+PS82J0373wZPnfWzM7hBqYuD+Bo9fD29W4aWTA38kCTf+sHqJev9cIr1CwZCDsV4h IJFkazZTk7xVzzK6HQFCAyzGyN+Mxfq6yw++H43CyDAx4ndu8o4kBcXyl6aDPQIAocK/ 9dxnaAnAsrMWoZp1wfVPi13qlSs2MMm0vN5I+tHl2p1vMMbW2MOkgO5bghiUFD9i4FuS 5iAnqMF/VHY6IAZajSIP3+fwLoIO7U3iOB2yKg51tZjyU3p292GRJazt4bhi7CLHDmIm 5fgQ== 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=ORc8HTm9kplZHpRIeLVoJlLZdtxywDVyqjBsF+bWMzNNHroIyD1ISxm+HSdbVi9lVp 6brYPVBcW8OUvTMlhQPHnx7VeQfZ8h1YY1ox9/Tax4ngNJOtFPao5B/4rmUG7pFkBdwv w6hcP6a8qoLMK97Hjr7d8SkWWdGvckwJn6R/1FUMp8N5OTIb6pxM6Kcx+8PsuCg8qoqT 1iPtlJ98sbzwmxzYhKTc/mn2Uh6itz+Ya+dm4Lq1mMciyuKUtwq236QDdIMyJog25Dye Ww+54egH0sSm75iaJ71fqkAjgHofP0gar5xZ48cDtH3oMoC/D3r9M2Qa6besSIIEugyt xPBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=klRtpQ4b; 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 g5-20020a63dd45000000b0045a07a7c790si9884568pgj.740.2022.11.07.03.08.24; Mon, 07 Nov 2022 03:08:36 -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=klRtpQ4b; 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 S231546AbiKGLHf (ORCPT + 99 others); Mon, 7 Nov 2022 06:07:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231158AbiKGLHX (ORCPT ); Mon, 7 Nov 2022 06:07:23 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 110F918374; Mon, 7 Nov 2022 03:07:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667819243; x=1699355243; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kwbVN41tr92ZOfdbCaPY/Bzq8aetPvpbAPbc0F2INvo=; b=klRtpQ4bOaQK/8VI5XINYox9qNZZ/XQVh2K8M871OOweASlAInlHhMO2 nYy4qqh1XRLM9D7M9fZ2BdlPG4BPamrwpn5mgLSPp9Z1g7726EUaiWgql U82Am7JIQkC+CyS4w1of2G412nlq9c6SEHC/Se9wvcMy5IzDYL2Fxp7fb 6UQasb5daX/nqtSaYIb/zrO53/0j1+CWACc6jpziC/R/14Rw/SyLSb3vy jtPNh0OQ3DGW8mvFknt2o6dKdyH1315jnhmbVF2pcykXI/NAEwJLMYJf/ kWuRBIrPLEN0d7UnqE4wlEFrB/F8IjO9KPcRbC8vFmyamfXR20ZlhPcGz A==; X-IronPort-AV: E=McAfee;i="6500,9779,10523"; a="290773009" X-IronPort-AV: E=Sophos;i="5.96,143,1665471600"; d="scan'208";a="290773009" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 03:07:22 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10523"; a="586932338" X-IronPort-AV: E=Sophos;i="5.96,143,1665471600"; d="scan'208";a="586932338" Received: from gschoede-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.46.211]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 03:07:19 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: Andy Shevchenko , Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Heikki Krogerus Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , stable@vger.kernel.org, Srikanth Thokala , Aman Kumar Subject: [PATCH 1/4] serial: 8250: Fall back to non-DMA Rx if IIR_RDI occurs Date: Mon, 7 Nov 2022 13:07:05 +0200 Message-Id: <20221107110708.58223-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221107110708.58223-1-ilpo.jarvinen@linux.intel.com> References: <20221107110708.58223-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,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?1748835307421713152?= X-GMAIL-MSGID: =?utf-8?q?1748835307421713152?= 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;