Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp214948iog; Tue, 28 Jun 2022 21:02:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sifk+Y0jwTW8EIzxuibxJT3p/6Z4vI3//HIn0h/eXTRyHi9f9a8B9+4C2tfwB6vhMMA1a4 X-Received: by 2002:a17:903:283:b0:16a:6db9:3f02 with SMTP id j3-20020a170903028300b0016a6db93f02mr8214163plr.173.1656475347952; Tue, 28 Jun 2022 21:02:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656475347; cv=none; d=google.com; s=arc-20160816; b=egmDm0D8cEnC/UrRDPlmcn4Znh4cQ36Nvz80s6TZl0z1EyLiIDC6NO4bmJ/781i/Mn 2Og2d5QoKOy+Z6KvxBO32k0NATekJ2J+0ni633/B5Qb9Eb5RXrSzxoJ14aFzeYPGlCM4 WcepIU5396uDb7SFzmNQiSQmCdraZHhzRZLtIZcqubj+z0yFL7+pqR8AOt16ofhKAwju fYbUw17svKxqEd1i02XsGoH3646a8eWzTRrQJUzWjtW/gu6vV/c0jR+zpz19rrWsgDZv ZVNCwfRG/13oZEcaiAEm/zxG+9pf6kA0ZWPC8k64UnNf+5JjR8ovXEHH8kuWshKofByR CuLQ== 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=vn1OS5E64zPzeufy3lFHcI36DOgfkYy13dNUWT2zHEI=; b=hS8t0XUVWUS27oKv4JPaW8ZfQc1U/+4nZVD+Qs4UjEyRSUA5cWLMtNa+dmB44Cl125 KSM5/Nuuf7nEcBjV0gtaFe+HQAbbUzFRSQ4tb+KAypijOTOWGzUN6t/HP0hTiNYXuNqy nLTKEumKj23U76RisgEYqfBm//6zHH+IuP+1ZzoCIXKHZ4wyPCln6U1yt4NujjG3S7CY hNehMG4SZieYZ/v2/X3RQquxKzmn9GIX7UCgQgw/M4HBUWuVlTx74UIFEXoVTh9G7HrO 3P0RJ09THk0nd5AL7sE3oUyIuUve/jVpkGjN3hRv8lnz90PsOtd5wJeM0Yf4BJIwULR9 tiAg== 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 o126-20020a62cd84000000b005252ffbda2esi19638468pfg.36.2022.06.28.21.02.15; Tue, 28 Jun 2022 21:02:27 -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 S231694AbiF2D7A (ORCPT + 99 others); Tue, 28 Jun 2022 23:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230489AbiF2D62 (ORCPT ); Tue, 28 Jun 2022 23:58:28 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF1271FCE8; Tue, 28 Jun 2022 20:58:25 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LXnhK0DMrzkWfc; Wed, 29 Jun 2022 11:56:33 +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; Wed, 29 Jun 2022 11:58:20 +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; Wed, 29 Jun 2022 11:58:20 +0800 From: Jie Hai To: , CC: , Subject: [PATCH v2 2/7] dmaengine: hisilicon: Fix CQ head update Date: Wed, 29 Jun 2022 11:55:44 +0800 Message-ID: <20220629035549.44181-3-haijie1@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220629035549.44181-1-haijie1@huawei.com> References: <20220625074422.3479591-1-haijie1@huawei.com> <20220629035549.44181-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,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") Reported-by: kernel test robot Signed-off-by: Jie Hai --- drivers/dma/hisi_dma.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 98bc488893cc..7609e6e7eb37 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -436,12 +436,12 @@ 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