From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: xuanzhuo@linux.alibaba.com, eperezma@redhat.com,
virtualization@lists.linux.dev, hch@infradead.org,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH V4 7/9] vdpa: rename dma_dev to map_token
Date: Tue, 22 Jul 2025 10:02:35 -0400 [thread overview]
Message-ID: <20250722100213-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CACGkMEue4Wh3ocM2Pmn5E_nMzjHkJqd-MhYbPDY9pXdwMtqgXQ@mail.gmail.com>
On Fri, Jul 18, 2025 at 06:09:35PM +0800, Jason Wang wrote:
> On Fri, Jul 18, 2025 at 5:37 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Fri, Jul 18, 2025 at 05:16:14PM +0800, Jason Wang wrote:
> > > Virtio core switches from DMA device to mapping token, let's do that
> > > as well for vDPA.
> >
> > Pls switch to imperative mood.
> >
> > And add explanation about what is going on and why please.
>
> I think this has been explained in patch [PATCH V4 6/9] virtio:
> introduce map ops in virtio core?
>
> """
> For the device or transport that doesn't do DMA,
> they can implement their own mapping logic without the need to trick
> DMA core. In this case the map_token is opaque to the virtio core that
> will be passed back to the transport or device specific map
> operations. For other devices, DMA API will still be used, so map
> token will still be the dma device to minimize the changeset and
> performance impact.
> """
>
> >
> > At least, document what are the actual types stored here.
>
> It is opaque to the virtio core and will be used as a token to be
> passed back when the virtio core wants to map/unmap a buffer. So it
> doesn't have a type.
>
> > I checked and it looks like vduse actually returns struct device * here, too?
>
> It's just a token, vduse can return anything that can be used to
> identify an iova domain. For example, it can return a pointer to
> iova_domain which will also work. If you prefer to use iova domain, I
> can change to use that in the next version.
iova domain sounds better than void*.
> > So why do we need this, why lose all type safety?
>
> If you worry about the case that assumes map_token as dma device in
> virtio core. I can keep both map_token and dma_device and make the
> mutually exclusive, then:
>
> - when transport reports dma device, use DMA API
> - when transport reports map token, use map ops
>
> Does this work for you?
>
> Thanks
next prev parent reply other threads:[~2025-07-22 14:02 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-18 9:16 [PATCH V4 0/9] Refine virtio mapping API Jason Wang
2025-07-18 9:16 ` [PATCH V4 1/9] virtio_ring: constify virtqueue pointer for DMA helpers Jason Wang
2025-07-18 9:27 ` Michael S. Tsirkin
2025-07-18 9:28 ` Jason Wang
2025-07-18 9:39 ` Michael S. Tsirkin
2025-07-25 9:00 ` Xuan Zhuo
2025-07-28 10:44 ` Eugenio Perez Martin
2025-07-18 9:16 ` [PATCH V4 2/9] virtio_ring: switch to use dma_{map|unmap}_page() Jason Wang
2025-07-25 9:09 ` Xuan Zhuo
2025-07-28 3:25 ` Jason Wang
2025-07-18 9:16 ` [PATCH V4 3/9] virtio: rename dma helpers Jason Wang
2025-07-25 9:10 ` Xuan Zhuo
2025-07-18 9:16 ` [PATCH V4 4/9] virtio: rename dma_dev to map_token Jason Wang
2025-07-18 9:16 ` [PATCH V4 5/9] virtio_ring: rename dma_handle to map_handle Jason Wang
2025-07-25 9:11 ` Xuan Zhuo
2025-07-18 9:16 ` [PATCH V4 6/9] virtio: introduce map ops in virtio core Jason Wang
2025-07-25 9:13 ` Xuan Zhuo
2025-07-28 3:28 ` Jason Wang
2025-07-18 9:16 ` [PATCH V4 7/9] vdpa: rename dma_dev to map_token Jason Wang
2025-07-18 9:24 ` Zhu Lingshan
2025-07-18 9:37 ` Michael S. Tsirkin
2025-07-18 10:09 ` Jason Wang
2025-07-21 8:05 ` Jason Wang
2025-07-22 17:26 ` Michael S. Tsirkin
2025-07-23 5:54 ` Jason Wang
2025-07-23 6:29 ` Michael S. Tsirkin
2025-07-22 14:01 ` Michael S. Tsirkin
2025-07-22 14:02 ` Michael S. Tsirkin [this message]
2025-07-18 9:16 ` [PATCH V4 8/9] vdpa: introduce map ops Jason Wang
2025-07-18 9:16 ` [PATCH V4 9/9] vduse: switch to use virtio map API instead of DMA API Jason Wang
2025-07-18 9:41 ` Michael S. Tsirkin
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=20250722100213-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=eperezma@redhat.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=jasowang@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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