Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp225994rdd; Wed, 22 Nov 2023 14:11:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDJTLApy7Av7pnjWnfrefl5F+9EO7D4IZVTxGJeKn3vun5Oh+fQczV2CGtA93lvCzsBtxh X-Received: by 2002:a05:6808:1a10:b0:3b8:4482:16f4 with SMTP id bk16-20020a0568081a1000b003b8448216f4mr2412170oib.52.1700691099979; Wed, 22 Nov 2023 14:11:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700691099; cv=none; d=google.com; s=arc-20160816; b=tzMc+PUyC+cNyiA2VdWwoa9h9jz7bN/YEpQ8Za3Z6f8G/soYtKicJbcmn3PQYsZKLt WTcpROCPVVenJpGIrpTwcY4NuGtye02zpcRYXlYK2JXIB3mmoERM/7U8QSxzEEpUP89T jUJCIEw8L7lY3yQ3LqTcg4KIpYJOG1dim77QU4YMKRyITpfyZh9qphWT9XTbmLdHTOyK hxtJxxjsRNeDdaufc/uSiaixgrGB0L45WIuC2G/TwrTBV1JopU4D3T2cDKATZ7Z4/U8t ZrKsczbwmuQF++8de90m2K2QhSZ+rPTed9exoibF7e/fKo+7lwVVx5zNMs9DdaWEn/wL jubQ== 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=2g2bmVj9SU3TVbirdM1FQyRxNd9ZH2+KEdtfAh0SdvE=; fh=RXS5JGpuDELDxQ/4dQrraI6J+NZvDTOAkF/AHQypleY=; b=hrFpDMRetu9GoF1EEdBrmRo+MfP9AsYSZubNM199YzRdiI+sq6DAoSeFjlCyrvCmDz DRVRt11fO1bYRwT1y0iYPuty4xLD4V7dVtdp9SSe9F4CjU9DkX8pOWSiIHB+buJfozxN BLtWq+wxAxUnKneZof6SRLzEv9nYMokGWyUPxd/WKgB02K79yfLRNgJH4yuPmnNn1pD6 VYCWAEjt+gC7oYlj6bVkY4B6sYzt/bf+o3Bf9+tMwUThjy/cz0eh/RasqXIn8OXvZme2 WfJ8d+XNv7elVxlDw7PuY9Y5naSJQY2+golem49pbu1J3Aj3UzJcofBcR6fqWopjJItC AoFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alatek.krakow.pl header.s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3 header.b=hNI956b+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id p3-20020a635b03000000b005c21adcc5absi295029pgb.757.2023.11.22.14.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 14:11:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=fail header.i=@alatek.krakow.pl header.s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3 header.b=hNI956b+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id C11168114EFF; Wed, 22 Nov 2023 14:11:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233574AbjKVWLZ (ORCPT + 99 others); Wed, 22 Nov 2023 17:11:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235238AbjKVWLV (ORCPT ); Wed, 22 Nov 2023 17:11:21 -0500 Received: from helios.alatek.com.pl (helios.alatek.com.pl [85.14.123.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A7F8D60; Wed, 22 Nov 2023 14:11:15 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by helios.alatek.com.pl (Postfix) with ESMTP id 33FF92D00B64; Wed, 22 Nov 2023 23:11:13 +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 lZtZOJ0CpnMK; Wed, 22 Nov 2023 23:11:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by helios.alatek.com.pl (Postfix) with ESMTP id DA8372D00B62; Wed, 22 Nov 2023 23:11:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.10.3 helios.alatek.com.pl DA8372D00B62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alatek.krakow.pl; s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3; t=1700691072; bh=2g2bmVj9SU3TVbirdM1FQyRxNd9ZH2+KEdtfAh0SdvE=; h=From:To:Date:Message-Id:MIME-Version; b=hNI956b+XzSkkYw/4p2g3NaXQ4e+U/EUUMMsoB+G11hxr+oboFsusaUDx1HKfxl48 SDhFOuAzPXXhVSjsqaTQDY0NQcgvPtQNBZZFxzcBvqgLWjh0nX+Efa5L4j30b7Oo97 zuymZw3vcVM+j+wFomhfPRvv10ZkKRIZeamhLoH4MUAGBnWNUtqHm3qUbX7XMo2hy0 wSfp63o9zVSVdsEWJFkLlZdXxs19wr/h85yZUFT/q9YuuoRgBIpd8Xtj2ZEclVk376 UB9Viy7/G7xCICepLkEVcSVGZS9L5zaZP5rTvVqQuCxj24QartfynnuRvS9jGyoXKY /esb985kjZKKw== 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 5SsUR_9Zgj94; Wed, 22 Nov 2023 23:11:12 +0100 (CET) Received: from ideapad.. (unknown [10.0.2.2]) by helios.alatek.com.pl (Postfix) with ESMTPSA id 966852D00B60; Wed, 22 Nov 2023 23:11:12 +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 Cc: Jan Kuliga Subject: [PATCH 4/5] dmaengine: xilinx: xdma: Rework xdma_channel_isr() Date: Wed, 22 Nov 2023 23:09:20 +0100 Message-Id: <20231122220921.117428-5-jankul@alatek.krakow.pl> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231122220830.117403-1-jankul@alatek.krakow.pl> References: <20231122220830.117403-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 fry.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 (fry.vger.email [0.0.0.0]); Wed, 22 Nov 2023 14:11:36 -0800 (PST) The xdma's channel status register may be read and cleared simultaneously, by accessing it via separate XDMA_CHAN_STATUS_RC register. Therefore, it is possible to simplify the code by just getting rid of a separate redundant write. Also, implement the actual status register checking as well. Previously, the cyclic callback would be scheduled regardless of the status register state. Fix it. Signed-off-by: Jan Kuliga --- drivers/dma/xilinx/xdma-regs.h | 2 ++ drivers/dma/xilinx/xdma.c | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/dma/xilinx/xdma-regs.h b/drivers/dma/xilinx/xdma-reg= s.h index 654c5e41112d..6bf7ae84e452 100644 --- a/drivers/dma/xilinx/xdma-regs.h +++ b/drivers/dma/xilinx/xdma-regs.h @@ -116,6 +116,8 @@ struct xdma_hw_desc { CHAN_CTRL_IE_WRITE_ERROR | \ CHAN_CTRL_IE_DESC_ERROR) =20 +#define XDMA_CHAN_STATUS_MASK CHAN_CTRL_START + /* bits of the channel interrupt enable mask */ #define CHAN_IM_DESC_ERROR BIT(19) #define CHAN_IM_READ_ERROR BIT(9) diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index 58539a093de2..dc7f43f17103 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -809,15 +809,16 @@ static irqreturn_t xdma_channel_isr(int irq, void *= dev_id) =20 desc->completed_desc_num +=3D complete_desc_num; =20 - if (desc->cyclic) { - 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); + /* clear-on-read the status register */ + ret =3D regmap_read(xdev->rmap, xchan->base + XDMA_CHAN_STATUS_RC, + &st); + if (ret) + goto out; =20 - vchan_cyclic_callback(vd); + if (desc->cyclic) { + st &=3D XDMA_CHAN_STATUS_MASK; + if (st & CHAN_CTRL_IE_DESC_COMPLETED) + vchan_cyclic_callback(vd); goto out; } =20 --=20 2.34.1