[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251217151609.3162665-22-den@valinux.co.jp>
Date: Thu, 18 Dec 2025 00:15:55 +0900
From: Koichiro Den <den@...inux.co.jp>
To: Frank.Li@....com,
dave.jiang@...el.com,
ntb@...ts.linux.dev,
linux-pci@...r.kernel.org,
dmaengine@...r.kernel.org,
linux-renesas-soc@...r.kernel.org,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: mani@...nel.org,
kwilczynski@...nel.org,
kishon@...nel.org,
bhelgaas@...gle.com,
corbet@....net,
geert+renesas@...der.be,
magnus.damm@...il.com,
robh@...nel.org,
krzk+dt@...nel.org,
conor+dt@...nel.org,
vkoul@...nel.org,
joro@...tes.org,
will@...nel.org,
robin.murphy@....com,
jdmason@...zu.us,
allenbh@...il.com,
andrew+netdev@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
Basavaraj.Natikar@....com,
Shyam-sundar.S-k@....com,
kurt.schwemmer@...rosemi.com,
logang@...tatee.com,
jingoohan1@...il.com,
lpieralisi@...nel.org,
utkarsh02t@...il.com,
jbrunet@...libre.com,
dlemoal@...nel.org,
arnd@...db.de,
elfring@...rs.sourceforge.net,
den@...inux.co.jp
Subject: [RFC PATCH v3 21/35] dmaengine: dw-edma: Add a helper to retrieve LL (Linked List) region
Remote eDMA users may want to know LL memory region addresses that were
configured perhaps on boot time by SoC glue driver, so that those
regions can later be exposed to the remote host side, who will run
dw_edma_probe() to configure remote eDMA.
Export a helper to query the LL region associated with a dma_chan.
Signed-off-by: Koichiro Den <den@...inux.co.jp>
---
drivers/dma/dw-edma/dw-edma-core.c | 27 +++++++++++++++++++++++++++
include/linux/dma/edma.h | 14 ++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
index 8e262f61f02d..77f523f40038 100644
--- a/drivers/dma/dw-edma/dw-edma-core.c
+++ b/drivers/dma/dw-edma/dw-edma-core.c
@@ -1203,6 +1203,33 @@ int dw_edma_chan_register_notify(struct dma_chan *dchan,
}
EXPORT_SYMBOL_GPL(dw_edma_chan_register_notify);
+int dw_edma_chan_get_ll_region(struct dma_chan *dchan,
+ struct dw_edma_region *region)
+{
+ struct dw_edma_chip *chip;
+ struct dw_edma_chan *chan;
+
+ if (!dchan || !region || !dchan->device ||
+ dchan->device->device_prep_slave_sg_config != dw_edma_device_prep_slave_sg_config)
+ return -ENODEV;
+
+ chan = dchan2dw_edma_chan(dchan);
+ if (!chan)
+ return -ENODEV;
+
+ chip = chan->dw->chip;
+ if (!(chip->flags & DW_EDMA_CHIP_LOCAL))
+ return -EINVAL;
+
+ if (chan->dir == EDMA_DIR_WRITE)
+ *region = chip->ll_region_wr[chan->id];
+ else
+ *region = chip->ll_region_rd[chan->id];
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(dw_edma_chan_get_ll_region);
+
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Synopsys DesignWare eDMA controller core driver");
MODULE_AUTHOR("Gustavo Pimentel <gustavo.pimentel@...opsys.com>");
diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h
index 4caf5cc5c368..1f40e027fa56 100644
--- a/include/linux/dma/edma.h
+++ b/include/linux/dma/edma.h
@@ -110,6 +110,15 @@ int dw_edma_chan_register_notify(struct dma_chan *chan,
void (*cb)(struct dma_chan *chan, void *user),
void *user);
+/**
+ * dw_edma_chan_get_ll_region - get linked list (LL) memory for a dma_chan
+ * @chan: the target DMA channel
+ * @region: output parameter returning the corresponding LL region
+ */
+int dw_edma_chan_get_ll_region(struct dma_chan *chan,
+ struct dw_edma_region *region);
+
+
#if IS_REACHABLE(CONFIG_PCIE_DW)
/**
* dw_edma_get_reg_window - get eDMA register base and size
@@ -207,6 +216,11 @@ static inline int dw_edma_chan_register_notify(struct dma_chan *chan,
{
return -ENODEV;
}
+static inline int dw_edma_chan_get_ll_region(struct dma_chan *chan,
+ struct dw_edma_region *region)
+{
+ return -EINVAL;
+}
#endif
#endif /* _DW_EDMA_H */
--
2.51.0
Powered by blists - more mailing lists