From: Vinod Koul <vkoul@kernel.org>
To: Adrian Larumbe <adrianml@alumnos.upm.es>
Cc: Adrian Larumbe <adrian.martinezlarumbe@imgtec.com>,
dmaengine@vger.kernel.org, michal.simek@xilinx.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] dmaengine: xilinx_dma: Restore support for memcpy SG transfers
Date: Thu, 29 Jul 2021 09:49:09 +0530 [thread overview]
Message-ID: <YQIsPV1FTWtA0tYN@matsya> (raw)
In-Reply-To: <20210726221423.5q6b5cwruznzqfxr@worklaptop.localdomain>
On 26-07-21, 23:14, Adrian Larumbe wrote:
> Hi Vinod, I'm the same person who authored this patch. I left my previous
> employer so no longer have access to their company email address. However I've
> signed this email with the same GPG key to confirm my identity.
>
> On 14.07.2021 10:28, Vinod Koul wrote:
> > On 07-07-21, 00:43, Adrian Larumbe wrote:
> > > This is the old DMA_SG interface that was removed in commit
> > > c678fa66341c ("dmaengine: remove DMA_SG as it is dead code in kernel"). It
> > > has been renamed to DMA_MEMCPY_SG to better match the MEMSET and MEMSET_SG
> > > naming convention.
> > >
> > > It should only be used for mem2mem copies, either main system memory or
> > > CPU-addressable device memory (like video memory on a PCI graphics card).
> > >
> > > Bringing back this interface was prompted by the need to use the Xilinx
> > > CDMA device for mem2mem SG transfers. The current CDMA binding for
> > > device_prep_dma_memcpy_sg was partially borrowed from xlnx kernel tree, and
> > > expanded with extended address space support when linking descriptor
> > > segments and checking for incorrect zero transfer size.
> > >
> > > Signed-off-by: Adrian Larumbe <adrian.martinezlarumbe@imgtec.com>
> > > ---
> > > .../driver-api/dmaengine/provider.rst | 11 ++
> > > drivers/dma/dmaengine.c | 7 +
> > > drivers/dma/xilinx/xilinx_dma.c | 122 ++++++++++++++++++
> >
> > Can you make this split... documentation patch, core change and then
> > driver
>
> I understand you'd like these in three different patches, is that right? Or
Correct
> maybe one patch for the core change and its associated documentation, and
doc and core should be different
> another one for the consumer.
>
> > > include/linux/dmaengine.h | 20 +++
> > > 4 files changed, 160 insertions(+)
> > >
> > > diff --git a/Documentation/driver-api/dmaengine/provider.rst b/Documentation/driver-api/dmaengine/provider.rst
> > > index ddb0a81a796c..9f0efe9e9952 100644
> > > --- a/Documentation/driver-api/dmaengine/provider.rst
> > > +++ b/Documentation/driver-api/dmaengine/provider.rst
> > > @@ -162,6 +162,17 @@ Currently, the types available are:
> > >
> > > - The device is able to do memory to memory copies
> > >
> > > +- - DMA_MEMCPY_SG
> > > +
> > > + - The device supports memory to memory scatter-gather transfers.
> > > +
> > > + - Even though a plain memcpy can look like a particular case of a
> > > + scatter-gather transfer, with a single chunk to transfer, it's a
> > > + distinct transaction type in the mem2mem transfer case. This is
> > > + because some very simple devices might be able to do contiguous
> > > + single-chunk memory copies, but have no support for more
> > > + complex SG transfers.
> >
> > How does one deal with cases where
> > - src_sg_len and dstn_sg_len are different?
>
> Then only as many bytes as the smallest of the scattered buffers will be copied.
Is that not a restriction and that needs to be documented with examples!
>
> > > - src_sg and dstn_sg are different lists (maybe different number of
> > > entries with different lengths..)
> > >
> > > I think we need to document these cases or limitations..
>
> I don't think we should place any restrictions on the number of scatterlist
> entries or their length, and the consumer driver should ensure that these get
> translated into a device-specific descriptor chain. However the previous
> semantic should always be observed, which effectively turns the operation into
> sort of a strncpy.
That sounds right, but someone needs to know how to handle such cases
with this API, that needs to be explained in detail on expected
behaviour when src_sg_len & dstn_sg_len and same, less or more!
--
~Vinod
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-07-29 4:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-06 23:43 [PATCH 0/2] Add support for MEMCPY_SG transfers Adrian Larumbe
2021-07-06 23:43 ` [PATCH 1/2] dmaengine: xilinx_dma: Restore support for memcpy SG transfers Adrian Larumbe
2021-07-14 4:58 ` Vinod Koul
2021-07-26 22:14 ` Adrian Larumbe
2021-07-29 4:19 ` Vinod Koul [this message]
2021-07-06 23:43 ` [PATCH 2/2] xilinx_dma: Fix read-after-free bug when terminating transfers Adrian Larumbe
2021-07-14 5:10 ` Vinod Koul
2021-11-01 18:08 ` [PATCH 0/3] Add support for MEMCPY_SG transfers Adrian Larumbe
2021-11-01 18:08 ` [PATCH 1/3] dmaengine: Add documentation for new memcpy scatter-gather function Adrian Larumbe
2021-11-01 18:08 ` [PATCH 2/3] dmaengine: Add core function and capability check for DMA_MEMCPY_SG Adrian Larumbe
2021-11-01 18:08 ` [PATCH 3/3] dmaengine: Add consumer for the new DMA_MEMCPY_SG API function Adrian Larumbe
2021-11-02 10:33 ` [PATCH 0/3] Add support for MEMCPY_SG transfers Michal Simek
2021-11-22 6:08 ` Vinod Koul
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=YQIsPV1FTWtA0tYN@matsya \
--to=vkoul@kernel.org \
--cc=adrian.martinezlarumbe@imgtec.com \
--cc=adrianml@alumnos.upm.es \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=michal.simek@xilinx.com \
/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