Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1437834rwb; Fri, 5 Aug 2022 01:45:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR4S7AU0LSNWuktxudas6RtmXn7Gm+KiE8XyNr4s/z8lKS54bM4AAVXbCWMkD5LapOPmAplv X-Received: by 2002:a05:6a00:1948:b0:525:45e3:2eb7 with SMTP id s8-20020a056a00194800b0052545e32eb7mr6011204pfk.77.1659689102478; Fri, 05 Aug 2022 01:45:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659689102; cv=none; d=google.com; s=arc-20160816; b=NrZr3F/5IzjY9jofwvgdgAtwXhrhEkUK1u2R5+zdLyKcBr/zCAqHXZP4QSO+OKk3qn s9pw2xb/XywHn9fAK87PaB9vouS2lDpeOVXuDIFkp78Ygzj85LRrFMkTSmmNkkn4aXTh 3dGqD+PGFe/uGGZW26z2LEmkqAjcgJwvHgsZBGjUJMkhp+Nf2Tq+JxGhbvqW+KgYsVoz UwE58evRSscuAybFBimF1IiYYu5QVq/l5grYSOA1sx2cPIy5CMR4jGCs0BRJG4jo/eC4 OGRvDOlRO7kp5t8/7FkNwfqmPG7Qlmrv1kik/bHmpxkYIflkrw3YY6q5BBwpXjGZmIsr VN7w== 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; bh=B+X9jVXi7r7azJi2jW2FwUQHG7bXHinLl6Tizxq7Yc8=; b=RK7Rj6BKGomIGOQmKq70HSRbTR41zeR26cOTXYd+fFSjqDVFSIoC7mKEKGAORzHsA/ PgVUSOJAjDHfKGuEbnf/BBoJjfROPBKds789Z6+4xyqVAOCDn1F+4/RQYAJBaSfChsdx 6wTu+okOK5CoKcsAyLYA73nccjl32rPqCe0byoS+bfYV8upvEXdkZ6/N7eBE+q+ab7q2 Dg4SNOe636P29loAkamQbM8AU8cwLNiNXah6ECrfPsEZedZcK1OeNJbkN9TOXDVjDBpS 20g8nC1HsHnUxTWHbC7Paxg3Ai5UkRMZL1IrRqU0/xuUA+H99FlYXGslBreDHbYogNEf 0aYg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n13-20020a170902d2cd00b001637dbe1bc4si3983196plc.44.2022.08.05.01.44.47; Fri, 05 Aug 2022 01:45:02 -0700 (PDT) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240503AbiHEIey (ORCPT + 99 others); Fri, 5 Aug 2022 04:34:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237309AbiHEIes (ORCPT ); Fri, 5 Aug 2022 04:34:48 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8607318345; Fri, 5 Aug 2022 01:34:47 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Lzf2g6578zjXgW; Fri, 5 Aug 2022 16:31:39 +0800 (CST) Received: from kwepemm600007.china.huawei.com (7.193.23.208) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 5 Aug 2022 16:34:42 +0800 Received: from localhost.localdomain (10.69.192.56) by kwepemm600007.china.huawei.com (7.193.23.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 5 Aug 2022 16:34:41 +0800 From: Jie Hai To: , CC: , , , Subject: [PATCH v5 2/7] dmaengine: hisilicon: Fix CQ head update Date: Fri, 5 Aug 2022 16:25:31 +0800 Message-ID: <20220805082536.41145-3-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220805082536.41145-1-haijie1@huawei.com> References: <20220625074422.3479591-1-haijie1@huawei.com> <20220805082536.41145-1-haijie1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600007.china.huawei.com (7.193.23.208) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 After completion of data transfer of one or multiple descriptors, the completion status and the current head pointer to submission queue are written into the CQ and interrupt can be generated to inform the software. In interrupt process CQ is read and cq_head is updated. hisi_dma_irq updates cq_head only when the completion status is success. When an abnormal interrupt reports, cq_head will not update which will cause subsequent interrupt processes read the error CQ and never report the correct status. This patch updates cq_head whenever CQ is accessed. Fixes: e9f08b65250d ("dmaengine: hisilicon: Add Kunpeng DMA engine support") Signed-off-by: Jie Hai Acked-by: Zhou Wang --- drivers/dma/hisi_dma.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 98bc488893cc..837f7e4adfa6 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -436,12 +436,10 @@ static irqreturn_t hisi_dma_irq(int irq, void *data) desc = chan->desc; cqe = chan->cq + chan->cq_head; if (desc) { + chan->cq_head = (chan->cq_head + 1) % hdma_dev->chan_depth; + hisi_dma_chan_write(hdma_dev->base, HISI_DMA_CQ_HEAD_PTR, + chan->qp_num, chan->cq_head); if (FIELD_GET(STATUS_MASK, cqe->w0) == STATUS_SUCC) { - chan->cq_head = (chan->cq_head + 1) % - hdma_dev->chan_depth; - hisi_dma_chan_write(hdma_dev->base, - HISI_DMA_CQ_HEAD_PTR, chan->qp_num, - chan->cq_head); vchan_cookie_complete(&desc->vd); } else { dev_err(&hdma_dev->pdev->dev, "task error!\n"); -- 2.33.0