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, linux-kernel@vger.kernel.org,
hch@infradead.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH V5 5/9] virtio_ring: rename dma_handle to map_handle
Date: Sun, 21 Sep 2025 16:54:15 -0400 [thread overview]
Message-ID: <20250921165408-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20250813054831.25865-6-jasowang@redhat.com>
On Wed, Aug 13, 2025 at 01:48:27PM +0800, Jason Wang wrote:
> Following patch will introduce virtio map opreations which means the
operations
> address is not necessarily used for DMA. Let's rename the dma_handle
> to map_handle first.
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/virtio/virtio_ring.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index fb1d407d5f1b..94b2a8f3acc2 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -305,18 +305,18 @@ size_t virtio_max_dma_size(const struct virtio_device *vdev)
> EXPORT_SYMBOL_GPL(virtio_max_dma_size);
>
> static void *vring_alloc_queue(struct virtio_device *vdev, size_t size,
> - dma_addr_t *dma_handle, gfp_t flag,
> + dma_addr_t *map_handle, gfp_t flag,
> union vring_mapping_token *mapping_token)
> {
> if (vring_use_map_api(vdev)) {
> return dma_alloc_coherent(mapping_token->dma_dev, size,
> - dma_handle, flag);
> + map_handle, flag);
> } else {
> void *queue = alloc_pages_exact(PAGE_ALIGN(size), flag);
>
> if (queue) {
> phys_addr_t phys_addr = virt_to_phys(queue);
> - *dma_handle = (dma_addr_t)phys_addr;
> + *map_handle = (dma_addr_t)phys_addr;
>
> /*
> * Sanity check: make sure we dind't truncate
> @@ -329,7 +329,7 @@ static void *vring_alloc_queue(struct virtio_device *vdev, size_t size,
> * warning and abort if we end up with an
> * unrepresentable address.
> */
> - if (WARN_ON_ONCE(*dma_handle != phys_addr)) {
> + if (WARN_ON_ONCE(*map_handle != phys_addr)) {
> free_pages_exact(queue, PAGE_ALIGN(size));
> return NULL;
> }
> @@ -339,11 +339,11 @@ static void *vring_alloc_queue(struct virtio_device *vdev, size_t size,
> }
>
> static void vring_free_queue(struct virtio_device *vdev, size_t size,
> - void *queue, dma_addr_t dma_handle,
> + void *queue, dma_addr_t map_handle,
> union vring_mapping_token *mapping_token)
> {
> if (vring_use_map_api(vdev))
> - dma_free_coherent(mapping_token->dma_dev, size, queue, dma_handle);
> + dma_free_coherent(mapping_token->dma_dev, size, queue, map_handle);
> else
> free_pages_exact(queue, PAGE_ALIGN(size));
> }
> --
> 2.31.1
next prev parent reply other threads:[~2025-09-21 20:54 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 5:48 [PATCH V5 0/9] Refine virtio mapping API Jason Wang
2025-08-13 5:48 ` [PATCH V5 1/9] virtio_ring: constify virtqueue pointer for DMA helpers Jason Wang
2025-08-13 7:14 ` Eugenio Perez Martin
2025-09-21 20:55 ` Michael S. Tsirkin
2025-09-21 21:42 ` Michael S. Tsirkin
2025-08-13 5:48 ` [PATCH V5 2/9] virtio_ring: switch to use dma_{map|unmap}_page() Jason Wang
2025-08-13 7:15 ` Eugenio Perez Martin
2025-08-13 5:48 ` [PATCH V5 3/9] virtio: rename dma helpers Jason Wang
2025-08-13 7:16 ` Eugenio Perez Martin
2025-08-13 5:48 ` [PATCH V5 4/9] virtio: introduce vring_mapping_token Jason Wang
2025-08-13 7:46 ` Eugenio Perez Martin
2025-08-13 8:55 ` Michael S. Tsirkin
2025-08-13 9:13 ` Eugenio Perez Martin
2025-08-14 3:39 ` Jason Wang
2025-08-14 3:36 ` Jason Wang
2025-08-14 10:42 ` Michael S. Tsirkin
2025-08-15 1:02 ` Jason Wang
2025-08-15 10:04 ` Michael S. Tsirkin
2025-08-18 9:09 ` Eugenio Perez Martin
2025-08-18 12:02 ` Michael S. Tsirkin
2025-08-13 8:58 ` Michael S. Tsirkin
2025-08-14 3:37 ` Jason Wang
2025-08-13 5:48 ` [PATCH V5 5/9] virtio_ring: rename dma_handle to map_handle Jason Wang
2025-08-13 7:47 ` Eugenio Perez Martin
2025-09-21 20:54 ` Michael S. Tsirkin [this message]
2025-09-21 21:41 ` Michael S. Tsirkin
2025-08-13 5:48 ` [PATCH V5 6/9] virtio: introduce map ops in virtio core Jason Wang
2025-08-13 8:40 ` Eugenio Perez Martin
2025-08-13 5:48 ` [PATCH V5 7/9] vdpa: support mapping token Jason Wang
2025-08-13 8:45 ` Eugenio Perez Martin
2025-08-13 5:48 ` [PATCH V5 8/9] vdpa: introduce map ops Jason Wang
2025-08-13 8:46 ` Eugenio Perez Martin
2025-08-13 5:48 ` [PATCH V5 9/9] vduse: switch to use virtio map API instead of DMA API Jason Wang
2025-08-13 9:02 ` Eugenio Perez Martin
2025-08-14 3:33 ` Jason Wang
2025-08-14 6:42 ` Eugenio Perez Martin
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=20250921165408-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=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).