Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp351143imn; Mon, 25 Jul 2022 19:01:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vI/QBzRJxNw/4ixkRB0z7lQpcx6nTBCPst+drzcO8wE4s1MoNMOuGL0UwzIf0D18X+hoLT X-Received: by 2002:a17:902:e848:b0:16d:8426:1cc8 with SMTP id t8-20020a170902e84800b0016d84261cc8mr5296336plg.119.1658800870455; Mon, 25 Jul 2022 19:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658800870; cv=none; d=google.com; s=arc-20160816; b=040X+UMSBo2QsoJ5LFwWNxJ94ZAZltKYKyBdz9ZxVAv59zQPO8Uf7df5DMubWExmQM lZK8UiBCoLuto5/PoVKelsRZLzFRyg3d4fdLqkYmw1xC0/RShcS5f6OqXeCOokn1CuP0 f29aLVy39dvI09UsQls2nMvhg4iZCrJd4UkV/6WrHk+WIpLbUu7GJE3TFznM3sDmnlXS vWH6OsllpOY9JB6vYoP3bburCY6YMWKBI04gXTGZiWjLgwnPvIbIkCo5WCh6/HfXHNaC wzCRfvzyj/Rkm38RUvHpeLDJ6ePSsYvAcbeBwNxwL8VzuKpSbrlcn3TwEkxr1f2ECKRw ZPPg== 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=OTUXw2LEf0/9iNMGn5mTkeYpCWzHZCrV08sYd4uU5CU=; b=HKYB6Cpv9HbuY0QEDglzBStLt76plsulIUnjJGF4rQV+BLSIIxjnxNy7Vr1eYOIf0P 8Z1DwX51Gdq2C3PGNjc1xnV2XlTh3sQAA8JI42TEYL7PfcoXbBFTbdCXKq2LIrF74OqL 3kA+2E7c4hLlJ9SMy7069IlYOOBzc4cNb7nGZQChMp96TVMJOqFMnAVb/mt36ENC8QCw AIA1WF6U4DODpJ89uA+Q0QEw9+KX34ZoYw3dFWdHAGVTYd8fCoT2E+iZIR2RNiiNWJkg sWiWY/OuLb7+R5iImynCHB6WZg0khF45Zm2j6WbA3c76jNLsy0oEzP0NgLzNAkwcyoA4 yXpQ== 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 u22-20020a056a00159600b0052b18a7d185si15836460pfk.263.2022.07.25.19.00.54; Mon, 25 Jul 2022 19:01:10 -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 S237014AbiGZBiC (ORCPT + 99 others); Mon, 25 Jul 2022 21:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236740AbiGZBiA (ORCPT ); Mon, 25 Jul 2022 21:38:00 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F2152871F; Mon, 25 Jul 2022 18:37:59 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LsKFS5RfrzWf6m; Tue, 26 Jul 2022 09:34:04 +0800 (CST) Received: from kwepemm600007.china.huawei.com (7.193.23.208) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 26 Jul 2022 09:37:57 +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; Tue, 26 Jul 2022 09:37:56 +0800 From: Jie Hai To: , CC: , , , Subject: [PATCH v3 2/7] dmaengine: hisilicon: Fix CQ head update Date: Tue, 26 Jul 2022 09:35:20 +0800 Message-ID: <20220726013525.13059-3-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220726013525.13059-1-haijie1@huawei.com> References: <20220625074422.3479591-1-haijie1@huawei.com> <20220726013525.13059-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: dggems705-chm.china.huawei.com (10.3.19.182) 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 --- 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