From patchwork Sat Oct 22 07:24:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7581 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106298wrr; Sat, 22 Oct 2022 01:37:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5expE9aKinEHzILPZL30p19ZX1r9pxtm8noH+ZCA5Br7Gae97c3BjJhYhvjSH3xekPMDDy X-Received: by 2002:a05:6402:1808:b0:461:52dd:499c with SMTP id g8-20020a056402180800b0046152dd499cmr5895111edy.120.1666427847135; Sat, 22 Oct 2022 01:37:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427847; cv=none; d=google.com; s=arc-20160816; b=M4jv6ZGN1Mt6QY8l79peRqH9vnMZeTdrAvrqGpZfUMjtEYDFqVMFKGBWv/N6zY2j8d +IxzBG1r18SgEfSYthEqSQt59wBtPv72SayzQLMRyjFpbUOcoGnZMcKbcnHZf+28nv18 W9h4TvexOLDO3zYZiU8fxYJDhx7xceQ0a9acJ8qSGXKdwAolgfn7tUsgVwmjJzU6yO3W JqnuoOYsEiimGNRaa542XweCAzc/pjoC1zh0iIX0N7wul1uXZ1xrIWD+eIaSu4mb6+eB I4g8kgDmtst4JVOPmyBNQvp3wOgAu6dniJYLnfSMc7jf9G+XMauF3DAZDY2SZ7UrfrUb xceA== 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=DNPMDxDPD2lYiT8qMnosRbZhEcz8fSp7m4z5gW6kwQs=; b=BIzLfZvKj7R2VrAyM6grYNit07rkrf9fxnBKnEcr8zYiLSOZCANSgWN5SDLuYNAbeo b/s2WCs0O4QKn7/oGEDkOxa8FWy9VAJkuB6LuKFhW4ATMWVRO9fAb397eRwtxmdH8270 hdbHo+RlHoPl/DGfA+HT4RIsLH7XMp2ANAsH3Vi9310w+5u/iLTnfsJQFgV+ixVdPtx/ 58pFkCqFdyl6LcTozbaU/C2d72lvOy+Za0jrCXSoIrUOa+E/3Yx+0VGPZ8k1axyj6DE2 HmGBT+4ZKNnNM8x2BBf4fz8wqlb09tIr5PYyro1YOHVh30teq9piRAkcWt1n81Zqet0A WHTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DeZbex+v; 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 l24-20020a056402231800b0045909f3bb10si18882770eda.283.2022.10.22.01.36.58; Sat, 22 Oct 2022 01:37: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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DeZbex+v; 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 S234039AbiJVIch (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234038AbiJVI3R (ORCPT ); Sat, 22 Oct 2022 04:29:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9025F2E32C6; Sat, 22 Oct 2022 01:01:50 -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 ams.source.kernel.org (Postfix) with ESMTPS id C578EB80E44; Sat, 22 Oct 2022 07:52:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B81CC433C1; Sat, 22 Oct 2022 07:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425172; bh=+vbNUCQv8UUCMwCDsqLsnnb70lWBjwdQNQ0Y+msAdpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DeZbex+vFRtidyJQLiM6SJF3yyIWZD+HnKVRQO8bVtdaCPHooi6mumalweH1ddmM+ hsz9ro9PIzNnmaTbExqJsXLkaQR5aPTy2bm5tPTjOkwo79byo5puxWzUuwqUdDwMhP MzYaKOrgOH1AWLnUN2/zRA9jJe265uSlWSFfWZEw= 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.19 414/717] dmaengine: hisilicon: Fix CQ head update Date: Sat, 22 Oct 2022 09:24:53 +0200 Message-Id: <20221022072516.474402112@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376245866005379?= X-GMAIL-MSGID: =?utf-8?q?1747376245866005379?= 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 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");