netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vhost-vdpa: filter VIRTIO_F_RING_PACKED feature
@ 2023-06-05 11:06 Stefano Garzarella
  2023-06-05 12:41 ` Michael S. Tsirkin
  2023-06-22 11:37 ` Michael S. Tsirkin
  0 siblings, 2 replies; 31+ messages in thread
From: Stefano Garzarella @ 2023-06-05 11:06 UTC (permalink / raw)
  To: virtualization
  Cc: netdev, Jason Wang, Eugenio Pérez, Tiwei Bie, kvm,
	Michael S. Tsirkin, linux-kernel

vhost-vdpa IOCTLs (eg. VHOST_GET_VRING_BASE, VHOST_SET_VRING_BASE)
don't support packed virtqueue well yet, so let's filter the
VIRTIO_F_RING_PACKED feature for now in vhost_vdpa_get_features().

This way, even if the device supports it, we don't risk it being
negotiated, then the VMM is unable to set the vring state properly.

Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend")
Cc: stable@vger.kernel.org
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---

Notes:
    This patch should be applied before the "[PATCH v2 0/3] vhost_vdpa:
    better PACKED support" series [1] and backported in stable branches.
    
    We can revert it when we are sure that everything is working with
    packed virtqueues.
    
    Thanks,
    Stefano
    
    [1] https://lore.kernel.org/virtualization/20230424225031.18947-1-shannon.nelson@amd.com/

 drivers/vhost/vdpa.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 8c1aefc865f0..ac2152135b23 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -397,6 +397,12 @@ static long vhost_vdpa_get_features(struct vhost_vdpa *v, u64 __user *featurep)
 
 	features = ops->get_device_features(vdpa);
 
+	/*
+	 * IOCTLs (eg. VHOST_GET_VRING_BASE, VHOST_SET_VRING_BASE) don't support
+	 * packed virtqueue well yet, so let's filter the feature for now.
+	 */
+	features &= ~BIT_ULL(VIRTIO_F_RING_PACKED);
+
 	if (copy_to_user(featurep, &features, sizeof(features)))
 		return -EFAULT;
 

base-commit: 9561de3a55bed6bdd44a12820ba81ec416e705a7
-- 
2.40.1


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

end of thread, other threads:[~2023-06-22 12:28 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05 11:06 [PATCH] vhost-vdpa: filter VIRTIO_F_RING_PACKED feature Stefano Garzarella
2023-06-05 12:41 ` Michael S. Tsirkin
2023-06-05 12:54   ` Stefano Garzarella
2023-06-05 13:00     ` Michael S. Tsirkin
2023-06-05 13:30       ` Stefano Garzarella
2023-06-05 13:54         ` Michael S. Tsirkin
2023-06-05 14:56           ` Stefano Garzarella
2023-06-05 21:44             ` Michael S. Tsirkin
2023-06-06 10:09               ` Stefano Garzarella
2023-06-07 20:52                 ` Michael S. Tsirkin
2023-06-06  1:29             ` Jason Wang
2023-06-06 10:18               ` Stefano Garzarella
2023-06-06 12:58               ` Michael S. Tsirkin
2023-06-07  8:39                 ` Stefano Garzarella
2023-06-07  9:43                   ` Michael S. Tsirkin
2023-06-08  0:42                     ` Jason Wang
2023-06-08  6:03                       ` Michael S. Tsirkin
2023-06-08  7:46                         ` Jason Wang
2023-06-08  7:59                           ` Stefano Garzarella
2023-06-08  9:00                             ` Jason Wang
2023-06-08  9:21                               ` Stefano Garzarella
2023-06-08  9:29                                 ` Jason Wang
2023-06-08  9:47                                   ` Stefano Garzarella
2023-06-08 14:23                                   ` Michael S. Tsirkin
2023-06-09  2:16                                     ` Jason Wang
2023-06-09  7:17                                       ` Michael S. Tsirkin
2023-06-09  7:37                                     ` Stefano Garzarella
2023-06-08 13:46                               ` Michael S. Tsirkin
2023-06-08 13:43                           ` Michael S. Tsirkin
2023-06-22 11:37 ` Michael S. Tsirkin
2023-06-22 12:28   ` Stefano Garzarella

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