qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vdpa: Support setting vring_base for packed svq
@ 2024-11-04 16:21 Sahil Siddiq
  2024-11-05  9:36 ` Stefano Garzarella
  2024-11-14  6:58 ` Michael S. Tsirkin
  0 siblings, 2 replies; 8+ messages in thread
From: Sahil Siddiq @ 2024-11-04 16:21 UTC (permalink / raw)
  To: eperezma, sgarzare, mst; +Cc: qemu-devel, Sahil Siddiq

Linux commit v5.14-rc1~30^2~8 enabled the vp_vdpa driver to set the
vq state to the device's initial state. This works differently for
split and packed vqs.

With shadow virtqueues enabled, vhost-vdpa sets the vring base using
the VHOST_SET_VRING_BASE ioctl. The payload (vhost_vring_state)
differs for split and packed vqs. The implementation in QEMU currently
uses the payload required for split vqs (i.e., the num field of
vhost_vring_state is set to 0). The kernel throws EOPNOTSUPP when this
payload is used with packed vqs.

This patch sets the num field in the payload appropriately so vhost-vdpa
(with the vp_vdpa driver) can use packed svqs.

Link: https://lists.nongnu.org/archive/html/qemu-devel/2024-10/msg05106.html
Link: https://lore.kernel.org/r/20210602021536.39525-4-jasowang@redhat.com
Signed-off-by: Sahil Siddiq <sahilcdq@proton.me>
---
QEMU currently does not support packed vhost shadow virtqueues. I am
working on adding support for packed svqs [1]. The test environment
that I am using [2] requires vhost-vdpa to use the relevant payload
when setting vring base.

[1] https://wiki.qemu.org/Internships/ProjectIdeas/PackedShadowVirtqueue
[2] https://www.redhat.com/en/blog/hands-vdpa-what-do-you-do-when-you-aint-got-hardware-part-2

 hw/virtio/vhost-vdpa.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 3cdaa12ed5..5f81945109 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -1230,6 +1230,10 @@ static bool vhost_vdpa_svq_setup(struct vhost_dev *dev,
     };
     int r;
 
+    if (virtio_vdev_has_feature(dev->vdev, VIRTIO_F_RING_PACKED)) {
+        s.num = 0x80008000;
+    }
+
     r = vhost_vdpa_set_dev_vring_base(dev, &s);
     if (unlikely(r)) {
         error_setg_errno(errp, -r, "Cannot set vring base");
-- 
2.47.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-11-16 13:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-04 16:21 [PATCH] vdpa: Support setting vring_base for packed svq Sahil Siddiq
2024-11-05  9:36 ` Stefano Garzarella
2024-11-05 14:54   ` Sahil Siddiq
2024-11-06 14:33     ` Stefano Garzarella
2024-11-06 15:00       ` Eugenio Perez Martin
2024-11-08  6:59         ` Sahil Siddiq
2024-11-14  6:58 ` Michael S. Tsirkin
2024-11-16 13:04   ` Sahil Siddiq

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).