From: Srinivas Neeli <srinivas.neeli@amd.com>
To: <vkoul@kernel.org>
Cc: <michal.simek@amd.com>, <robh@kernel.org>, <krzk+dt@kernel.org>,
<conor+dt@kernel.org>, <suraj.gupta2@amd.com>,
<abin.joseph@amd.com>, <radhey.shyam.pandey@amd.com>,
<dev@folker-schwesinger.de>, <thomas.gessler@brueckmann-gmbh.de>,
<tomi.valkeinen@ideasonboard.com>, <dmaengine@vger.kernel.org>,
<devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <git@amd.com>,
<srinivas.neeli@amd.com>
Subject: [PATCH 5/7] dmaengine: xilinx_dma: Extend metadata handling for AXI MCDMA
Date: Thu, 12 Feb 2026 19:21:44 +0530 [thread overview]
Message-ID: <20260212135146.1185416-6-srinivas.neeli@amd.com> (raw)
In-Reply-To: <20260212135146.1185416-1-srinivas.neeli@amd.com>
From: Suraj Gupta <suraj.gupta2@amd.com>
Extend probe logic to detect AXI Stream connections for MCDMA. When
an AXI Stream interface is present, metadata operations are enabled for
the MCDMA channel. The xilinx_dma_get_metadata_ptr() is enhanced to
retrieve metadata directly from MCDMA descriptors.
Add corresponding channel reference in struct xilinx_dma_tx_descriptor to
retrieve associated channel.
These changes ensure proper metadata handling and accurate transfer
size reporting for MCDMA transfers.
Signed-off-by: Suraj Gupta <suraj.gupta2@amd.com>
Co-developed-by: Srinivas Neeli <srinivas.neeli@amd.com>
Signed-off-by: Srinivas Neeli <srinivas.neeli@amd.com>
---
drivers/dma/xilinx/xilinx_dma.c | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index e3f8c0f09a17..0fed6bb1b354 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -222,6 +222,8 @@
#define XILINX_MCDMA_BD_EOP BIT(30)
#define XILINX_MCDMA_BD_SOP BIT(31)
+struct xilinx_dma_chan;
+
/**
* struct xilinx_vdma_desc_hw - Hardware Descriptor
* @next_desc: Next Descriptor Pointer @0x00
@@ -371,6 +373,7 @@ struct xilinx_cdma_tx_segment {
/**
* struct xilinx_dma_tx_descriptor - Per Transaction structure
+ * @chan: DMA channel for which this descriptor is allocated
* @async_tx: Async transaction descriptor
* @segments: TX segments list
* @node: Node in the channel descriptors list
@@ -379,6 +382,7 @@ struct xilinx_cdma_tx_segment {
* @residue: Residue of the completed descriptor
*/
struct xilinx_dma_tx_descriptor {
+ struct xilinx_dma_chan *chan;
struct dma_async_tx_descriptor async_tx;
struct list_head segments;
struct list_head node;
@@ -653,12 +657,23 @@ static void *xilinx_dma_get_metadata_ptr(struct dma_async_tx_descriptor *tx,
size_t *payload_len, size_t *max_len)
{
struct xilinx_dma_tx_descriptor *desc = to_dma_tx_descriptor(tx);
- struct xilinx_axidma_tx_segment *seg;
+ void *metadata_ptr;
+
+ if (desc->chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA) {
+ struct xilinx_aximcdma_tx_segment *seg;
+ seg = list_first_entry(&desc->segments,
+ struct xilinx_aximcdma_tx_segment, node);
+ metadata_ptr = seg->hw.app;
+ } else {
+ struct xilinx_axidma_tx_segment *seg;
+
+ seg = list_first_entry(&desc->segments,
+ struct xilinx_axidma_tx_segment, node);
+ metadata_ptr = seg->hw.app;
+ }
*max_len = *payload_len = sizeof(u32) * XILINX_DMA_NUM_APP_WORDS;
- seg = list_first_entry(&desc->segments,
- struct xilinx_axidma_tx_segment, node);
- return seg->hw.app;
+ return metadata_ptr;
}
static struct dma_descriptor_metadata_ops xilinx_dma_metadata_ops = {
@@ -848,6 +863,7 @@ xilinx_dma_alloc_tx_descriptor(struct xilinx_dma_chan *chan)
if (!desc)
return NULL;
+ desc->chan = chan;
INIT_LIST_HEAD(&desc->segments);
return desc;
@@ -2613,6 +2629,9 @@ xilinx_mcdma_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl,
segment->hw.control |= XILINX_MCDMA_BD_EOP;
}
+ if (chan->xdev->has_axistream_connected)
+ desc->async_tx.metadata_ops = &xilinx_dma_metadata_ops;
+
return &desc->async_tx;
error:
@@ -3261,7 +3280,8 @@ static int xilinx_dma_probe(struct platform_device *pdev)
dma_set_max_seg_size(xdev->dev, xdev->max_buffer_len);
- if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
+ if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA ||
+ xdev->dma_config->dmatype == XDMA_TYPE_AXIMCDMA) {
xdev->has_axistream_connected =
of_property_read_bool(node, "xlnx,axistream-connected");
}
--
2.25.1
next prev parent reply other threads:[~2026-02-12 13:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 13:51 [PATCH 0/7] dmaengine: xilinx_dma: MCDMA descriptor and metadata handling improvements Srinivas Neeli
2026-02-12 13:51 ` [PATCH 1/7] dmaengine: xilinx_dma: Fix MCDMA descriptor fields for MM2S vs S2MM Srinivas Neeli
2026-02-12 13:51 ` [PATCH 2/7] dt-bindings: dmaengine: xilinx_dma: Move xlnx,irq-delay to common AXI DMA and MCDMA section Srinivas Neeli
2026-02-12 16:30 ` Krzysztof Kozlowski
2026-02-12 13:51 ` [PATCH 3/7] dmaengine: xilinx_dma: Move descriptors to done list based on completion bit Srinivas Neeli
2026-02-12 13:51 ` [PATCH 4/7] dt-bindings: xilinx-dma: Extend 'xlnx,axistream-connected' property to MCDMA Srinivas Neeli
2026-02-12 13:51 ` Srinivas Neeli [this message]
2026-02-12 13:51 ` [PATCH 6/7] dt-bindings: dmaengine: xilinx_dma: Add "xlnx,include-stscntrl-strm" property Srinivas Neeli
2026-02-12 16:29 ` Krzysztof Kozlowski
2026-02-12 13:51 ` [PATCH 7/7] dmaengine: xilinx_dma: Add support for reporting transfer size to AXI DMA / MCDMA client when app fields are unavailable Srinivas Neeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260212135146.1185416-6-srinivas.neeli@amd.com \
--to=srinivas.neeli@amd.com \
--cc=abin.joseph@amd.com \
--cc=conor+dt@kernel.org \
--cc=dev@folker-schwesinger.de \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=git@amd.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=radhey.shyam.pandey@amd.com \
--cc=robh@kernel.org \
--cc=suraj.gupta2@amd.com \
--cc=thomas.gessler@brueckmann-gmbh.de \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®