From: Vinod <vkoul@kernel.org>
To: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: dan.j.williams@intel.com, dmaengine@vger.kernel.org,
linux-kernel@vger.kernel.org, lars@metafoo.de,
radheys@xilinx.com
Subject: Re: [PATCH v2 2/2] dmaengine: doc: Add sections for per descriptor metadata support
Date: Tue, 11 Sep 2018 13:06:27 +0530 [thread overview]
Message-ID: <20180911073627.GL2634@vkoul-mobl> (raw)
In-Reply-To: <20180830121910.16005-3-peter.ujfalusi@ti.com>
On 30-08-18, 15:19, Peter Ujfalusi wrote:
> Update the provider and client documentation with details about the
> metadata support.
It would make sense to make this patch 1 :)
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
> Documentation/driver-api/dmaengine/client.rst | 70 +++++++++++++++++++
> .../driver-api/dmaengine/provider.rst | 46 ++++++++++++
> 2 files changed, 116 insertions(+)
>
> diff --git a/Documentation/driver-api/dmaengine/client.rst b/Documentation/driver-api/dmaengine/client.rst
> index fbbb2831f29f..584a39347cfe 100644
> --- a/Documentation/driver-api/dmaengine/client.rst
> +++ b/Documentation/driver-api/dmaengine/client.rst
> @@ -151,6 +151,76 @@ The details of these operations are:
> Note that callbacks will always be invoked from the DMA
> engines tasklet, never from interrupt context.
>
> + Optional: per descriptor metadata
> + ---------------------------------
> + DMAengine provides two ways for metadata support.
> +
> + DESC_METADATA_CLIENT
> +
> + The metadata buffer is allocated/provided by the client driver and it is
> + attached to the descriptor.
> +
> + .. code-block:: c
> +
> + int dmaengine_desc_attach_metadata(struct dma_async_tx_descriptor *desc,
> + void *data, size_t len);
> +
> + DESC_METADATA_ENGINE
> +
> + The metadata buffer is allocated/managed by the DMA driver. The client
> + driver can ask for the pointer, maximum size and the currently used size of
> + the metadata and can directly update or read it.
> +
> + .. code-block:: c
> +
> + void *dmaengine_desc_get_metadata_ptr(struct dma_async_tx_descriptor *desc,
> + size_t *payload_len, size_t *max_len);
> +
> + int dmaengine_desc_set_metadata_len(struct dma_async_tx_descriptor *desc,
> + size_t payload_len);
> +
> + Client drivers can query if a given mode is supported with:
> +
> + .. code-block:: c
> +
> + bool dmaengine_is_metadata_mode_supported(struct dma_chan *chan,
> + enum dma_desc_metadata_mode mode);
> +
> + Depending on the used mode client drivers must follow different flow.
> +
> + DESC_METADATA_CLIENT
> +
> + - DMA_MEM_TO_DEV / DEV_MEM_TO_MEM:
> + 1. prepare the descriptor (dmaengine_prep_*)
> + construct the metadata in the client's buffer
> + 2. use dmaengine_desc_attach_metadata() to attach the buffer to the
> + descriptor
> + 3. submit the transfer
> + - DMA_DEV_TO_MEM:
> + 1. prepare the descriptor (dmaengine_prep_*)
> + 2. use dmaengine_desc_attach_metadata() to attach the buffer to the
> + descriptor
> + 3. submit the transfer
> + 4. when the transfer is completed, the metadata should be available in the
> + attached buffer
> +
> + DESC_METADATA_ENGINE
> +
> + - DMA_MEM_TO_DEV / DEV_MEM_TO_MEM:
> + 1. prepare the descriptor (dmaengine_prep_*)
> + 2. use dmaengine_desc_get_metadata_ptr() to get the pointer to the
> + engine's metadata area
> + 3. update the metadata at the pointer
> + 4. use dmaengine_desc_set_metadata_len() to tell the DMA engine the
> + amount of data the client has placed into the metadata buffer
> + 5. submit the transfer
> + - DMA_DEV_TO_MEM:
> + 1. prepare the descriptor (dmaengine_prep_*)
> + 2. submit the transfer
> + 3. on transfer completion, use dmaengine_desc_get_metadata_ptr() to get the
> + pointer to the engine's metadata are
> + 4. Read out the metadate from the pointer
Lets put a note here that only one method should be used
> +
> 4. Submit the transaction
>
> Once the descriptor has been prepared and the callback information
> diff --git a/Documentation/driver-api/dmaengine/provider.rst b/Documentation/driver-api/dmaengine/provider.rst
> index dfc4486b5743..502c59f75302 100644
> --- a/Documentation/driver-api/dmaengine/provider.rst
> +++ b/Documentation/driver-api/dmaengine/provider.rst
> @@ -247,6 +247,52 @@ after each transfer. In case of a ring buffer, they may loop
> (DMA_CYCLIC). Addresses pointing to a device's register (e.g. a FIFO)
> are typically fixed.
>
> +Per descriptor metadata support
> +-------------------------------
> +Some data movement architecure (DMA controller and peripherals) uses metadata
typo architecure
> +associated with a transaction. The DMA controller role is to transfer the
> +payload and the metadata alongside.
> +The metadata itself is not used by the DMA engine itself, but it contains
> +parameters, keys, vectors, etc for peripheral or from the peripheral.
> +
> +The DMAengine framework provides a generic ways to facilitate the metadata for
> +descriptors. Depending on the architecture the DMA driver can implment either
implment
--
~Vinod
prev parent reply other threads:[~2018-09-11 7:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-30 12:19 [PATCH v2 0/2] dmaengine: Add per descriptor metadata support Peter Ujfalusi
2018-08-30 12:19 ` [PATCH v2 1/2] dmaengine: Add metadata_ops for dma_async_tx_descriptor Peter Ujfalusi
2018-09-11 7:33 ` Vinod
2018-09-11 12:33 ` Peter Ujfalusi
2018-08-30 12:19 ` [PATCH v2 2/2] dmaengine: doc: Add sections for per descriptor metadata support Peter Ujfalusi
2018-09-11 7:36 ` Vinod [this message]
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=20180911073627.GL2634@vkoul-mobl \
--to=vkoul@kernel.org \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.ujfalusi@ti.com \
--cc=radheys@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;
as well as URLs for NNTP newsgroup(s).