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; From patchwork Tue Nov 8 12:19:50 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: 17012 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2668931wru; Tue, 8 Nov 2022 04:21:30 -0800 (PST) X-Google-Smtp-Source: AMsMyM7l+vVz7Po1orQdJqRi03jKtr7arnq4XEbnaPy7fARlBVUqLLQs7dR02JHpixmE8VLhDJq1 X-Received: by 2002:a50:ec99:0:b0:462:2c1c:8764 with SMTP id e25-20020a50ec99000000b004622c1c8764mr54589361edr.325.1667910090318; Tue, 08 Nov 2022 04:21:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667910090; cv=none; d=google.com; s=arc-20160816; b=RH7UU7FHEX+vW1upA01xmXn95WknMD/8mH24VvCgmXz/UU+5IDNgOqjR8RhR6vGRu2 7Eq9+ZoYrzQW9xYhhDRV4n3rTWvyP/+glmNANKjU7YByI0ps+1U9SEBMxyMcTatn0+Nq buJWJJbZr+vb0kN7eeMypKQ6pwOGI1X11WHRBuik92b38b82kJrtYg8GO8RFRmOiwXyo CeT0HV6mxkNjoZgQWF6/FCKWQNabKu0NkhFdsLDWvOXEfk3D5HfXFWaaOaL3qAbuH/uv FQqpZWjSAIPQ4k5Nlp9wozB1jDjs8tPHujKemmolE8wmpz2LjNOA5QJfggNtH1oO6Oz/ UlCw== 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=SF5Pxn4OGlPPN4YLxF2fdydUKEE9fzugmM5ct9n1V8Q=; b=0ijKHr5k9xKqcYAEtkFSAK+HRIJugPvuF2EvxdnHIOIT5/e7svmwsBDc5Xv2YX69xY Y1uiTYaiKEBvZf8Vv4jvvSpBkTQrGX/oM3tLTNxhzKwf60IyrSJGnFmSj0gIgiFc6wbV TA+leOi7xPIggsqXxsESyG+aqxZZUW5QS8h0E+YC8l6AHTcm+Cqzkz1fRB9TpWfCLtCx nJMcKPDTx9RALMn2zw4opHDmwlVCuee/SCL7B7quT/9FnVMnm0pMyi8p96TlrO6EfXr2 3eUEUAg8ulMwUnnp4cGaJAIkFRWhj2SOYsramNpuCseMmgBwZj77Xoora5XibJAP13sN ZjuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=H+fztD5n; 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 v16-20020a056402349000b0045ca15afe1csi14899445edc.553.2022.11.08.04.21.03; Tue, 08 Nov 2022 04:21:30 -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=H+fztD5n; 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 S234170AbiKHMUZ (ORCPT + 99 others); Tue, 8 Nov 2022 07:20:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234153AbiKHMUS (ORCPT ); Tue, 8 Nov 2022 07:20:18 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C14413EBE; Tue, 8 Nov 2022 04:20:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667910015; x=1699446015; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JLWjR1QhfIzzz63zvvQ1hW3NXrVYq+1ORm+qFn4evPQ=; b=H+fztD5nJTicnbF1On56Tq8LoLYsdaCJGuhmoaVE3IFKNPOKl96xp6PH rqll8cGfJGG5xHGm6PQOCxEFo2e3+x2uVnQHR6rlMHcAHfuyyIdy/hVfd ESFNYyowpIjbxNDPqbpVu6l0nrKmxq8acMZBbvt9+XnKrwVn+DEo8pD+k CBOHujmuxVPGgqM6X7IGQOVYAEY/F6ydyNt83SawBh9M3CJlZF6gG4J+3 cJ73Rm48QTUBTOAPgC5l6i5iOTyPqyHMXan7H8SUeE+kFXuZt1iZGMoSr 15rs1LOeYIc+0HMD8MApSH3R7klwQIzmlvnVt9KzJo66wqalsQrw1qbht Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="311834679" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="311834679" 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:15 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="741932198" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="741932198" 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:12 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , =?utf-8?q?Ilpo_J=C3=A4?= =?utf-8?q?rvinen?= , linux-kernel@vger.kernel.org Cc: Gilles BULOZ , stable Subject: [PATCH v2 2/4] serial: 8250_lpss: Configure DMA also w/o DMA filter Date: Tue, 8 Nov 2022 14:19:50 +0200 Message-Id: <20221108121952.5497-3-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?1748930490873514312?= X-GMAIL-MSGID: =?utf-8?q?1748930490873514312?= If the platform doesn't use DMA device filter (as is the case with Elkhart Lake), whole lpss8250_dma_setup() setup is skipped. This results in skipping also *_maxburst setup which is undesirable. Refactor lpss8250_dma_setup() to configure DMA even if filter is not setup. Cc: stable Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_lpss.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c index 44cc755b1a29..7d9cddbfef40 100644 --- a/drivers/tty/serial/8250/8250_lpss.c +++ b/drivers/tty/serial/8250/8250_lpss.c @@ -277,8 +277,13 @@ static int lpss8250_dma_setup(struct lpss8250 *lpss, struct uart_8250_port *port struct dw_dma_slave *rx_param, *tx_param; struct device *dev = port->port.dev; - if (!lpss->dma_param.dma_dev) + if (!lpss->dma_param.dma_dev) { + dma = port->dma; + if (dma) + goto out_configuration_only; + return 0; + } rx_param = devm_kzalloc(dev, sizeof(*rx_param), GFP_KERNEL); if (!rx_param) @@ -289,16 +294,18 @@ static int lpss8250_dma_setup(struct lpss8250 *lpss, struct uart_8250_port *port return -ENOMEM; *rx_param = lpss->dma_param; - dma->rxconf.src_maxburst = lpss->dma_maxburst; - *tx_param = lpss->dma_param; - dma->txconf.dst_maxburst = lpss->dma_maxburst; dma->fn = lpss8250_dma_filter; dma->rx_param = rx_param; dma->tx_param = tx_param; port->dma = dma; + +out_configuration_only: + dma->rxconf.src_maxburst = lpss->dma_maxburst; + dma->txconf.dst_maxburst = lpss->dma_maxburst; + return 0; } From patchwork Tue Nov 8 12:19:51 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: 17013 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2669276wru; Tue, 8 Nov 2022 04:22:14 -0800 (PST) X-Google-Smtp-Source: AMsMyM5CohrscGPbmVxKO8oKEiJqh+RMCCvMy7TbAdM23P2begDrjNF9qj0Y3ka12Gjz+yovNy8r X-Received: by 2002:aa7:c6d9:0:b0:461:b431:9058 with SMTP id b25-20020aa7c6d9000000b00461b4319058mr55590501eds.208.1667910134622; Tue, 08 Nov 2022 04:22:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667910134; cv=none; d=google.com; s=arc-20160816; b=eKdRmC1JTufX8N60WeKt8CvGVhbrDxBa00tOzoYQAbJqPUd0xtIIMEAmCr18+REQwE OOYqoD7za/4akizsAsAHY97XUVVq9l/z+TAQ2UuikRqnEHpTQjvAciFqn37W3RF35Caw 2Fz6BtKKmo2L+Sh5HReGMHQEnsQWI043UD/s8rj3bNiSuH9fM7a75/ujZ230eNZnWnGa UQTN4Fk91Oz7QkxKTDalUapj4VOp94DYaSYaxIkRzH9u2nT2fBQ7w6SVtutpM/TF0GiZ 48VSxdGRW7CEe4bmmgoA2vpa9SQ69QB4xuXDfIaIH+ElB6OGxOc0LOlUmkZMBXeJ/St/ b1xw== 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=wOrRYHV5NJZqQkfLWy7SabjUcVACwADvMAeHehlcsGE=; b=tj0CcaLA4jtSrJjz0KkUo9IyUXlHDw1L2A/FlLNg/gJHVlC5b7D4hhxZpBwNwbw78x E+8K6G786jN5JKLetOxSjlRyAw20ZUcdmJhHR5Vb2rg3WdASJkcU6U6ilP1fRBhtwZSg TMPJ23JhJikKMM3KTYgt2cq3ofoCaycHi+iJIo4S6B8EcmNR5PKKfmPoKreB357DuMqg ShCad2vI9ik4Fxjp694lN/Atoq4pebCXIzQkScs0PK+G1sm/upEpIh7E2EH2Wpz5hnSw v/1umvS354iAP9mLoTYJ7kUs6J2jTM/nhcrophnkZl1kOKwu3HByPPbZlmyel98SPhIV BFAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Qax7mrGS; 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 z1-20020aa7c641000000b00461a8c8f155si11243978edr.161.2022.11.08.04.21.41; Tue, 08 Nov 2022 04:22:14 -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=Qax7mrGS; 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 S234168AbiKHMUc (ORCPT + 99 others); Tue, 8 Nov 2022 07:20:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234147AbiKHMUW (ORCPT ); Tue, 8 Nov 2022 07:20:22 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9905E13F1A; Tue, 8 Nov 2022 04:20:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667910021; x=1699446021; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U3IZ849nN3cT/APl5Y2asdOcNM93x6vO1SV0zIv20QY=; b=Qax7mrGSGeYBpn/CaFXYJltw4Gg3DtYwjToKeGya+YPxMhmJHacscoXZ BPqplRx+rL3FjUxQequuozACbBayotfztyi+zjgCpvkQ6noqF2UQ7XBru IAZNjM5Y1s82Q2lD0qsKDMoy0suudY620MVzSi34TPlg4W7uXXehEV9Gc v8yOUUZoc9SjtggPOk+URBtnWnZTU1avRoUtMcHkjm5Mh5MK/cezvy2ei SiQDNkPmwS+AR+0zsjeXAR1tOFDgzUc+uKRT7quX9ItnNq70/co0h63lb h1RJKreLCZsuw5v89xIHyAYAAdWAjTftc1f9J4aW4LIxrVMQ4XZml0leP Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="374951461" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="374951461" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 04:20:21 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="741932222" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="741932222" 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:17 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , =?utf-8?q?Ilpo_J=C3=A4?= =?utf-8?q?rvinen?= , linux-kernel@vger.kernel.org Cc: Gilles BULOZ , stable@vger.kernel.org, Wentong Wu Subject: [PATCH v2 3/4] serial: 8250_lpss: Use 16B DMA burst with Elkhart Lake Date: Tue, 8 Nov 2022 14:19:51 +0200 Message-Id: <20221108121952.5497-4-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,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?1748930537044674681?= X-GMAIL-MSGID: =?utf-8?q?1748930537044674681?= Configure DMA to use 16B burst size with Elkhart Lake. This makes the bus use more efficient and works around an issue which occurs with the previously used 1B. The fix was initially developed by Srikanth Thokala and Aman Kumar. This together with the previous config change is the cleaned up version of the original fix. Fixes: 0a9410b981e9 ("serial: 8250_lpss: Enable DMA on Intel Elkhart Lake") Cc: # serial: 8250_lpss: Configure DMA also w/o DMA filter Reported-by: Wentong Wu Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_lpss.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c index 7d9cddbfef40..0e43bdfb7459 100644 --- a/drivers/tty/serial/8250/8250_lpss.c +++ b/drivers/tty/serial/8250/8250_lpss.c @@ -174,6 +174,8 @@ static int ehl_serial_setup(struct lpss8250 *lpss, struct uart_port *port) */ up->dma = dma; + lpss->dma_maxburst = 16; + port->set_termios = dw8250_do_set_termios; return 0; From patchwork Tue Nov 8 12:19:52 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: 17014 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2669435wru; Tue, 8 Nov 2022 04:22:34 -0800 (PST) X-Google-Smtp-Source: AMsMyM7Ihl9tuEkHts0HI7AllkNuzqLsF118d/isk7dnfBJHmdDjPOOq+lQk3uAbC5XuWujhEyTB X-Received: by 2002:a17:90a:2a02:b0:214:247a:c185 with SMTP id i2-20020a17090a2a0200b00214247ac185mr35674578pjd.226.1667910153918; Tue, 08 Nov 2022 04:22:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667910153; cv=none; d=google.com; s=arc-20160816; b=xEP51o9fGWmnymUG/53AmG5fAdH0Qd0mO5QsOhNHhkonhudUlAMwDX+ZdebxKDfDS0 tj4kGl4COr07E21KkmYiCxxNxR4JUxNkZAe9ry7ay+uhId6Oe7GY7xuYB5t0Ha74Ctis E7WHhSlQ7t9QOSXs4Oyc4IWDBcPpfBdkpITKqRTS7RgNZicVgDAc7OXTlsCmxtplDR+A x4TOBftvyZB+5NQ0VHpt2YEo4T4S5QaWcZhyoDNLBperKR/4+t9x1NY2O/AfRGzb2Bo4 wn4a8ZI6ngrnBgF/dbw3PdwP7zBAyo0ACOBtrKAsiHtWDWh7QfvNhkiQabhu17kj5maF IDUg== 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=1PxHXRMNjUMWZSw+qMolAXh2UxgPNLnzfxX/TwzlKBE=; b=RxQi1+HRgEnkAjgodxK3pfxOlddk578scUjQltj9414UIfPTm3kq7i/A1qF4Qwydk5 EKv2rUZjK+GGX2FOKzgnzg3EybOrAZB+lWRS2Tn5hf73SSB6T5i/7Dntnsi8QvQiA5kW S4xX1ybL64M0uAm4752aPkqNbGJ4HIqCAdZR4s9Z3S66bUlQVIMXjzIXli2hzySUlvcg buMfKibRJBwtxtMqiG1aZPSOdB6AI3bsa1jzl6tNDTRI7q9dDMXLlzh2Dn0TsR+Bv22F 48XgczmdA2Ad9MU2tzzdl1ImvdeQ25RIOmpfFs5ecx07glfowfVorqJ+E9FIPpwB2igR o/BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S04avOY4; 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 d16-20020a170903231000b0017840d9d42esi16356822plh.582.2022.11.08.04.22.21; Tue, 08 Nov 2022 04:22:33 -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=S04avOY4; 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 S234179AbiKHMUg (ORCPT + 99 others); Tue, 8 Nov 2022 07:20:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234153AbiKHMUa (ORCPT ); Tue, 8 Nov 2022 07:20:30 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0795F17A9E; Tue, 8 Nov 2022 04:20:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667910026; x=1699446026; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vkqZhcPnjGQqDiDQpqIE/N5L7Qt+GaZklcF5cPF1GxM=; b=S04avOY4z2fnKV5eQWl0ii4kD8D9lSBAvdVDho6Sp2LRdnlQxYIaxhNR VKR0Y6QSg37RtQvWqHGEP/nXVWvJN/OQybpjj1yeJb85HKc26reGl9G9Z oCd5lQ9pKgNI5EVZkhRylc9Dit+qIrZYbywfdvkqXMybaxFo7Zuu0mVe8 4kMRtV1f8OKc9E4swrC3LVnaJFxNtTig1sCl+HP1CP6O519XM+nP9Wjq0 9u17JZnqq6gD0+91fcjTff3Xn44mzNSqeHBQjfwELGEDmo+oRfjcwFR5M CckDC/TJRKKGiX56E1QVQrz82rf2ylyFGRPYnWbqjFTdhC4WHkCOG82Kc g==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="374951476" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="374951476" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 04:20:25 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="741932231" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="741932231" 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:23 -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 Subject: [PATCH v2 4/4] serial: 8250: Flush DMA Rx on RLSI Date: Tue, 8 Nov 2022 14:19:52 +0200 Message-Id: <20221108121952.5497-5-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,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?1748930557445205484?= X-GMAIL-MSGID: =?utf-8?q?1748930557445205484?= Returning true from handle_rx_dma() without flushing DMA first creates a data ordering hazard. If DMA Rx has handled any character at the point when RLSI occurs, the non-DMA path handles any pending characters jumping them ahead of those characters that are pending under DMA. Fixes: 75df022b5f89 ("serial: 8250_dma: Fix RX handling") Cc: Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_port.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 92dd18716169..388172289627 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1901,10 +1901,9 @@ static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir) if (!up->dma->rx_running) break; fallthrough; + case UART_IIR_RLSI: case UART_IIR_RX_TIMEOUT: serial8250_rx_dma_flush(up); - fallthrough; - case UART_IIR_RLSI: return true; } return up->dma->rx_dma(up);