* [PATCH v2] dmaengine: zynqmp_dma: Add shutdown operation support
@ 2025-07-12 15:17 Abin Joseph
2025-07-14 4:37 ` Pandey, Radhey Shyam
0 siblings, 1 reply; 2+ messages in thread
From: Abin Joseph @ 2025-07-12 15:17 UTC (permalink / raw)
To: vkoul, michal.simek, yanzhen, radhey.shyam.pandey, palmer,
u.kleine-koenig
Cc: git, abin.joseph, dmaengine, linux-arm-kernel, linux-kernel
Add shutdown callback to ensure that DMA operations are properly stopped
and resources are released during system shutdown or kexec.
Fix incorrect PM state handling in the remove function that was causing
clock disabled warning during the shutdown operation since the device
may already be suspended with clock disabled, causing the clock
framework to warn about the double-disable attempt. The current check
ensures runtime_suspend is only called when the device is in active
power state, preventing clock warnings during shutdown while maintaining
proper clean up during normal remove operations.
Signed-off-by: Abin Joseph <abin.joseph@amd.com>
---
Changes in v2:
Update the shutdown to perform same operations
as remove.
---
drivers/dma/xilinx/zynqmp_dma.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index d05fc5fcc77d..0b03c2092c28 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -1173,9 +1173,18 @@ static void zynqmp_dma_remove(struct platform_device *pdev)
dma_async_device_unregister(&zdev->common);
zynqmp_dma_chan_remove(zdev->chan);
- pm_runtime_disable(zdev->dev);
- if (!pm_runtime_enabled(zdev->dev))
+ if (pm_runtime_active(zdev->dev))
zynqmp_dma_runtime_suspend(zdev->dev);
+ pm_runtime_disable(zdev->dev);
+}
+
+/**
+ * zynqmp_dma_shutdown - Driver shutdown function
+ * @pdev: Pointer to the platform_device structure
+ */
+static void zynqmp_dma_shutdown(struct platform_device *pdev)
+{
+ zynqmp_dma_remove(pdev);
}
static const struct of_device_id zynqmp_dma_of_match[] = {
@@ -1193,6 +1202,7 @@ static struct platform_driver zynqmp_dma_driver = {
},
.probe = zynqmp_dma_probe,
.remove = zynqmp_dma_remove,
+ .shutdown = zynqmp_dma_shutdown,
};
module_platform_driver(zynqmp_dma_driver);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH v2] dmaengine: zynqmp_dma: Add shutdown operation support
2025-07-12 15:17 [PATCH v2] dmaengine: zynqmp_dma: Add shutdown operation support Abin Joseph
@ 2025-07-14 4:37 ` Pandey, Radhey Shyam
0 siblings, 0 replies; 2+ messages in thread
From: Pandey, Radhey Shyam @ 2025-07-14 4:37 UTC (permalink / raw)
To: Joseph, Abin, vkoul@kernel.org, Simek, Michal, yanzhen@vivo.com,
palmer@rivosinc.com, u.kleine-koenig@baylibre.com
Cc: git (AMD-Xilinx), Joseph, Abin, dmaengine@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
[AMD Official Use Only - AMD Internal Distribution Only]
> -----Original Message-----
> From: Abin Joseph <abin.joseph@amd.com>
> Sent: Saturday, July 12, 2025 8:48 PM
> To: vkoul@kernel.org; Simek, Michal <michal.simek@amd.com>;
> yanzhen@vivo.com; Pandey, Radhey Shyam <radhey.shyam.pandey@amd.com>;
> palmer@rivosinc.com; u.kleine-koenig@baylibre.com
> Cc: git (AMD-Xilinx) <git@amd.com>; Joseph, Abin <Abin.Joseph@amd.com>;
> dmaengine@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH v2] dmaengine: zynqmp_dma: Add shutdown operation support
>
> Add shutdown callback to ensure that DMA operations are properly stopped
> and resources are released during system shutdown or kexec.
> Fix incorrect PM state handling in the remove function that was causing
> clock disabled warning during the shutdown operation since the device
Rephrase - it. Shutdown was not implemented earlier.
Say extend remove function for shutdown usecase.
> may already be suspended with clock disabled, causing the clock
> framework to warn about the double-disable attempt. The current check
> ensures runtime_suspend is only called when the device is in active
> power state, preventing clock warnings during shutdown while maintaining
Explain pm_runtime_enabled/ pm_runtime_active usage.
> proper clean up during normal remove operations.
>
> Signed-off-by: Abin Joseph <abin.joseph@amd.com>
> ---
>
> Changes in v2:
> Update the shutdown to perform same operations
> as remove.
>
> ---
> drivers/dma/xilinx/zynqmp_dma.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> index d05fc5fcc77d..0b03c2092c28 100644
> --- a/drivers/dma/xilinx/zynqmp_dma.c
> +++ b/drivers/dma/xilinx/zynqmp_dma.c
> @@ -1173,9 +1173,18 @@ static void zynqmp_dma_remove(struct platform_device
> *pdev)
> dma_async_device_unregister(&zdev->common);
>
> zynqmp_dma_chan_remove(zdev->chan);
> - pm_runtime_disable(zdev->dev);
> - if (!pm_runtime_enabled(zdev->dev))
> + if (pm_runtime_active(zdev->dev))
> zynqmp_dma_runtime_suspend(zdev->dev);
> + pm_runtime_disable(zdev->dev);
> +}
> +
> +/**
> + * zynqmp_dma_shutdown - Driver shutdown function
> + * @pdev: Pointer to the platform_device structure
> + */
Why we need separate handler ? Just reuse the remove directly ?
See https://lore.kernel.org/all/1748977771-714153-1-git-send-email-radhey.shyam.pandey@amd.com/
> +static void zynqmp_dma_shutdown(struct platform_device *pdev)
> +{
> + zynqmp_dma_remove(pdev);
> }
>
> static const struct of_device_id zynqmp_dma_of_match[] = {
> @@ -1193,6 +1202,7 @@ static struct platform_driver zynqmp_dma_driver = {
> },
> .probe = zynqmp_dma_probe,
> .remove = zynqmp_dma_remove,
> + .shutdown = zynqmp_dma_shutdown,
> };
>
> module_platform_driver(zynqmp_dma_driver);
> --
> 2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-14 4:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-12 15:17 [PATCH v2] dmaengine: zynqmp_dma: Add shutdown operation support Abin Joseph
2025-07-14 4:37 ` Pandey, Radhey Shyam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).