Skip to content

Commit 6234f80

Browse files
jasowangmstsirkin
authored andcommitted
vhost: vdpa: remove per device feature whitelist
We used to have a per device feature whitelist to filter out the unsupported virtio features. But this seems unnecessary since: - the main idea behind feature whitelist is to block control vq feature until we finalize the control virtqueue API. But the current vhost-vDPA uAPI is sufficient to support control virtqueue. For device that has hardware control virtqueue, the vDPA device driver can just setup the hardware virtqueue and let userspace to use hardware virtqueue directly. For device that doesn't have a control virtqueue, the vDPA device driver need to use e.g vringh to emulate a software control virtqueue. - we don't do it in virtio-vDPA driver So remove this limitation. Signed-off-by: Jason Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 481a0d7 commit 6234f80

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

drivers/vhost/vdpa.c

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,6 @@
2626

2727
#include "vhost.h"
2828

29-
enum {
30-
VHOST_VDPA_FEATURES =
31-
(1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) |
32-
(1ULL << VIRTIO_F_ANY_LAYOUT) |
33-
(1ULL << VIRTIO_F_VERSION_1) |
34-
(1ULL << VIRTIO_F_ACCESS_PLATFORM) |
35-
(1ULL << VIRTIO_F_RING_PACKED) |
36-
(1ULL << VIRTIO_F_ORDER_PLATFORM) |
37-
(1ULL << VIRTIO_RING_F_INDIRECT_DESC) |
38-
(1ULL << VIRTIO_RING_F_EVENT_IDX),
39-
40-
VHOST_VDPA_NET_FEATURES = VHOST_VDPA_FEATURES |
41-
(1ULL << VIRTIO_NET_F_CSUM) |
42-
(1ULL << VIRTIO_NET_F_GUEST_CSUM) |
43-
(1ULL << VIRTIO_NET_F_MTU) |
44-
(1ULL << VIRTIO_NET_F_MAC) |
45-
(1ULL << VIRTIO_NET_F_GUEST_TSO4) |
46-
(1ULL << VIRTIO_NET_F_GUEST_TSO6) |
47-
(1ULL << VIRTIO_NET_F_GUEST_ECN) |
48-
(1ULL << VIRTIO_NET_F_GUEST_UFO) |
49-
(1ULL << VIRTIO_NET_F_HOST_TSO4) |
50-
(1ULL << VIRTIO_NET_F_HOST_TSO6) |
51-
(1ULL << VIRTIO_NET_F_HOST_ECN) |
52-
(1ULL << VIRTIO_NET_F_HOST_UFO) |
53-
(1ULL << VIRTIO_NET_F_MRG_RXBUF) |
54-
(1ULL << VIRTIO_NET_F_STATUS) |
55-
(1ULL << VIRTIO_NET_F_SPEED_DUPLEX),
56-
};
57-
5829
/* Currently, only network backend w/o multiqueue is supported. */
5930
#define VHOST_VDPA_VQ_MAX 2
6031

@@ -79,10 +50,6 @@ static DEFINE_IDA(vhost_vdpa_ida);
7950

8051
static dev_t vhost_vdpa_major;
8152

82-
static const u64 vhost_vdpa_features[] = {
83-
[VIRTIO_ID_NET] = VHOST_VDPA_NET_FEATURES,
84-
};
85-
8653
static void handle_vq_kick(struct vhost_work *work)
8754
{
8855
struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue,
@@ -253,7 +220,6 @@ static long vhost_vdpa_get_features(struct vhost_vdpa *v, u64 __user *featurep)
253220
u64 features;
254221

255222
features = ops->get_features(vdpa);
256-
features &= vhost_vdpa_features[v->virtio_id];
257223

258224
if (copy_to_user(featurep, &features, sizeof(features)))
259225
return -EFAULT;
@@ -277,9 +243,6 @@ static long vhost_vdpa_set_features(struct vhost_vdpa *v, u64 __user *featurep)
277243
if (copy_from_user(&features, featurep, sizeof(features)))
278244
return -EFAULT;
279245

280-
if (features & ~vhost_vdpa_features[v->virtio_id])
281-
return -EINVAL;
282-
283246
if (vdpa_set_features(vdpa, features))
284247
return -EINVAL;
285248

0 commit comments

Comments
 (0)