Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alistair Popple" <apopple@nvidia.com>,
	dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org, linux-rdma@vger.kernel.org,
	linux-nvme@lists.infradead.org
Cc: media-ci@linuxtv.org
Subject: Re: [PATCH v3 23/24] dma-buf: Add dma_buf_mapping_map() returning a type-tagged mapping and implement it for sgt
Date: Sat, 21 Nov 2026 05:58:48 +0000	[thread overview]
Message-ID: <sashiko-outbox-226691@kernel.org> (raw)
In-Reply-To: <20261120-dma_mapping_type_v4-v3-23-c0183a409bdf@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dma-buf: wrong dma_buf_attach_map_type() doc on
  dma_buf_mapping_type.unmap
--

commit bd9afecc501b0a6674a8f68fd07c287949304430
Author: Alistair Popple <apopple@nvidia.com>

dma-buf: Add dma_buf_mapping_map() returning a type-tagged mapping and implement it for sgt

This commit adds generic dma_buf_mapping_map() and dma_buf_mapping_unmap()
entry points that select a mapping type and dispatch through its callbacks,
and converts dma_buf_map_sgt() and dma_buf_unmap_sgt() to use them.

> diff --git a/include/linux/dma-buf-mapping.h b/include/linux/dma-buf-mapping.h
> index 0a1c2934a932a..98d5765cfdba9 100644
> --- a/include/linux/dma-buf-mapping.h
> +++ b/include/linux/dma-buf-mapping.h
> @@ -82,6 +82,32 @@ struct dma_buf_mapping_type {
>  	 */
>  	void (*debugfs_dump)(struct seq_file *s,
>  			     struct dma_buf_attachment *attach);
> +
> +	/**
> +	 * @map:
> +	 *
> +	 * Produce a mapping of this type for @attach, for which this type has
> +	 * already been selected. Called by dma_buf_mapping_map() with the
> +	 * dma_resv lock held. The result embeds &struct dma_buf_mapping, which
> +	 * the core fills in once this returns. A map that may unmap its result
> +	 * on its own unwind must record the entry in it first, since every
> +	 * unmap reads it. Responsible for pin-on-map of static importers if
> +	 * the type supports them.
> +	 */
> +	struct dma_buf_mapping *(*map)(struct dma_buf_attachment *attach,
> +				       enum dma_data_direction dir);
> +
> +	/**
> +	 * @unmap:
> +	 *
> +	 * Release a mapping returned by @map. Called by dma_buf_mapping_unmap()
> +	 * with the dma_resv lock held and with dma_buf_attach_map_type()
> +	 * naming the entry the mapping was made with, which need not be the
> +	 * attachment's current selection.
> +	 */
> +	void (*unmap)(struct dma_buf_attachment *attach,
> +		      struct dma_buf_mapping *mapping,
> +		      enum dma_data_direction dir);
>  };

[Severity: Low]
Should this @unmap comment refer to mapping->match rather than
dma_buf_attach_map_type()?

dma_buf_attach_map_type() returns &attach->matches[attach->selected_idx],
and dma_buf_mapping_unmap() calls match->type->unmap() without changing
attach->selected_idx, so dma_buf_attach_map_type() still returns the
attachment's current selection while mapping->match holds the entry the
mapping was made with.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-dma_mapping_type_v4-v3-0-c0183a409bdf@nvidia.com?part=23


  parent reply	other threads:[~2026-11-21  5:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261120-dma_mapping_type_v4-v3-0-c0183a409bdf@nvidia.com>
     [not found] ` <20261120-dma_mapping_type_v4-v3-13-c0183a409bdf@nvidia.com>
2026-11-21  5:58   ` [PATCH v3 13/24] udmabuf: Convert to the SGT mapping type sashiko-bot
     [not found] ` <20261120-dma_mapping_type_v4-v3-23-c0183a409bdf@nvidia.com>
2026-11-21  5:58   ` sashiko-bot [this message]
     [not found] ` <20261120-dma_mapping_type_v4-v3-24-c0183a409bdf@nvidia.com>
2026-11-21  5:58   ` [PATCH v3 24/24] dma-buf: Add kunit tests for mapping type selection sashiko-bot

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=sashiko-outbox-226691@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=apopple@nvidia.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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