From: Jason Wang <jasowang@redhat.com>
To: mst@redhat.com, jasowang@redhat.com
Cc: elic@nvidia.com, gdawar@amd.com,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, tanuj.kamde@amd.com
Subject: [PATCH 3/5] virtio-vdpa: support per vq dma device
Date: Wed, 11 Jan 2023 14:28:07 +0800 [thread overview]
Message-ID: <20230111062809.25020-4-jasowang@redhat.com> (raw)
In-Reply-To: <20230111062809.25020-1-jasowang@redhat.com>
This patch adds the support of per vq dma device for virito-vDPA. vDPA
parents then are allowed to use different DMA devices. This is useful
for the parents that have software or emulated virtqueues.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/virtio/virtio_vdpa.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
index 9670cc79371d..d7f5af62ddaa 100644
--- a/drivers/virtio/virtio_vdpa.c
+++ b/drivers/virtio/virtio_vdpa.c
@@ -135,6 +135,7 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
{
struct virtio_vdpa_device *vd_dev = to_virtio_vdpa_device(vdev);
struct vdpa_device *vdpa = vd_get_vdpa(vdev);
+ struct device *dma_dev;
const struct vdpa_config_ops *ops = vdpa->config;
struct virtio_vdpa_vq_info *info;
struct vdpa_callback cb;
@@ -175,9 +176,15 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
/* Create the vring */
align = ops->get_vq_align(vdpa);
- vq = vring_create_virtqueue(index, max_num, align, vdev,
- true, may_reduce_num, ctx,
- virtio_vdpa_notify, callback, name);
+
+ if (ops->get_vq_dma_dev)
+ dma_dev = ops->get_vq_dma_dev(vdpa, index);
+ else
+ dma_dev = vdpa_get_dma_dev(vdpa);
+ vq = vring_create_virtqueue_dma(index, max_num, align, vdev,
+ true, may_reduce_num, ctx,
+ virtio_vdpa_notify, callback,
+ name, dma_dev);
if (!vq) {
err = -ENOMEM;
goto error_new_virtqueue;
--
2.25.1
next prev parent reply other threads:[~2023-01-11 6:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-11 6:28 [PATCH 0/5] virtio_ring: per virtqueue DMA device Jason Wang
2023-01-11 6:28 ` [PATCH 1/5] virtio_ring: per virtqueue dma device Jason Wang
2023-01-11 13:32 ` Eli Cohen
2023-01-11 13:52 ` Michael S. Tsirkin
2023-01-11 14:46 ` Eli Cohen
2023-01-11 14:54 ` Michael S. Tsirkin
2023-01-11 14:58 ` Eli Cohen
2023-01-11 16:26 ` Michael S. Tsirkin
2023-01-15 11:05 ` Eli Cohen
2023-01-11 6:28 ` [PATCH 2/5] vdpa: introduce get_vq_dma_device() Jason Wang
2023-01-15 11:06 ` Eli Cohen
2023-01-11 6:28 ` Jason Wang [this message]
2023-01-15 11:06 ` [PATCH 3/5] virtio-vdpa: support per vq dma device Eli Cohen
2023-01-11 6:28 ` [PATCH 4/5] vdpa: set dma mask for vDPA device Jason Wang
2023-01-15 11:07 ` Eli Cohen
2023-01-11 6:28 ` [PATCH 5/5] vdpa: mlx5: support per virtqueue dma device Jason Wang
2023-01-11 12:38 ` kernel test robot
2023-01-12 2:07 ` kernel test robot
2023-01-15 11:08 ` Eli Cohen
2023-01-16 2:49 ` Jason Wang
2023-01-11 13:33 ` [PATCH 0/5] virtio_ring: per virtqueue DMA device Eli Cohen
2023-01-12 4:03 ` 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=20230111062809.25020-4-jasowang@redhat.com \
--to=jasowang@redhat.com \
--cc=elic@nvidia.com \
--cc=gdawar@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=tanuj.kamde@amd.com \
--cc=virtualization@lists.linux-foundation.org \
/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
all inboxes | Powered by JetHome®