Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2349128rdb; Fri, 8 Dec 2023 05:50:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYzFUdhbYWB9km5d/VWhuU4JkAW5M+I0g8htZud29OIiDgUdi7CW5hB2ylxJrLAzZtVKRp X-Received: by 2002:a17:902:ce92:b0:1d0:af28:461a with SMTP id f18-20020a170902ce9200b001d0af28461amr52943plg.12.1702043449220; Fri, 08 Dec 2023 05:50:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702043449; cv=none; d=google.com; s=arc-20160816; b=QDnxUbYjDm273ANkbzz5ufvETNfpC5ootnDahvmno9D6uZrnRjfKM+ncrL9qz6ARRQ 92K8cqEzw0QhGFUBuhAb/cgm+VryiM//sh51EPcTAkSRIkc6px26CYNZx/OmXjPa9I+e nsI+PR1bRIL/r2ozz/v+ipiG72wzIkj5pxgxKbjPumVoxOrh1jTd+9oeZvn0WNXl+Bzc Yz5HZSspLiZ8vcJ3Llk38kyMOgs4pkyUfSJJWJq7wuCfuw9ve1zEItRJ6f7ED9V0vTPq N+xI2U/PehGIiybFsRtcSEMwYlNMZTdC8kKCmDipRtiptA0sNsJiH6VB+BqkzD605loz PUpA== 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:dkim-filter; bh=FJ8DQb20r8QyG+A0qxamCKht73H5yayCdeykyOFrSrg=; fh=1pmAyp3xZ8sWUV98t98q7URUgX68KjDmTZriOyZWZ/U=; b=hOWSg5kEtqyYK5kfuWPj/0eLMI4T0BMF2YnplSPNaDr5ponbUKdaBXAkDRq8qf35GW aHIfBtRGMzcdP7F+lzqHVZ0zeinx/MlqH28lI6US+ugNV+xaVzKQ8z71dmbQXCTt9a8W qQGKWEzacngHxw22mNW9whnck6cB1qUYFiBgj3gLZHDTxC/p0dV2XwDZXCnWV6qbzTRn e9SqzEGjIJl1qK9wRH/GNzjVc4X0m2ol5ng/tDSvbLLvI+KjP71MWStJ7vULmljeQPME xaXT2KwLteLb4uwaG+gxT7YEK95P0Opcva5sXc5XUmJHxv8VDTBGUrFqGWoUiwHHIn+j fEwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alatek.krakow.pl header.s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3 header.b=O+7ppQEo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alatek.krakow.pl Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id ja5-20020a170902efc500b001cfc154c64bsi1614269plb.104.2023.12.08.05.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 05:50:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=fail header.i=@alatek.krakow.pl header.s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3 header.b=O+7ppQEo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alatek.krakow.pl Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 738FB825A18D; Fri, 8 Dec 2023 05:50:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573862AbjLHNu2 (ORCPT + 99 others); Fri, 8 Dec 2023 08:50:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573849AbjLHNu0 (ORCPT ); Fri, 8 Dec 2023 08:50:26 -0500 Received: from helios.alatek.com.pl (helios.alatek.com.pl [85.14.123.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C3D81987; Fri, 8 Dec 2023 05:50:32 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by helios.alatek.com.pl (Postfix) with ESMTP id 7AE802D00F59; Fri, 8 Dec 2023 14:50:30 +0100 (CET) Received: from helios.alatek.com.pl ([127.0.0.1]) by localhost (helios.alatek.com.pl [127.0.0.1]) (amavis, port 10032) with ESMTP id CEtv42v9Dyji; Fri, 8 Dec 2023 14:50:30 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by helios.alatek.com.pl (Postfix) with ESMTP id 382F12D00F54; Fri, 8 Dec 2023 14:50:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.10.3 helios.alatek.com.pl 382F12D00F54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alatek.krakow.pl; s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3; t=1702043430; bh=FJ8DQb20r8QyG+A0qxamCKht73H5yayCdeykyOFrSrg=; h=From:To:Date:Message-Id:MIME-Version; b=O+7ppQEoir+pHUE7j22iCchirLRFQddVPlSYA2lVjANr2L0b1cZg11BAu52B+51cN VieZhlDDf8ISDESQiWn0yt41YvESBe7urceXlvbBBL5rbpl01Ef6p2Qp4nWC8pjt+T 57pnMHiIb0Jzbl5vOJfEXTJoY8mUuXoGE9vC2TQDazQHMGOaM293TwEd+4yYTObrTh VTMuKkNT1vUVqu3dssTlQPiK/ZDjXbNXMyUk8MFm7A7nchG7AGQ1lvh/SVU/pP6v96 8gBlP0Z3KPyo4zboHMCbLEIxDL6xErzcJSmeUd4zzX+Wg8+Q6LNE2dOqzAbxZj+rmx DkGieyJv763OQ== X-Virus-Scanned: amavis at alatek.com.pl Received: from helios.alatek.com.pl ([127.0.0.1]) by localhost (helios.alatek.com.pl [127.0.0.1]) (amavis, port 10026) with ESMTP id uvm5zEZ6mtn7; Fri, 8 Dec 2023 14:50:30 +0100 (CET) Received: from localhost.localdomain (unknown [10.125.125.6]) by helios.alatek.com.pl (Postfix) with ESMTPSA id A88112D00F4D; Fri, 8 Dec 2023 14:50:29 +0100 (CET) From: Jan Kuliga To: lizhi.hou@amd.com, brian.xu@amd.com, raj.kumar.rampelli@amd.com, vkoul@kernel.org, michal.simek@amd.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com Cc: jankul@alatek.krakow.pl Subject: [PATCH v4 5/8] dmaengine: xilinx: xdma: Add error checking in xdma_channel_isr() Date: Fri, 8 Dec 2023 14:49:26 +0100 Message-Id: <20231208134929.49523-6-jankul@alatek.krakow.pl> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231208134838.49500-1-jankul@alatek.krakow.pl> References: <20231208134838.49500-1-jankul@alatek.krakow.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 08 Dec 2023 05:50:46 -0800 (PST) Check and clear the status register value before proceeding any further in xdma_channel_isr(). It is necessary to do it since the interrupt may occur on any error condition enabled at the start of a transfer. Signed-off-by: Jan Kuliga --- drivers/dma/xilinx/xdma.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index 521ba2a653b6..d1bc36133a45 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -812,21 +812,25 @@ static irqreturn_t xdma_channel_isr(int irq, void *= dev_id) desc =3D to_xdma_desc(vd); xdev =3D xchan->xdev_hdl; + /* Clear-on-read the status register */ + ret =3D regmap_read(xdev->rmap, xchan->base + XDMA_CHAN_STATUS_RC, &st)= ; + if (ret) + goto out; + + st &=3D XDMA_CHAN_STATUS_MASK; + if ((st & XDMA_CHAN_ERROR_MASK) || + !(st & (CHAN_CTRL_IE_DESC_COMPLETED | CHAN_CTRL_IE_DESC_STOPPED))) { + xdma_err(xdev, "channel error, status register value: 0x%x", st); + goto out; + } + ret =3D regmap_read(xdev->rmap, xchan->base + XDMA_CHAN_COMPLETED_DESC, - &complete_desc_num); + &complete_desc_num); if (ret) goto out; if (desc->cyclic) { desc->completed_desc_num =3D complete_desc_num; - - ret =3D regmap_read(xdev->rmap, xchan->base + XDMA_CHAN_STATUS, - &st); - if (ret) - goto out; - - regmap_write(xdev->rmap, xchan->base + XDMA_CHAN_STATUS, st); - vchan_cyclic_callback(vd); } else { xchan->busy =3D false; -- 2.34.1