diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2021-09-21 18:16:42 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2021-10-05 17:30:57 -0400 |
commit | 46ce017167d800c5d96104a88cfaed9949c4a3b6 (patch) | |
tree | 5bedeb120bd36db6d4a98cf1435eff101c34f5b1 /hw/virtio/vhost-vsock.c | |
parent | d6a9378f47515c6d70dbff4912c5740c98709880 (diff) |
vhost-vsock: handle common features in vhost-vsock-common
virtio-vsock features, like VIRTIO_VSOCK_F_SEQPACKET, can be handled
by vhost-vsock-common parent class. In this way, we can reuse the
same code for all virtio-vsock backends (i.e. vhost-vsock,
vhost-user-vsock).
Let's move `seqpacket` property to vhost-vsock-common class, add
vhost_vsock_common_get_features() used by children, and disable
`seqpacket` for vhost-user-vsock device for machine types < 6.2.
The behavior of vhost-vsock device doesn't change; vhost-user-vsock
device now supports `seqpacket` property.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20210921161642.206461-3-sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio/vhost-vsock.c')
-rw-r--r-- | hw/virtio/vhost-vsock.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c index dade0da031..478c0c9a87 100644 --- a/hw/virtio/vhost-vsock.c +++ b/hw/virtio/vhost-vsock.c @@ -21,11 +21,6 @@ #include "hw/virtio/vhost-vsock.h" #include "monitor/monitor.h" -const int feature_bits[] = { - VIRTIO_VSOCK_F_SEQPACKET, - VHOST_INVALID_FEATURE_BIT -}; - static void vhost_vsock_get_config(VirtIODevice *vdev, uint8_t *config) { VHostVSock *vsock = VHOST_VSOCK(vdev); @@ -113,22 +108,7 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev, uint64_t requested_features, Error **errp) { - VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev); - VHostVSock *vsock = VHOST_VSOCK(vdev); - - if (vsock->seqpacket != ON_OFF_AUTO_OFF) { - virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET); - } - - requested_features = vhost_get_features(&vvc->vhost_dev, feature_bits, - requested_features); - - if (vsock->seqpacket == ON_OFF_AUTO_ON && - !virtio_has_feature(requested_features, VIRTIO_VSOCK_F_SEQPACKET)) { - error_setg(errp, "vhost-vsock backend doesn't support seqpacket"); - } - - return requested_features; + return vhost_vsock_common_get_features(vdev, requested_features, errp); } static const VMStateDescription vmstate_virtio_vhost_vsock = { @@ -229,8 +209,6 @@ static void vhost_vsock_device_unrealize(DeviceState *dev) static Property vhost_vsock_properties[] = { DEFINE_PROP_UINT64("guest-cid", VHostVSock, conf.guest_cid, 0), DEFINE_PROP_STRING("vhostfd", VHostVSock, conf.vhostfd), - DEFINE_PROP_ON_OFF_AUTO("seqpacket", VHostVSock, seqpacket, - ON_OFF_AUTO_AUTO), DEFINE_PROP_END_OF_LIST(), }; |