From patchwork Mon Oct 25 07:54:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12580903 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 712EFC433EF for ; Mon, 25 Oct 2021 07:55:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 515C660F92 for ; Mon, 25 Oct 2021 07:55:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbhJYH53 (ORCPT ); Mon, 25 Oct 2021 03:57:29 -0400 Received: from www381.your-server.de ([78.46.137.84]:60304 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230208AbhJYH53 (ORCPT ); Mon, 25 Oct 2021 03:57:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=u1OewFAutiuId7aMDyslvsL/AcE/PBcZ1CnWQYFZRso=; b=SBaLcr+4HRDmee7RQb9ZNwIHge pCt12qmZK3c3ObQMd4e4qIPKIVeujyaK/WfURdWM80Tinq+OF47XA3eqbGT3KP2aRqyxyBh+CCOZv znaRcfSVuYtVne0ngDMX0a+AN9OoUlbuY3X9cLIFZweC9HVapGMwOTfweB2iEDYg0wCZ0kd9XkPIy b5OoNwHan2O8LjXfmOaM8MKRgRE8zHUd7U8tVXeHvfVXsIJ/MTWI2dJ7nutOwI8I2N1q3f7SoHzY4 DRcBxVA+LrEo725SGu+VJMkoAnmGPiIa0V8H6rrq7K9Pbzmlp7O2TsKfjUmhNeWUGdzHzWjpJ925B L+jWvICQ==; Received: from sslproxy02.your-server.de ([78.47.166.47]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1meuoz-000AAW-Ss; Mon, 25 Oct 2021 09:55:05 +0200 Received: from [82.135.83.71] (helo=lars-desktop.fritz.box) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1meuoz-000TdK-F3; Mon, 25 Oct 2021 09:55:05 +0200 From: Lars-Peter Clausen To: Vinod Koul Cc: Stefan Roese , Michal Simek , Radhey Shyam Pandey , dmaengine@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 1/3] dmaengine: altera-msgdma: Correctly handle descriptor callbacks Date: Mon, 25 Oct 2021 09:54:26 +0200 Message-Id: <20211025075428.2094-1-lars@metafoo.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26332/Sun Oct 24 10:18:48 2021) Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org DMA clients can provide one of two types of callbacks. For this reason dmaengine drivers should not directly invoke `callback`, but always use dmaengine_desc_callback_invoke(). This makes sure that both types of callbacks are handled correctly. The altera-msgdma driver currently doesn't do this and only handles the `callback` type callback. If the client used the `callback_result` type callback it will not be called. Fix this by switching to `dmaengine_desc_callback_valid()` and `dmaengine_desc_callback_invoke()`. Signed-off-by: Lars-Peter Clausen --- drivers/dma/altera-msgdma.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c index 5a2c7573b692..f5b885d69cd3 100644 --- a/drivers/dma/altera-msgdma.c +++ b/drivers/dma/altera-msgdma.c @@ -585,16 +585,14 @@ static void msgdma_chan_desc_cleanup(struct msgdma_device *mdev) struct msgdma_sw_desc *desc, *next; list_for_each_entry_safe(desc, next, &mdev->done_list, node) { - dma_async_tx_callback callback; - void *callback_param; + struct dmaengine_desc_callback cb; list_del(&desc->node); - callback = desc->async_tx.callback; - callback_param = desc->async_tx.callback_param; - if (callback) { + dmaengine_desc_get_callback(&desc->async_tx, &cb); + if (dmaengine_desc_callback_valid(&cb)) { spin_unlock(&mdev->lock); - callback(callback_param); + dmaengine_desc_callback_invoke(&cb, NULL); spin_lock(&mdev->lock); } From patchwork Mon Oct 25 07:54:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12580905 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D572C433F5 for ; Mon, 25 Oct 2021 07:55:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1703960FD7 for ; Mon, 25 Oct 2021 07:55:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230208AbhJYH5a (ORCPT ); Mon, 25 Oct 2021 03:57:30 -0400 Received: from www381.your-server.de ([78.46.137.84]:60338 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230106AbhJYH53 (ORCPT ); Mon, 25 Oct 2021 03:57:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=GhfEhjuSPVaxEFquI3M7re6Emo6/FZ8XIlU1FWOC5sk=; b=Z4AAQSfMJL6fVXR5pWfHBtCFAx Z7LRoP5NMpjbBTemU9tZ+gsGIdP2ER5vxEjgD7cC6eGf3XIEcNDMwwsZHY3eT7oS39I+9yhgnyaJJ A0U+GIbZrgtDVUjbA9RhxHcBj8wJExGoWgcIxR+47NQJEhPSZp/g5hah+osxU3CbQmqYm8S/zxwSB I4pq4ZYdPzRSEwQC+LKudqhuNzKUHp7bzVwVWxDfcoXZRgiPsi1cP4vclJQWT6OpBgN+RN6i6F8Sg CIdTA8R5Ki1vZv/Ey82nbXL2rSbuMD/8/9i+Vrek0XQUtxAmFJ07aUy/t9S9LKUB8WcG4/o1/2IqJ FifA9gyg==; Received: from sslproxy02.your-server.de ([78.47.166.47]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1meup1-000AAn-5b; Mon, 25 Oct 2021 09:55:07 +0200 Received: from [82.135.83.71] (helo=lars-desktop.fritz.box) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1meup0-000TdK-M7; Mon, 25 Oct 2021 09:55:06 +0200 From: Lars-Peter Clausen To: Vinod Koul Cc: Stefan Roese , Michal Simek , Radhey Shyam Pandey , dmaengine@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 2/3] dmaengine: xilinx_dma: Correctly handle cyclic descriptor callbacks Date: Mon, 25 Oct 2021 09:54:27 +0200 Message-Id: <20211025075428.2094-2-lars@metafoo.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211025075428.2094-1-lars@metafoo.de> References: <20211025075428.2094-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26332/Sun Oct 24 10:18:48 2021) Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org DMA clients can provide one of two types of callbacks. For this reason dmaengine drivers should not directly invoke `callback`, but always use `dmaengine_desc_callback_invoke()`. This makes sure that both types of callbacks are handled correctly. The xilinx_dma driver currently doesn't do this for cyclic descriptors and only handles the `callback` type callback. If the client used the `callback_result` type callback it will not be called. Fix this by switching to `dmaengine_desc_callback_valid()` and `dmaengine_desc_callback_invoke()`. Signed-off-by: Lars-Peter Clausen --- drivers/dma/xilinx/xilinx_dma.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 60cea7d997ee..4677ce08ed40 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -998,14 +998,12 @@ static void xilinx_dma_chan_handle_cyclic(struct xilinx_dma_chan *chan, struct xilinx_dma_tx_descriptor *desc, unsigned long *flags) { - dma_async_tx_callback callback; - void *callback_param; + struct dmaengine_desc_callback cb; - callback = desc->async_tx.callback; - callback_param = desc->async_tx.callback_param; - if (callback) { + dmaengine_desc_get_callback(&desc->async_tx, &cb); + if (dmaengine_desc_callback_valid(&cb)) { spin_unlock_irqrestore(&chan->lock, *flags); - callback(callback_param); + dmaengine_desc_callback_invoke(&cb, NULL); spin_lock_irqsave(&chan->lock, *flags); } } From patchwork Mon Oct 25 07:54:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12580907 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E141C433FE for ; Mon, 25 Oct 2021 07:55:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3FEA861039 for ; Mon, 25 Oct 2021 07:55:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230106AbhJYH5a (ORCPT ); Mon, 25 Oct 2021 03:57:30 -0400 Received: from www381.your-server.de ([78.46.137.84]:60352 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbhJYH5a (ORCPT ); Mon, 25 Oct 2021 03:57:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=7m8Y+ZYuMiBlsCVYLHf1KYkymvw2bBRXh6KjWHXt4Ro=; b=F0eBgwkIoI401V+/Wfd3ft10Dn Knyv6QT7ZewWc6I+8+GzKLpIcqquWI8VB4Sj+UFFiIvX4E7DbZgas4Z/hqQXV3rP3y7NdCWU/1fsU RIuxQJd6p03myY5ex7picT84+eDT1dStnAA6jqLN4KC6RVjd5/Jeg6bRtj/MwOg76zI6WFy4MZ2qZ LAWwGPG+PTKqKCsTmn7k4eRk1mxWM1mvJk9VxJu+CoNqYBF06EiIHSzxRklnDOulqyBm4WHENb4XG fW7ii655809bdOgUSCbG34m1yDVKqrxIChBF+9iznOe8r765Mrda1UZ1p1taOCjIFLt80DxE8IR6z 9eNdrhBQ==; Received: from sslproxy02.your-server.de ([78.47.166.47]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1meup1-000AAo-BL; Mon, 25 Oct 2021 09:55:07 +0200 Received: from [82.135.83.71] (helo=lars-desktop.fritz.box) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1meup0-000TdK-OO; Mon, 25 Oct 2021 09:55:06 +0200 From: Lars-Peter Clausen To: Vinod Koul Cc: Stefan Roese , Michal Simek , Radhey Shyam Pandey , dmaengine@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 3/3] dmaengine: zynqmp_dma: Correctly handle descriptor callbacks Date: Mon, 25 Oct 2021 09:54:28 +0200 Message-Id: <20211025075428.2094-3-lars@metafoo.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211025075428.2094-1-lars@metafoo.de> References: <20211025075428.2094-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26332/Sun Oct 24 10:18:48 2021) Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org DMA clients can provide one of two types of callbacks. For this reason dmaengine drivers should not directly invoke `callback`, but always use `dmaengine_desc_callback_invoke()`. This makes sure that both types of callbacks are handled correctly. The zynqmp_dma driver currently doesn't do this and only handles the `callback` type callback. If the client used the `callback_result` type callback it will not be called. Fix this by switching to `dmaengine_desc_callback_valid()` and `dmaengine_desc_callback_invoke()`. Signed-off-by: Lars-Peter Clausen --- drivers/dma/xilinx/zynqmp_dma.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c index 54adac6391ef..7aa63b652027 100644 --- a/drivers/dma/xilinx/zynqmp_dma.c +++ b/drivers/dma/xilinx/zynqmp_dma.c @@ -605,14 +605,12 @@ static void zynqmp_dma_chan_desc_cleanup(struct zynqmp_dma_chan *chan) spin_lock_irqsave(&chan->lock, irqflags); list_for_each_entry_safe(desc, next, &chan->done_list, node) { - dma_async_tx_callback callback; - void *callback_param; + struct dmaengine_desc_callback cb; - callback = desc->async_tx.callback; - callback_param = desc->async_tx.callback_param; - if (callback) { + dmaengine_desc_get_callback(&desc->async_tx, &cb); + if (dmaengine_desc_callback_valid(&cb)) { spin_unlock_irqrestore(&chan->lock, irqflags); - callback(callback_param); + dmaengine_desc_callback_invoke(&cb, NULL); spin_lock_irqsave(&chan->lock, irqflags); }