Received: by 2002:a05:7412:a9a3:b0:f9:327e:43ab with SMTP id o35csp38405rdh; Mon, 18 Dec 2023 03:51:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5oWy3AOyJEqR6FW4U2TErUDbjlNn93qMxj2UoKSjCjUXuiE3od6BHzqDUwBOTb0G96mj1 X-Received: by 2002:a05:6a00:8c8:b0:6d0:9bca:8645 with SMTP id s8-20020a056a0008c800b006d09bca8645mr8739528pfu.36.1702900276579; Mon, 18 Dec 2023 03:51:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702900276; cv=none; d=google.com; s=arc-20160816; b=Njud6RTGrZeDXcpYWmNYuCAy82nDUg5iC+w4iaq4hKDhns4neXeGT5XZSz1Cu2bU68 gQDHqG4uNv/fhJQUCf3xmw8g2w67QPuCfwP981KtN8uX2XOcOpZG6NZR7Lq01jGEBhq6 DAEJqxVGEggXqSTyaGkhDjELy/tuLREr8BPCKT0QtyB6bRnlccEgcpLpryp4k8eaHaNt ajhHUyX8gm1h0K3w8lvFk9Iadg3DK+47NdZeMj/LfnWkI7sIqARWp5cwnMqhnHQ5uGfJ OPVYPxKiHCRaMsdfvouNdiXmhcQLd7lSnVWYwW6IxfaO/68RMvEyiQXMNiL/kc7z1Xjt YIoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=hzel1/ce/1mP1V20RRQos9BIDs2j5BOkjFb4gEFtAeQ=; fh=1pmAyp3xZ8sWUV98t98q7URUgX68KjDmTZriOyZWZ/U=; b=Je3QNTwPsgsgelWH2+8ghT0ivvXWY7jLIGXhVweJYnGvhQnj0l3L0xMwDl8kIIa/vO eiN9fusWTDAYApkMUv7KByIbKt0PmvhyjOARZSrpKi6N43+PCrGG6CBvdRBKeoG/hjH4 2MNJEazkLOSjm6VzVTer3SyEEQvKC5/LMc7kfp1Mgtt72xJSsz2A0gHgSpsnJ9QgQtVY SEtuHC7fJr0uSsO1kUXaHUGvG32pjInGuKDQDp9bt6dVkQY4/U/Y7Q0uwshDwEA6cv0h NRRISD0dIMN710R/PkWmzfxqCjyR7uzQm6FhcCPDTlYr8BKZ1ORegNjTqyNkw3tMRPd4 LQFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alatek.krakow.pl header.s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3 header.b=KwrBueKy; spf=pass (google.com: domain of linux-kernel+bounces-3483-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3483-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alatek.krakow.pl Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c11-20020a63d50b000000b005c278ba0fe3si17161216pgg.556.2023.12.18.03.51.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 03:51:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3483-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=fail header.i=@alatek.krakow.pl header.s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3 header.b=KwrBueKy; spf=pass (google.com: domain of linux-kernel+bounces-3483-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3483-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alatek.krakow.pl Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3C53E282BB2 for ; Mon, 18 Dec 2023 11:51:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47BEA41769; Mon, 18 Dec 2023 11:40:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=alatek.krakow.pl header.i=@alatek.krakow.pl header.b="KwrBueKy" X-Original-To: linux-kernel@vger.kernel.org Received: from helios.alatek.com.pl (helios.alatek.com.pl [85.14.123.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E852C3D0DD; Mon, 18 Dec 2023 11:40:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alatek.krakow.pl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alatek.krakow.pl Received: from localhost (localhost [127.0.0.1]) by helios.alatek.com.pl (Postfix) with ESMTP id 0C0D42D0186C; Mon, 18 Dec 2023 12:40:28 +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 Va4eSrGRR6VO; Mon, 18 Dec 2023 12:40:27 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by helios.alatek.com.pl (Postfix) with ESMTP id B4E872D0186B; Mon, 18 Dec 2023 12:40:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.10.3 helios.alatek.com.pl B4E872D0186B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alatek.krakow.pl; s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3; t=1702899627; bh=hzel1/ce/1mP1V20RRQos9BIDs2j5BOkjFb4gEFtAeQ=; h=From:To:Date:Message-Id:MIME-Version; b=KwrBueKy4tMDlYb+GHVFyiKUQXe89KVYvhYuoZmEACjYWolaFkshVXU9EgdByEY1X SvQyZ5+I8OlXdFMTd1k6QJ+5edd+KnDavDF0iQ72wN/5TA5jRHRwFpjwKpbQ6+YXMC +Y22ixURvIrN/XRn2WAB/KxGGdc3uAYQGQ6kUKirW0gkMhkAUs7ZOKEty1V1K/Tx9/ m7uqOHtZvQBMvuUJs+1EDyXU+u3sQFO47sET0RU6LLaEOmOdYJUnmYSV6BDd4vQk5k WOpYDaMT8UuK4AODlOubZWCdN9mSQtUudqCLql8YX3aCQvnlgt68hSurmJBsZBQWP2 sbN0wSu+r05VQ== 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 hiZwfRKIXf4w; Mon, 18 Dec 2023 12:40:27 +0100 (CET) Received: from ideapad.. (unknown [10.0.2.2]) by helios.alatek.com.pl (Postfix) with ESMTPSA id 7FF5D2D01868; Mon, 18 Dec 2023 12:40:27 +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 v5 5/8] dmaengine: xilinx: xdma: Add error checking in xdma_channel_isr() Date: Mon, 18 Dec 2023 12:39:40 +0100 Message-Id: <20231218113943.9099-6-jankul@alatek.krakow.pl> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231218113904.9071-1-jankul@alatek.krakow.pl> References: <20231218113904.9071-1-jankul@alatek.krakow.pl> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index 0c7350863873..9a1d2939a333 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -811,6 +811,18 @@ static irqreturn_t xdma_channel_isr(int irq, void *d= ev_id) desc =3D to_xdma_desc(vd); xdev =3D xchan->xdev_hdl; =20 + /* 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); if (ret) @@ -818,14 +830,6 @@ static irqreturn_t xdma_channel_isr(int irq, void *d= ev_id) =20 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; --=20 2.34.1