All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: Paul Cercueil <paul@crapouillou.net>,
	Jonathan Cameron <jic23@kernel.org>
Cc: "Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Christian König" <christian.koenig@amd.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Alexandru Ardelean" <ardeleanalex@gmail.com>,
	dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 02/12] iio: buffer-dma: Enable buffer write support
Date: Tue, 29 Mar 2022 09:11:48 +0200	[thread overview]
Message-ID: <deb2cd86196addbc47908455880000c618b984be.camel@gmail.com> (raw)
In-Reply-To: <96XG9R.3NOIIEN7IS001@crapouillou.net>

On Mon, 2022-03-28 at 19:39 +0100, Paul Cercueil wrote:
> Hi Jonathan,
> 
> Le lun., mars 28 2022 at 18:24:09 +0100, Jonathan Cameron 
> <jic23@kernel.org> a écrit :
> > On Mon,  7 Feb 2022 12:59:23 +0000
> > Paul Cercueil <paul@crapouillou.net> wrote:
> > 
> > >  Adding write support to the buffer-dma code is easy - the
> > > write()
> > >  function basically needs to do the exact same thing as the
> > > read()
> > >  function: dequeue a block, read or write the data, enqueue the
> > > block
> > >  when entirely processed.
> > > 
> > >  Therefore, the iio_buffer_dma_read() and the new 
> > > iio_buffer_dma_write()
> > >  now both call a function iio_buffer_dma_io(), which will perform
> > > this
> > >  task.
> > > 
> > >  The .space_available() callback can return the exact same value
> > > as 
> > > the
> > >  .data_available() callback for input buffers, since in both
> > > cases we
> > >  count the exact same thing (the number of bytes in each
> > > available
> > >  block).
> > > 
> > >  Note that we preemptively reset block->bytes_used to the
> > > buffer's 
> > > size
> > >  in iio_dma_buffer_request_update(), as in the future the
> > >  iio_dma_buffer_enqueue() function won't reset it.
> > > 
> > >  v2: - Fix block->state not being reset in
> > >        iio_dma_buffer_request_update() for output buffers.
> > >      - Only update block->bytes_used once and add a comment about
> > > why we
> > >        update it.
> > >      - Add a comment about why we're setting a different state
> > > for 
> > > output
> > >        buffers in iio_dma_buffer_request_update()
> > >      - Remove useless cast to bool (!!) in iio_dma_buffer_io()
> > > 
> > >  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> > >  Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
> > One comment inline.
> > 
> > I'd be tempted to queue this up with that fixed, but do we have
> > any users?  Even though it's trivial I'm not that keen on code
> > upstream well in advance of it being used.
> 
> There's a userspace user in libiio. On the kernel side we do have 
> drivers that use it in ADI's downstream kernel, that we plan to 
> upstream in the long term (but it can take some time, as we need to 
> upstream other things first, like JESD204B support).
> 
> 

You mean, users for DMA output buffers? If so, I have on my queue to
add the dac counterpart of this one:

https://elixir.bootlin.com/linux/latest/source/drivers/iio/adc/adi-axi-adc.c

Which is a user of DMA buffers. Though this one does not depend on
JESD204, I suspect it will also be a tricky process mainly because I
think there are major issues on how things are done right now (on the
ADC driver).

But yeah, not a topic here and I do plan to first start the discussion
on the mailing list before starting developing (hopefully in the coming
weeks)...

- Nuno Sá



WARNING: multiple messages have this Message-ID (diff)
From: "Nuno Sá" <noname.nuno@gmail.com>
To: Paul Cercueil <paul@crapouillou.net>,
	Jonathan Cameron <jic23@kernel.org>
Cc: "Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	linux-iio@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	linaro-mm-sig@lists.linaro.org,
	"Alexandru Ardelean" <ardeleanalex@gmail.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH v2 02/12] iio: buffer-dma: Enable buffer write support
Date: Tue, 29 Mar 2022 09:11:48 +0200	[thread overview]
Message-ID: <deb2cd86196addbc47908455880000c618b984be.camel@gmail.com> (raw)
In-Reply-To: <96XG9R.3NOIIEN7IS001@crapouillou.net>

On Mon, 2022-03-28 at 19:39 +0100, Paul Cercueil wrote:
> Hi Jonathan,
> 
> Le lun., mars 28 2022 at 18:24:09 +0100, Jonathan Cameron 
> <jic23@kernel.org> a écrit :
> > On Mon,  7 Feb 2022 12:59:23 +0000
> > Paul Cercueil <paul@crapouillou.net> wrote:
> > 
> > >  Adding write support to the buffer-dma code is easy - the
> > > write()
> > >  function basically needs to do the exact same thing as the
> > > read()
> > >  function: dequeue a block, read or write the data, enqueue the
> > > block
> > >  when entirely processed.
> > > 
> > >  Therefore, the iio_buffer_dma_read() and the new 
> > > iio_buffer_dma_write()
> > >  now both call a function iio_buffer_dma_io(), which will perform
> > > this
> > >  task.
> > > 
> > >  The .space_available() callback can return the exact same value
> > > as 
> > > the
> > >  .data_available() callback for input buffers, since in both
> > > cases we
> > >  count the exact same thing (the number of bytes in each
> > > available
> > >  block).
> > > 
> > >  Note that we preemptively reset block->bytes_used to the
> > > buffer's 
> > > size
> > >  in iio_dma_buffer_request_update(), as in the future the
> > >  iio_dma_buffer_enqueue() function won't reset it.
> > > 
> > >  v2: - Fix block->state not being reset in
> > >        iio_dma_buffer_request_update() for output buffers.
> > >      - Only update block->bytes_used once and add a comment about
> > > why we
> > >        update it.
> > >      - Add a comment about why we're setting a different state
> > > for 
> > > output
> > >        buffers in iio_dma_buffer_request_update()
> > >      - Remove useless cast to bool (!!) in iio_dma_buffer_io()
> > > 
> > >  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> > >  Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
> > One comment inline.
> > 
> > I'd be tempted to queue this up with that fixed, but do we have
> > any users?  Even though it's trivial I'm not that keen on code
> > upstream well in advance of it being used.
> 
> There's a userspace user in libiio. On the kernel side we do have 
> drivers that use it in ADI's downstream kernel, that we plan to 
> upstream in the long term (but it can take some time, as we need to 
> upstream other things first, like JESD204B support).
> 
> 

You mean, users for DMA output buffers? If so, I have on my queue to
add the dac counterpart of this one:

https://elixir.bootlin.com/linux/latest/source/drivers/iio/adc/adi-axi-adc.c

Which is a user of DMA buffers. Though this one does not depend on
JESD204, I suspect it will also be a tricky process mainly because I
think there are major issues on how things are done right now (on the
ADC driver).

But yeah, not a topic here and I do plan to first start the discussion
on the mailing list before starting developing (hopefully in the coming
weeks)...

- Nuno Sá



  reply	other threads:[~2022-03-29  7:11 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07 12:59 [PATCH v2 00/12] iio: buffer-dma: write() and new DMABUF based API Paul Cercueil
2022-02-07 12:59 ` Paul Cercueil
2022-02-07 12:59 ` [PATCH v2 01/12] iio: buffer-dma: Get rid of outgoing queue Paul Cercueil
2022-02-07 12:59   ` Paul Cercueil
2022-02-13 18:57   ` Jonathan Cameron
2022-02-13 18:57     ` Jonathan Cameron
2022-02-13 19:25     ` Paul Cercueil
2022-02-13 19:25       ` Paul Cercueil
2022-03-28 17:17   ` Jonathan Cameron
2022-03-28 17:17     ` Jonathan Cameron
2022-02-07 12:59 ` [PATCH v2 02/12] iio: buffer-dma: Enable buffer write support Paul Cercueil
2022-02-07 12:59   ` Paul Cercueil
2022-03-28 17:24   ` Jonathan Cameron
2022-03-28 17:24     ` Jonathan Cameron
2022-03-28 18:39     ` Paul Cercueil
2022-03-28 18:39       ` Paul Cercueil
2022-03-29  7:11       ` Nuno Sá [this message]
2022-03-29  7:11         ` Nuno Sá
2022-03-28 20:38   ` Andy Shevchenko
2022-03-28 20:38     ` Andy Shevchenko
2022-02-07 12:59 ` [PATCH v2 03/12] iio: buffer-dmaengine: Support specifying buffer direction Paul Cercueil
2022-02-07 12:59   ` Paul Cercueil
2022-02-07 12:59 ` [PATCH v2 04/12] iio: buffer-dmaengine: Enable write support Paul Cercueil
2022-02-07 12:59   ` Paul Cercueil
2022-03-28 17:28   ` Jonathan Cameron
2022-03-28 17:28     ` Jonathan Cameron
2022-02-07 12:59 ` [PATCH v2 05/12] iio: core: Add new DMABUF interface infrastructure Paul Cercueil
2022-02-07 12:59   ` Paul Cercueil
2022-03-28 17:37   ` Jonathan Cameron
2022-03-28 17:37     ` Jonathan Cameron
2022-03-28 18:44     ` Paul Cercueil
2022-03-28 18:44       ` Paul Cercueil
2022-03-29 13:36       ` Jonathan Cameron
2022-03-29 13:36         ` Jonathan Cameron
2022-03-28 20:46   ` Andy Shevchenko
2022-03-28 20:46     ` Andy Shevchenko
2022-02-07 12:59 ` [PATCH v2 06/12] iio: buffer-dma: split iio_dma_buffer_fileio_free() function Paul Cercueil
2022-02-07 12:59   ` Paul Cercueil
2022-02-07 12:59 ` [PATCH v2 07/12] iio: buffer-dma: Use DMABUFs instead of custom solution Paul Cercueil
2022-02-07 12:59   ` Paul Cercueil
2022-03-28 17:54   ` Jonathan Cameron
2022-03-28 17:54     ` Jonathan Cameron
2022-03-28 17:54     ` Christian König
2022-03-28 17:54       ` Christian König
2022-03-28 19:16     ` Paul Cercueil
2022-03-28 19:16       ` Paul Cercueil
2022-03-28 20:58       ` Andy Shevchenko
2022-03-28 20:58         ` Andy Shevchenko
2022-02-07 12:59 ` [PATCH v2 08/12] iio: buffer-dma: Implement new DMABUF based userspace API Paul Cercueil
2022-02-07 12:59   ` Paul Cercueil
2022-02-07 12:59 ` [PATCH v2 09/12] iio: buffer-dmaengine: Support " Paul Cercueil
2022-02-07 12:59   ` Paul Cercueil
2022-02-07 12:59 ` [PATCH v2 10/12] iio: core: Add support for cyclic buffers Paul Cercueil
2022-02-07 12:59   ` Paul Cercueil
2022-02-07 13:01 ` [PATCH v2 11/12] iio: buffer-dmaengine: " Paul Cercueil
2022-02-07 13:01   ` Paul Cercueil
2022-02-07 13:01   ` [PATCH v2 12/12] Documentation: iio: Document high-speed DMABUF based API Paul Cercueil
2022-02-07 13:01     ` Paul Cercueil
2022-03-29  8:54     ` Daniel Vetter
2022-03-29  8:54       ` Daniel Vetter
2022-03-29  9:47       ` Paul Cercueil
2022-03-29  9:47         ` Paul Cercueil
2022-03-29 14:07         ` Daniel Vetter
2022-03-29 14:07           ` Daniel Vetter
2022-03-29 17:34           ` Paul Cercueil
2022-03-29 17:34             ` Paul Cercueil
2022-03-30  9:22             ` Daniel Vetter
2022-03-30  9:22               ` Daniel Vetter
2022-02-13 18:46 ` [PATCH v2 00/12] iio: buffer-dma: write() and new " Jonathan Cameron
2022-02-13 18:46   ` Jonathan Cameron
2022-02-15 17:43   ` Paul Cercueil
2022-02-15 17:43     ` Paul Cercueil
2022-03-29  8:33     ` Daniel Vetter
2022-03-29  8:33       ` Daniel Vetter
2022-03-29  9:11       ` Paul Cercueil
2022-03-29  9:11         ` Paul Cercueil
2022-03-29 14:10         ` Daniel Vetter
2022-03-29 14:10           ` Daniel Vetter
2022-03-29 17:16           ` Paul Cercueil
2022-03-29 17:16             ` Paul Cercueil
2022-03-30  9:19             ` Daniel Vetter
2022-03-30  9:19               ` Daniel Vetter

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=deb2cd86196addbc47908455880000c618b984be.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=ardeleanalex@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=corbet@lwn.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@crapouillou.net \
    --cc=sumit.semwal@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.