Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3869949rwe; Mon, 29 Aug 2022 23:25:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR6sZyihAqWcip7WVeLgzsYE6p5c8BpYskbW9FGZOhptYr7NF5Ca3VttgbHiI2B7gmRX5f4A X-Received: by 2002:a17:907:6295:b0:703:92b8:e113 with SMTP id nd21-20020a170907629500b0070392b8e113mr16293020ejc.594.1661840721914; Mon, 29 Aug 2022 23:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661840721; cv=none; d=google.com; s=arc-20160816; b=b7fKi/KshyursGQ2oi0ir86TmXWB1KQbWX+n/f3y3le8CLXPunl6r9rtLM0ZZvHoba Wegxdb4O8HHvAE+vf2vhIdpQgquE3jcgoyRFnNTt3JVX4C4U8+OTZMsMggvcGll1MM0L Rem0ugpSDhB3iWPvzn+UMVbiuIfpnVEGyNqqMKJlPAGmzG97OSHa+2g/s4EEG3JC5W/P XDw44LSS/91fn1zdAmeupuI/LR3aK6eScNnq7D1LNsOvlg7VFg1UpBDi3c/19zFsy+wX Osyhag59c7zE1ymoDhvuwnlVnznMu1K9GCF/LDuKPJHZK4YViTEbLdl7jLQeAWcCXa71 FXjQ== 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=taxRL8QtTdH3DDuG4/HIScS7z1nTORITstUtG0LQysC9a60Tda4SJ0WI7zr/L0HcTo 4R3AzDVBGxKksnejtuwynyqs4PIRh5+mPwd7efCrHSm+vQ3INJnQPDKZWM24lKC/6phZ kyu9fQirXnkxaqfbzxDZdR4rT8/XFYr9Gt7Oox7szie6nplLENEPcsYhbjQkfuQgOfaM YuxCvw7kfUmohGBKPr3jIde7QXXqwtzkPdz2UWqDcuLvPXtBRY0iCNiWymWuowy4oeI7 73dkjzSHyN90GgBo91FulvkVwRboFKsx6bxUWhAPy/HJgVl3SaAaUP4fF6WhHgUGKGzD M/3A== 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 eh13-20020a0564020f8d00b004472b35d7a5si6977017edb.309.2022.08.29.23.24.56; Mon, 29 Aug 2022 23:25:21 -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 S230046AbiH3GIw (ORCPT + 99 others); Tue, 30 Aug 2022 02:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbiH3GIu (ORCPT ); Tue, 30 Aug 2022 02:08:50 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 588B0B69FB; Mon, 29 Aug 2022 23:08:49 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MGxfD5FnYzHnVV; Tue, 30 Aug 2022 14:07:00 +0800 (CST) Received: from kwepemm600007.china.huawei.com (7.193.23.208) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 30 Aug 2022 14:08:46 +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, 30 Aug 2022 14:08:46 +0800 From: Jie Hai To: , CC: , Subject: [RESENT PATCH v5 2/7] dmaengine: hisilicon: Fix CQ head update Date: Tue, 30 Aug 2022 14:05:50 +0800 Message-ID: <20220830060555.50781-3-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220830060555.50781-1-haijie1@huawei.com> References: <20220830060555.50781-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: dggems706-chm.china.huawei.com (10.3.19.183) 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,T_SCC_BODY_TEXT_LINE 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