From patchwork Wed Oct 19 08:29:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp214850wrs; Wed, 19 Oct 2022 02:13:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4loBnrELw2yLJKlgRMci6thMp73g93AONuhAJI9322Th9SI42HlEeFyBOQwqNxAGxOKUyq X-Received: by 2002:a05:6402:1b08:b0:458:d229:bcac with SMTP id by8-20020a0564021b0800b00458d229bcacmr6340108edb.118.1666170837097; Wed, 19 Oct 2022 02:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170837; cv=none; d=google.com; s=arc-20160816; b=UxhifnTsqN0sglZvUAl4VybUzqVzGY4x0JHNogYu1VpNjmGI8B+oRPLOsoIQ+wZpKO sky6xSS8B5SYCaR3CXQeF061Hkd2nyhIieas32lWFoX+0Ja9DhBTRWrdN2kVlxyLde3r AjYPjpaYujreATA4NEcdxpvtszZQhtI2Ek7y86JMrd9pUzMD4tY4LHw1aBhh0ljlCHnJ VPNFUr44njTNb/dnNI2+zrYQIK5o1jwQ9AzoUjSCGJG6AmYsQsSKLg0PBAsHYIJopv8P lqG9ki6Vu+iAIpFVM/6rrkp48hX2nwXAi04mp7R09jKvbbQLIb1qwYoxjcpSdJ0w9Qs/ GLhw== 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=RuMTL1hV1IkkXcvUnG7DbLoAn7MZHEoCv0lAKqkjK2Na14K2bV6B416AerpjzZBl/d 2cMpgt2cp13Rva+D9ZHambUPfIVeadtle5N6rkN3JNpqWsr+Yp7pNy+ElDhWDhIuveoI nO3yxqtb3bxgNvnRtU/+FxXhcQoeh0TjX0Pz6EDJ974q250J5wDjlPy44Q1/LQFBXTcN SfjZfCfKNDQxxl0If/hbEtU/fMlNTKuQ0RzvXNcwrOW7RcR8ax88QaB3LAxqOdmk45BI QXREtbCxGu52bBQKhOynpdQO0FFI1CIbkRqTb39NqvKjuaFXbKJqsa5eBHxG2hlK64Al RKHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zb8GnXL1; 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 hk6-20020a170906c9c600b0077497671e2asi13561310ejb.406.2022.10.19.02.13.32; Wed, 19 Oct 2022 02:13:57 -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=zb8GnXL1; 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 S232941AbiJSJMg (ORCPT + 99 others); Wed, 19 Oct 2022 05:12:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232984AbiJSJJv (ORCPT ); Wed, 19 Oct 2022 05:09:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A0979F362; Wed, 19 Oct 2022 02:00:54 -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 37E6161800; Wed, 19 Oct 2022 09:00:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48AA1C433C1; Wed, 19 Oct 2022 09:00:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170053; bh=+vbNUCQv8UUCMwCDsqLsnnb70lWBjwdQNQ0Y+msAdpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zb8GnXL1b8j3+3WvQprX8M8FBws05KrrMigCJmVVTpElmFYyWw7eLy+zS3PVKX6fn hukBDEEA8TaQv73/bvRCK/0NSnBsTc7u/ao/q/mBJ70wf+eL2GQ56xnKiIiH0G8pa1 pyuAyDGMcvtMVMaIuhE37pN6tFPl6VFYhRsIFw5w= 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 6.0 509/862] dmaengine: hisilicon: Fix CQ head update Date: Wed, 19 Oct 2022 10:29:56 +0200 Message-Id: <20221019083312.477351647@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747106751773841667?= X-GMAIL-MSGID: =?utf-8?q?1747106751773841667?= 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");