* [PATCH 0/2] Add runtime PM support to K3 UDMA and K3 INTA
@ 2026-04-29 17:49 Rahul Sharma
2026-04-29 17:49 ` [PATCH 1/2] dma: ti: k3-udma: enable runtime PM support Rahul Sharma
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rahul Sharma @ 2026-04-29 17:49 UTC (permalink / raw)
To: peter.ujfalusi, vkoul, Frank.Li, nm, kristo, ssantosh, tglx
Cc: linux-arm-kernel, dmaengine, linux-kernel
This series adds runtime PM support to the TI K3 UDMA DMA engine driver
and the TI SCI Interrupt Aggregator (INTA) irqchip driver on K3 SoCs.
Runtime PM callbacks are registered via SET_RUNTIME_PM_OPS and enabled
in probe via devm_pm_runtime_enable(). System sleep is handled by
delegating to pm_runtime_force_suspend/resume as late/early sleep ops,
keeping the PM runtime state machine consistent across system sleep
transitions and ensuring correct sequencing with power domain restoration
by genpd.
Rahul Sharma (2):
dma: ti: k3-udma: enable runtime PM support
irqchip: ti-sci-inta: add runtime PM and system sleep support
drivers/dma/ti/k3-udma.c | 46 ++++++++++++++++++++++-------
drivers/irqchip/irq-ti-sci-inta.c | 49 +++++++++++++++++++++++++++++++
2 files changed, 85 insertions(+), 10 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] dma: ti: k3-udma: enable runtime PM support
2026-04-29 17:49 [PATCH 0/2] Add runtime PM support to K3 UDMA and K3 INTA Rahul Sharma
@ 2026-04-29 17:49 ` Rahul Sharma
2026-04-29 17:49 ` [PATCH 2/2] irqchip: ti-sci-inta: add runtime PM and system sleep support Rahul Sharma
2026-04-30 6:11 ` [PATCH 0/2] Add runtime PM support to K3 UDMA and K3 INTA Rahul Sharma
2 siblings, 0 replies; 4+ messages in thread
From: Rahul Sharma @ 2026-04-29 17:49 UTC (permalink / raw)
To: peter.ujfalusi, vkoul, Frank.Li, nm, kristo, ssantosh, tglx
Cc: linux-arm-kernel, dmaengine, linux-kernel
Rename udma_pm_suspend/resume to udma_runtime_suspend/resume and
register them as runtime PM callbacks via SET_RUNTIME_PM_OPS. Enable
runtime PM in probe via devm_pm_runtime_enable().
System sleep is handled by reusing the same callbacks via
pm_runtime_force_suspend/resume as late/early sleep ops, keeping the
PM runtime state machine consistent across system sleep transitions.
Hold a runtime PM reference for the lifetime of each allocated channel
(acquired in alloc_chan_resources, released in free_chan_resources) to
ensure the device stays powered while DMA is in use.
Signed-off-by: Rahul Sharma <r-sharma3@ti.com>
---
drivers/dma/ti/k3-udma.c | 46 +++++++++++++++++++++++++++++++---------
1 file changed, 36 insertions(+), 10 deletions(-)
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index c964ebfcf3b6..47a4d45f4c09 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -28,6 +28,7 @@
#include <linux/soc/ti/ti_sci_inta_msi.h>
#include <linux/dma/k3-event-router.h>
#include <linux/dma/ti-cppi5.h>
+#include <linux/pm_runtime.h>
#include "../virt-dma.h"
#include "k3-udma.h"
@@ -2189,6 +2190,10 @@ static int udma_alloc_chan_resources(struct dma_chan *chan)
u32 irq_udma_idx;
int ret;
+ ret = pm_runtime_resume_and_get(ud->dev);
+ if (ret)
+ return ret;
+
uc->dma_dev = ud->dev;
if (uc->config.pkt_mode || uc->config.dir == DMA_MEM_TO_MEM) {
@@ -2382,6 +2387,7 @@ static int udma_alloc_chan_resources(struct dma_chan *chan)
uc->use_dma_pool = false;
}
+ pm_runtime_put(ud->dev);
return ret;
}
@@ -2393,6 +2399,10 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
u32 irq_udma_idx, irq_ring_idx;
int ret;
+ ret = pm_runtime_resume_and_get(ud->dev);
+ if (ret)
+ return ret;
+
/* Only TR mode is supported */
uc->config.pkt_mode = false;
@@ -2412,7 +2422,7 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
ret = bcdma_alloc_bchan_resources(uc);
if (ret)
- return ret;
+ goto err_res_free;
irq_ring_idx = uc->bchan->id + oes->bcdma_bchan_ring;
irq_udma_idx = uc->bchan->id + oes->bcdma_bchan_data;
@@ -2427,7 +2437,7 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
ret = udma_alloc_tx_resources(uc);
if (ret) {
uc->config.remote_thread_id = -1;
- return ret;
+ goto err_res_free;
}
uc->config.src_thread = ud->psil_base + uc->tchan->id;
@@ -2447,7 +2457,7 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
ret = udma_alloc_rx_resources(uc);
if (ret) {
uc->config.remote_thread_id = -1;
- return ret;
+ goto err_res_free;
}
uc->config.src_thread = uc->config.remote_thread_id;
@@ -2463,7 +2473,8 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
/* Can not happen */
dev_err(uc->ud->dev, "%s: chan%d invalid direction (%u)\n",
__func__, uc->id, uc->config.dir);
- return -EINVAL;
+ ret = -EINVAL;
+ goto err_res_free;
}
/* check if the channel configuration was successful */
@@ -2576,6 +2587,7 @@ static int bcdma_alloc_chan_resources(struct dma_chan *chan)
uc->use_dma_pool = false;
}
+ pm_runtime_put(ud->dev);
return ret;
}
@@ -2605,6 +2617,10 @@ static int pktdma_alloc_chan_resources(struct dma_chan *chan)
u32 irq_ring_idx;
int ret;
+ ret = pm_runtime_resume_and_get(ud->dev);
+ if (ret)
+ return ret;
+
/*
* Make sure that the completion is in a known state:
* No teardown, the channel is idle
@@ -2622,7 +2638,7 @@ static int pktdma_alloc_chan_resources(struct dma_chan *chan)
ret = udma_alloc_tx_resources(uc);
if (ret) {
uc->config.remote_thread_id = -1;
- return ret;
+ goto err_res_free;
}
uc->config.src_thread = ud->psil_base + uc->tchan->id;
@@ -2641,7 +2657,7 @@ static int pktdma_alloc_chan_resources(struct dma_chan *chan)
ret = udma_alloc_rx_resources(uc);
if (ret) {
uc->config.remote_thread_id = -1;
- return ret;
+ goto err_res_free;
}
uc->config.src_thread = uc->config.remote_thread_id;
@@ -2656,7 +2672,8 @@ static int pktdma_alloc_chan_resources(struct dma_chan *chan)
/* Can not happen */
dev_err(uc->ud->dev, "%s: chan%d invalid direction (%u)\n",
__func__, uc->id, uc->config.dir);
- return -EINVAL;
+ ret = -EINVAL;
+ goto err_res_free;
}
/* check if the channel configuration was successful */
@@ -2745,6 +2762,7 @@ static int pktdma_alloc_chan_resources(struct dma_chan *chan)
dma_pool_destroy(uc->hdesc_pool);
uc->use_dma_pool = false;
+ pm_runtime_put(ud->dev);
return ret;
}
@@ -4123,6 +4141,8 @@ static void udma_free_chan_resources(struct dma_chan *chan)
dma_pool_destroy(uc->hdesc_pool);
uc->use_dma_pool = false;
}
+
+ pm_runtime_put(ud->dev);
}
static struct platform_driver udma_driver;
@@ -5644,6 +5664,11 @@ static int udma_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ud);
+ /* Enable runtime PM */
+ ret = devm_pm_runtime_enable(dev);
+ if (ret)
+ return ret;
+
ret = of_dma_controller_register(dev->of_node, udma_of_xlate, ud);
if (ret) {
dev_err(dev, "failed to register of_dma controller\n");
@@ -5653,7 +5678,7 @@ static int udma_probe(struct platform_device *pdev)
return ret;
}
-static int __maybe_unused udma_pm_suspend(struct device *dev)
+static int udma_runtime_suspend(struct device *dev)
{
struct udma_dev *ud = dev_get_drvdata(dev);
struct dma_device *dma_dev = &ud->ddev;
@@ -5675,7 +5700,7 @@ static int __maybe_unused udma_pm_suspend(struct device *dev)
return 0;
}
-static int __maybe_unused udma_pm_resume(struct device *dev)
+static int udma_runtime_resume(struct device *dev)
{
struct udma_dev *ud = dev_get_drvdata(dev);
struct dma_device *dma_dev = &ud->ddev;
@@ -5701,7 +5726,8 @@ static int __maybe_unused udma_pm_resume(struct device *dev)
}
static const struct dev_pm_ops udma_pm_ops = {
- SET_LATE_SYSTEM_SLEEP_PM_OPS(udma_pm_suspend, udma_pm_resume)
+ SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
+ SET_RUNTIME_PM_OPS(udma_runtime_suspend, udma_runtime_resume, NULL)
};
static struct platform_driver udma_driver = {
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] irqchip: ti-sci-inta: add runtime PM and system sleep support
2026-04-29 17:49 [PATCH 0/2] Add runtime PM support to K3 UDMA and K3 INTA Rahul Sharma
2026-04-29 17:49 ` [PATCH 1/2] dma: ti: k3-udma: enable runtime PM support Rahul Sharma
@ 2026-04-29 17:49 ` Rahul Sharma
2026-04-30 6:11 ` [PATCH 0/2] Add runtime PM support to K3 UDMA and K3 INTA Rahul Sharma
2 siblings, 0 replies; 4+ messages in thread
From: Rahul Sharma @ 2026-04-29 17:49 UTC (permalink / raw)
To: peter.ujfalusi, vkoul, Frank.Li, nm, kristo, ssantosh, tglx
Cc: linux-arm-kernel, dmaengine, linux-kernel
Register runtime PM callbacks and enable runtime PM via
devm_pm_runtime_enable() in probe.
runtime_suspend is a no-op; IRQ routing context is preserved by TI SCI
firmware across power-gate cycles.
runtime_resume restores VINT_ENABLE_SET for each active event bit,
skipping IRQs with irqd_irq_masked set to avoid re-enabling
intentionally disabled interrupts.
System sleep reuses these callbacks via pm_runtime_force_suspend/resume
as late/early sleep ops. This ensures MMIO writes in runtime_resume
happen after genpd restores the power domain (dpm_resume_noirq),
avoiding writes to a powered-off device.
Signed-off-by: Rahul Sharma <r-sharma3@ti.com>
---
drivers/irqchip/irq-ti-sci-inta.c | 49 +++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c
index f1eb2f92f0ca..0d4451b208c1 100644
--- a/drivers/irqchip/irq-ti-sci-inta.c
+++ b/drivers/irqchip/irq-ti-sci-inta.c
@@ -18,6 +18,7 @@
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/soc/ti/ti_sci_inta_msi.h>
#include <linux/soc/ti/ti_sci_protocol.h>
@@ -720,11 +721,58 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&inta->vint_list);
mutex_init(&inta->vint_mutex);
+ dev_set_drvdata(dev, inta);
+
+ ret = devm_pm_runtime_enable(dev);
+ if (ret)
+ return ret;
+
dev_info(dev, "Interrupt Aggregator domain %d created\n", inta->ti_sci_id);
return 0;
}
+static int ti_sci_inta_runtime_suspend(struct device *dev)
+{
+ return 0;
+}
+
+static int ti_sci_inta_runtime_resume(struct device *dev)
+{
+ struct ti_sci_inta_irq_domain *inta = dev_get_drvdata(dev);
+ struct ti_sci_inta_vint_desc *vint_desc;
+ int bit;
+
+ mutex_lock(&inta->vint_mutex);
+ list_for_each_entry(vint_desc, &inta->vint_list, list) {
+ for_each_set_bit(bit, vint_desc->event_map, MAX_EVENTS_PER_VINT) {
+ unsigned int virq;
+ struct irq_data *data;
+
+ virq = irq_find_mapping(vint_desc->domain,
+ vint_desc->events[bit].hwirq);
+ if (!virq)
+ continue;
+ data = irq_get_irq_data(virq);
+ if (!data || irqd_irq_masked(data))
+ continue;
+ writeq_relaxed(BIT(bit), inta->base +
+ vint_desc->vint_id * 0x1000 +
+ VINT_ENABLE_SET_OFFSET);
+ }
+ }
+ mutex_unlock(&inta->vint_mutex);
+
+ return 0;
+}
+
+static const struct dev_pm_ops ti_sci_inta_pm_ops = {
+ SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+ pm_runtime_force_resume)
+ SET_RUNTIME_PM_OPS(ti_sci_inta_runtime_suspend,
+ ti_sci_inta_runtime_resume, NULL)
+};
+
static const struct of_device_id ti_sci_inta_irq_domain_of_match[] = {
{ .compatible = "ti,sci-inta", },
{ /* sentinel */ },
@@ -736,6 +784,7 @@ static struct platform_driver ti_sci_inta_irq_domain_driver = {
.driver = {
.name = "ti-sci-inta",
.of_match_table = ti_sci_inta_irq_domain_of_match,
+ .pm = pm_ptr(&ti_sci_inta_pm_ops),
},
};
module_platform_driver(ti_sci_inta_irq_domain_driver);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] Add runtime PM support to K3 UDMA and K3 INTA
2026-04-29 17:49 [PATCH 0/2] Add runtime PM support to K3 UDMA and K3 INTA Rahul Sharma
2026-04-29 17:49 ` [PATCH 1/2] dma: ti: k3-udma: enable runtime PM support Rahul Sharma
2026-04-29 17:49 ` [PATCH 2/2] irqchip: ti-sci-inta: add runtime PM and system sleep support Rahul Sharma
@ 2026-04-30 6:11 ` Rahul Sharma
2 siblings, 0 replies; 4+ messages in thread
From: Rahul Sharma @ 2026-04-30 6:11 UTC (permalink / raw)
To: r-sharma3
Cc: Frank.Li, dmaengine, kristo, linux-arm-kernel, linux-kernel, nm,
peter.ujfalusi, ssantosh, tglx, vkoul
Hi,
This patch series consists of 2 different subsystems of Linux. But
they work together in same subsystem of SoC that is K3 DMSS(Data Movement
Subsystem).
Both patches can be merged to their respective trees, with no
inter-dependency. They have been posted together for the ease of review.
BR,
Rahul
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-30 6:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-29 17:49 [PATCH 0/2] Add runtime PM support to K3 UDMA and K3 INTA Rahul Sharma
2026-04-29 17:49 ` [PATCH 1/2] dma: ti: k3-udma: enable runtime PM support Rahul Sharma
2026-04-29 17:49 ` [PATCH 2/2] irqchip: ti-sci-inta: add runtime PM and system sleep support Rahul Sharma
2026-04-30 6:11 ` [PATCH 0/2] Add runtime PM support to K3 UDMA and K3 INTA Rahul Sharma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox