From patchwork Mon Oct 24 11:30:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9106 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456084wru; Mon, 24 Oct 2022 06:33:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4wdxQ2/k8jk8eTnx6W8D3tduZDZMrFAAINrMf/fuq1QihNj3/Sd6wCckpZHnyw7kLHJePh X-Received: by 2002:a17:903:22d2:b0:17f:7dea:985f with SMTP id y18-20020a17090322d200b0017f7dea985fmr34041798plg.68.1666618412988; Mon, 24 Oct 2022 06:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618412; cv=none; d=google.com; s=arc-20160816; b=IfDf0P5XK5jNxjzmc0Sh0kWkkKFOd4hc4nBH8DOb84cjTqyQbTJItAFSSZib8h6Vjt NbApHEdv9M4ILTOL7vKaMyJFAXTaVlJ9aeL3yyW35aFNIGF7xJKfwGdu0jnxvfgyvY29 6bVDcCXjLrXtK4SORiYjQRyX0VaIn/J77fdL5ViO5GqWxkf0HLi4JJ53W/S++Lp+9OJI Dpwkd2alNG+w48m98BL6I6tFQG5VCQvkCT6rK2Cna7DeeBEE6ijXKRjWXKcpcCw2TB/w bvzsCC6RPX+cTasPESTHSPmfm+r/8FNd4xRNHa4fn0DTag2vuo7LdbC1UMx6T2Czz+r/ xSDw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gveL5q9IlirADLFWkjcu3iT+6EVxSAAZ64tnHl/BpbI=; b=te+e5tiEX+tZ4BFMW6Tj53KFdoQfcq5J5jccR2IFlasuZ/i8snQ5bYJ8cTlSwGRvuh i7y1WkX+dzqp3yYB1C6RH0PTjXgT6ECG5xpdUCZP5oWtD7PkWJ3KIaHTI0LdUmhSJf/I 0/zbbyQYmTCbUS69sG8xWo52UaUGfsCZrOjzxNGgTpuUZaZubAeejk/R47GyaEESxsnP Wqef1WAzzlMkW5ISb3vHdpKMlXqVHeiicmBCcfUiFYd8+AhxuTjzGY00LCLy6m3S1oe3 svL6RWvlPi3fSqCzGCiAyt3Rz4rW3ptXqLfbw9eLoXHAVd7HyNEyCiq+vzZpNlRIF3pY 5sUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hiwHv4pU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020aa78d85000000b0056be3109462si2607871pfr.163.2022.10.24.06.33.19; Mon, 24 Oct 2022 06:33:32 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hiwHv4pU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233366AbiJXNQy (ORCPT + 99 others); Mon, 24 Oct 2022 09:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235682AbiJXNPH (ORCPT ); Mon, 24 Oct 2022 09:15:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75836A3AA1; Mon, 24 Oct 2022 05:25:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CE8B9612E9; Mon, 24 Oct 2022 12:25:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2EE1C433D6; Mon, 24 Oct 2022 12:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614321; bh=WCxNMtFl2Q+Rc1wx6uCV54UdQ6DKM+t655IJa/Q5eO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hiwHv4pUKmh8KbjVRtB+Y8wyY5RE1bChvIyLvGfxbjP9BPxJONN7aclNVjrcNYT5Y TQ5aseKPhXy40h2aAz1/U9k3sSSElJ1xBvwReUmQVC24AcXf7aWtdJJ5fpBUDR7uFc zGcJv0dygOcU2dEdNVfSSMvWcdK5UPfi42LwE0T8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Hai , Zhou Wang , Vinod Koul , Sasha Levin Subject: [PATCH 5.10 215/390] dmaengine: hisilicon: Fix CQ head update Date: Mon, 24 Oct 2022 13:30:12 +0200 Message-Id: <20221024113031.946374675@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576068609541970?= X-GMAIL-MSGID: =?utf-8?q?1747576068609541970?= From: Jie Hai [ Upstream commit 94477a79cf80e8ab55b68f14bc579a12ddea1e0b ] 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 Link: https://lore.kernel.org/r/20220830062251.52993-3-haijie1@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- 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 7cedf91e86a9..08ec90dd4c46 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -442,12 +442,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");