From: Bagas Sanjaya <bagasdotme@gmail.com>
To: Petr Tesarik <ptesarik@suse.com>,
Jonathan Corbet <corbet@lwn.net>,
Morton <akpm@linux-foundation.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
Leon Romanovsky <leon@kernel.org>,
Keith Busch <kbusch@kernel.org>,
Caleb Sander Mateos <csander@purestorage.com>,
Sagi Grimberg <sagi@grimberg.me>, Jens Axboe <axboe@kernel.dk>,
John Garry <john.g.garry@oracle.com>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>
Subject: Re: [PATCH 8/8] docs: dma-api: clean up documentation of dma_map_sg()
Date: Thu, 26 Jun 2025 08:50:09 +0700 [thread overview]
Message-ID: <aFynUS7nVnlhvlv8@archie.me> (raw)
In-Reply-To: <20250624133923.1140421-9-ptesarik@suse.com>
[-- Attachment #1: Type: text/plain, Size: 2011 bytes --]
On Tue, Jun 24, 2025 at 03:39:23PM +0200, Petr Tesarik wrote:
> diff --git a/Documentation/core-api/dma-api.rst b/Documentation/core-api/dma-api.rst
> index 65132ec88104..f5aadb7f8626 100644
> --- a/Documentation/core-api/dma-api.rst
> +++ b/Documentation/core-api/dma-api.rst
> @@ -308,10 +308,10 @@ action (e.g. reduce current DMA mapping usage or delay and try again later).
> dma_map_sg(struct device *dev, struct scatterlist *sg,
> int nents, enum dma_data_direction direction)
>
> -Returns: the number of DMA address segments mapped (this may be shorter
> -than <nents> passed in if some elements of the scatter/gather list are
> -physically or virtually adjacent and an IOMMU maps them with a single
> -entry).
> +Maps a scatter/gather list for DMA. Returns the number of DMA address segments
> +mapped, which may be smaller than <nents> passed in if several consecutive
> +sglist entries are merged (e.g. with an IOMMU, or if some adjacent segments
> +just happen to be physically contiguous).
>
> Please note that the sg cannot be mapped again if it has been mapped once.
> The mapping process is allowed to destroy information in the sg.
> @@ -335,9 +335,8 @@ With scatterlists, you use the resulting mapping like this::
> where nents is the number of entries in the sglist.
>
> The implementation is free to merge several consecutive sglist entries
> -into one (e.g. with an IOMMU, or if several pages just happen to be
> -physically contiguous) and returns the actual number of sg entries it
> -mapped them to. On failure 0, is returned.
> +into one. The returned number is the actual number of sg entries it
> +mapped them to. On failure, 0 is returned.
>
> Then you should loop count times (note: this can be less than nents times)
> and use sg_dma_address() and sg_dma_len() macros where you previously
Looks good, thanks!
Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
--
An old man doll... just what I always wanted! - Clara
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2025-06-26 1:50 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-24 13:39 [PATCH 0/8] update DMA API documentation Petr Tesarik
2025-06-24 13:39 ` [PATCH 1/8] docs: dma-api: use "DMA API" consistently throughout the document Petr Tesarik
2025-06-25 2:41 ` Randy Dunlap
2025-06-24 13:39 ` [PATCH 2/8] docs: dma-api: replace consistent with coherent Petr Tesarik
2025-06-26 4:51 ` Petr Tesarik
2025-06-26 7:21 ` Marek Szyprowski
2025-06-24 13:39 ` [PATCH 3/8] docs: dma-api: remove remnants of PCI DMA API Petr Tesarik
2025-06-26 1:46 ` Bagas Sanjaya
2025-06-24 13:39 ` [PATCH 4/8] docs: dma-api: add a kernel-doc comment for dma_pool_zalloc() Petr Tesarik
2025-06-24 13:39 ` [PATCH 5/8] docs: dma-api: remove duplicate description of the DMA pool API Petr Tesarik
2025-06-25 2:40 ` Randy Dunlap
2025-06-25 6:41 ` Petr Tesarik
2025-06-24 13:39 ` [PATCH 6/8] docs: dma-api: clarify DMA addressing limitations Petr Tesarik
2025-06-26 1:47 ` Bagas Sanjaya
2025-06-24 13:39 ` [PATCH 7/8] docs: dma-api: update streaming DMA API physical address constraints Petr Tesarik
2025-06-26 1:49 ` Bagas Sanjaya
2025-06-26 5:06 ` Petr Tesarik
2025-06-26 7:09 ` Marek Szyprowski
2025-06-26 8:25 ` Petr Tesarik
2025-06-26 9:58 ` Robin Murphy
2025-06-26 13:48 ` Petr Tesarik
2025-06-26 16:45 ` Robin Murphy
2025-06-26 19:40 ` Petr Tesarik
2025-06-27 11:07 ` Robin Murphy
2025-06-27 11:32 ` Petr Tesarik
2025-06-27 12:55 ` Christoph Hellwig
2025-06-27 13:02 ` Petr Tesarik
2025-06-27 12:52 ` Christoph Hellwig
2025-06-24 13:39 ` [PATCH 8/8] docs: dma-api: clean up documentation of dma_map_sg() Petr Tesarik
2025-06-26 1:50 ` Bagas Sanjaya [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=aFynUS7nVnlhvlv8@archie.me \
--to=bagasdotme@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=corbet@lwn.net \
--cc=csander@purestorage.com \
--cc=john.g.garry@oracle.com \
--cc=kbusch@kernel.org \
--cc=leon@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--cc=ptesarik@suse.com \
--cc=sagi@grimberg.me \
/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).