DMA Engine development
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: "Sumit Kumar" <sumit.kumar@oss.qualcomm.com>,
	"Vinod Koul" <vkoul@kernel.org>, "Frank Li" <Frank.Li@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Jeff Hugo" <jeff.hugo@oss.qualcomm.com>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	dmaengine@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, mhi@lists.linux.dev,
	linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 2/5] dmaengine: dw-edma: Add DMA_SG support
Date: Fri, 14 Aug 2026 11:08:37 -0500	[thread overview]
Message-ID: <an89hXJm2wY8Owry@SMW015318> (raw)
In-Reply-To: <ye4bue5a2uq65d5befelyhs3cbezpjytbni4mtnge42ijmaqny@3bijtktlvyrj>

On Fri, Aug 14, 2026 at 03:58:48PM +0200, Manivannan Sadhasivam wrote:
> On Thu, Aug 06, 2026 at 02:06:30PM -0500, Frank Li wrote:
> > On Mon, Aug 03, 2026 at 04:01:44PM +0530, Sumit Kumar wrote:
> > > [You don't often get email from sumit.kumar@oss.qualcomm.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> > >
> > > Synopsys DesignWare eDMA supports a linked-list mode where each list item
> > > carries independent source and destination addresses, letting multiple
> > > independent memory transfers be described in one linked list and submitted
> > > to the hardware as a single DMA transaction. The IP processes list items
> > > strictly in order, so paired scatter-gather entries are never reordered.
> > >
> > > Implement the DMA_SG capability by adding a new EDMA_XFER_DUAL_SG transfer
> > > type and a corresponding struct dw_edma_dual_sg carrying the paired source
> > > and destination SG lists. dw_edma_device_transfer() walks both lists in
> > > lockstep, building a single hardware linked-list; a per-entry length
> > > mismatch or premature list end fails the whole request.
> >
> > It is not as simple as it.  for example, if you want to transfer 9k data
> > from src to dest
> >
> > src virtual addr 0x1004,        dest 0xA0001008
> >
> > when map_sg, src's sg maybe
> >
> > 0x1000  .. 4k   offset 4,
> > 0x9000  .. 4k   offset 0
> > 0xA000  .. 4k   offset 0
> >
> > or
> > 0x1000 .. 8k  offset 4
> > 0xA000 .. 4k  offset 0
> >
> > which totally depend on physical address allocation although most likely
> > first case happen
> >
> > dest sg
> > 0xA001000 .. 4k offset 8
> > 0xA008000 .. 4k offset 0
> > 0xA00E000 .. 4k offset 0
> >
> > descriptors
> > 1 	transfer 4k-8
> > 2       transfer tail 4 byte
> > 3 	transfer 4k-8
> > 4       transfer tail 4 byte
> > ...
> >
> > the start address of src and dest is highly possible differences. So it
> > is very hard to match your requirement, both sg's structure is the same.
> >
>
> That's the API limitation, isn't it? The callers have to supply the same length
> src/dst pairs to work with this API. But they don't necessarily need to use

Define API is memcpy, not memory to peripherail Or peripherail to memory

dmaengine_prep_dma_sg() - Prepare a memory-to-memory scatter-gather DMA descriptor.

Most memcpy user need call dma_map_sg() to get sg.  And most likely two
virutal address offset to page is difference.

So most likely return failure by this API.

What next, if failure,  fallback other DMAengine API or return user?

If fallback to other APIs, code logic become more complex. If return to
user, user will be strange why failure at some time, but success at
some time.

Frank

> dma_map_sg() which can provide fragmented mappings as you described. They can
> use dma_map_single() or even the bus addresses directly as the MHI client is
> already doing.
>
> - Mani
>
> --
> மணிவண்ணன் சதாசிவம்

  reply	other threads:[~2026-08-14 16:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 10:31 [PATCH v2 0/5] dmaengine: Add batched scatter-gather DMA support Sumit Kumar
2026-08-03 10:31 ` [PATCH v2 1/5] dmaengine: Add DMA_SG support for multi-buffer scatter-gather transfers Sumit Kumar
2026-08-11 18:17   ` Vinod Koul
2026-08-14  5:35     ` Manivannan Sadhasivam
2026-08-14 14:33     ` Frank Li
2026-08-03 10:31 ` [PATCH v2 2/5] dmaengine: dw-edma: Add DMA_SG support Sumit Kumar
2026-08-06 19:06   ` Frank Li
2026-08-14 13:58     ` Manivannan Sadhasivam
2026-08-14 16:08       ` Frank Li [this message]
2026-08-03 10:31 ` [PATCH v2 3/5] PCI: epf-mhi: Use a define for the DMA transfer timeout Sumit Kumar
2026-08-14 14:00   ` Manivannan Sadhasivam
2026-08-03 10:31 ` [PATCH v2 4/5] PCI: epf-mhi: Add batched DMA read support Sumit Kumar
2026-08-06 17:11   ` Frank Li
2026-08-14 14:52     ` Manivannan Sadhasivam
2026-08-14 14:32   ` Manivannan Sadhasivam
2026-08-03 10:31 ` [PATCH v2 5/5] bus: mhi: ep: Use batched read for ring caching Sumit Kumar

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=an89hXJm2wY8Owry@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=corbet@lwn.net \
    --cc=dmaengine@vger.kernel.org \
    --cc=jeff.hugo@oss.qualcomm.com \
    --cc=kishon@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=mhi@lists.linux.dev \
    --cc=skhan@linuxfoundation.org \
    --cc=sumit.kumar@oss.qualcomm.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