From patchwork Mon Oct 24 11:30:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9408 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp478514wru; Mon, 24 Oct 2022 07:17:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Oz5ljPXyuyfQZHzc4VzHk4nuyZGVihvUT+ygKuBAz5r/oX+8N7npX5LShdBC7J0QFD3TN X-Received: by 2002:a17:907:3f19:b0:7a3:2317:4221 with SMTP id hq25-20020a1709073f1900b007a323174221mr8252553ejc.562.1666621047301; Mon, 24 Oct 2022 07:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621047; cv=none; d=google.com; s=arc-20160816; b=YEbJYK2y8h9dSRXFFrZ7501mnHbVmFoV0cdAoYDJYxbhzQj/ZJbCQEC7R7ivOsVacm 7r1/jPTVj83+hAltqCceVlRpONuY1CoALh+rZQWoD0r2tEvtosg8G6CFAb5euYDF/GBN jzVHYxIc/NI0lB2l82/UD0WjR0t+IwA2gGKEs6qJPxFJSHo59k8WR2sC0sv5rq95ivRu RRhkEUh7Gixh3EywmiOf3myrq1iCkfikziCtTzr81KxLFS0Sh5z3J/MZmvDmPe+clPTL ygKDUsQtdg0KxYAUKP9R/or8ed/9GPAkM1NcorLbJlvIFdlk6nKJMLzcs3YZee0T4a9s mkRg== 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=WiCID7PYGzInUJDni+TJSRvHaec7mbZ541bj3Whpuq4=; b=EwL9Fsx7K0biVi/vei6+W34REUJSsrSHwsqUsbVbkxFnx/PxKViF01RtS0v6D06ulx NV5/JBmXn82n7vWxakpI4DyATC5kbW8bkpiFNfjOckNimaguxQUBMxPip8Vb1Y9+j61V /zMfDRXLeSHe52udyQaBTAfQBT48r2pkQsL6tfANoqUHIPsocv9aIw5oQzcc7CLYjwSK qq3vAycoUpkvmF+WfGW+M5TZWhRd1qGV6I6pmpuV0eoSkdopLT4pv6kQ2rI4fT8cRIH3 ntm8G1M000gxYyLLT3f9VCim6571LtxL8Rjwj+oPFYefJAnHNuH4EazPfKGGy/VaqG1I fOSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Qis/FL/e"; 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 hg7-20020a1709072cc700b0079e1916c11asi7788973ejc.703.2022.10.24.07.17.01; Mon, 24 Oct 2022 07:17: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="Qis/FL/e"; 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 S232087AbiJXOFp (ORCPT + 99 others); Mon, 24 Oct 2022 10:05:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233506AbiJXOCe (ORCPT ); Mon, 24 Oct 2022 10:02:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F41E0BEF88; Mon, 24 Oct 2022 05:48:15 -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 75929612FC; Mon, 24 Oct 2022 12:47:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87B96C433C1; Mon, 24 Oct 2022 12:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615625; bh=VnMGrswUD1VUWwq/IDbfRvOf4uZCiO6hHd8wQ9skVW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qis/FL/ejF4WFkV4Zk9Y+lXZulK8Kjf4ofbSRv3JlzzicCBtI7CkbsmBJS/4rsz0b s2Qk8lpf6QpJSiu2EkVDbdO3CzX6muJIKmktXrcVAvZzcCNjDiQd21F1+0snazsw6N CPN66NO+BMbaWP6DVWsdgehTj1Lgfs8L+CIQifXY= 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.15 295/530] dmaengine: hisilicon: Fix CQ head update Date: Mon, 24 Oct 2022 13:30:39 +0200 Message-Id: <20221024113058.417176174@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@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?1747578830974180569?= X-GMAIL-MSGID: =?utf-8?q?1747578830974180569?= 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 70a0d784a6a3..9e6ce3731ca5 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");