Skip to contentSkip to conversation

dmaengine: zynqmp_dma: Add shutdown operation support

PATCH Superseded Abin Joseph 2 participants 2 messages Jul 12, 2025 – Jul 14, 2025

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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 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.

---

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(-)
drivers/dma/xilinx/zynqmp_dma.c +12 -2
index d05fc5fcc77d..0b03c2092c28 100644
@@ -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);
Signature · 1 line
2.34.1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 11 lines

-----Original Message-----
From: Abin Joseph <[email protected]>
Sent: Saturday, July 12, 2025 8:48 PM
To: [email protected]; Simek, Michal <[email protected]>; [email protected]; Pandey, Radhey Shyam <[email protected]>; [email protected]; [email protected]
Cc: git (AMD-Xilinx) <[email protected]>; Joseph, Abin <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: [PATCH v2] dmaengine: zynqmp_dma: Add shutdown operation support

Quoted 4 lines

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.

Quoted 4 lines

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.

Quoted 23 lines

proper clean up during normal remove operations.

---

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(-)
drivers/dma/xilinx/zynqmp_dma.c +0 -1
index d05fc5fcc77d..0b03c2092c28 100644
@@ -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);

drivers/dma/xilinx/zynqmp_dma.c static void zynqmp_dma_remove(struct platform_device · line 1185

Quoted 10 lines
drivers/dma/xilinx/zynqmp_dma.c +8 -1
-     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/[email protected]/

Quoted 16 lines
drivers/dma/xilinx/zynqmp_dma.c +3 -0
+static void zynqmp_dma_shutdown(struct platform_device *pdev)
+{
+     zynqmp_dma_remove(pdev);
 }
 

static const struct of_device_id zynqmp_dma_of_match[] = {

drivers/dma/xilinx/zynqmp_dma.c +1 -1
@@ -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