From: Jason Wang <jasowang@redhat.com>
To: mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
eperezma@redhat.com
Cc: virtualization@lists.linux.dev, hch@infradead.org,
Christoph Hellwig <hch@lst.de>
Subject: [PATCH V3 5/9] virtio_ring: rename dma_handle to map_handle
Date: Fri, 18 Jul 2025 10:37:54 +0800 [thread overview]
Message-ID: <20250718023758.36866-6-jasowang@redhat.com> (raw)
In-Reply-To: <20250718023758.36866-1-jasowang@redhat.com>
Following patch will introduce virtio map opreations which means the
address is not necessarily used for DMA. Let's rename the dma_handle
to map_handle first.
Reviewed-by: Christoph Hellwig <hch@lst.de>
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 55dd68e71509..26ce8a3d6927 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -306,18 +306,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,
void *map_token)
{
if (vring_use_map_api(vdev)) {
return dma_alloc_coherent(map_token, 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
@@ -330,7 +330,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;
}
@@ -340,11 +340,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,
void *map_token)
{
if (vring_use_map_api(vdev))
- dma_free_coherent(map_token, size, queue, dma_handle);
+ dma_free_coherent(map_token, size, queue, map_handle);
else
free_pages_exact(queue, PAGE_ALIGN(size));
}
--
2.42.0
next prev parent reply other threads:[~2025-07-18 2:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-18 2:37 [PATCH V3 0/9] Refine virtio mapping API Jason Wang
2025-07-18 2:37 ` [PATCH V3 1/9] virtio_ring: constify virtqueue pointer for DMA helpers Jason Wang
2025-07-18 8:46 ` Michael S. Tsirkin
2025-07-18 2:37 ` [PATCH V3 2/9] virtio_ring: switch to use dma_{map|unmap}_page() Jason Wang
2025-07-18 2:37 ` [PATCH V3 3/9] virtio: rename dma helpers Jason Wang
2025-07-18 2:37 ` [PATCH V3 4/9] virtio: rename dma_dev to map_token Jason Wang
2025-07-18 2:37 ` Jason Wang [this message]
2025-07-18 2:37 ` [PATCH V3 6/9] virtio: introduce map ops in virtio core Jason Wang
2025-07-18 2:37 ` [PATCH V3 7/9] vdpa: rename dma_dev to map_token Jason Wang
2025-07-18 2:37 ` [PATCH V3 8/9] vdpa: introduce map ops Jason Wang
2025-07-18 2:37 ` [PATCH V3 9/9] vduse: switch to use virtio map API instead of DMA API Jason Wang
2025-07-18 4:23 ` [PATCH V3 0/9] Refine virtio mapping API Jason Wang
2025-07-18 8:49 ` Michael S. Tsirkin
2025-07-18 8:53 ` Jason Wang
2025-07-18 8:54 ` Jason Wang
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=20250718023758.36866-6-jasowang@redhat.com \
--to=jasowang@redhat.com \
--cc=eperezma@redhat.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=mst@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