mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 11:39:53 +00:00
vhost: mask VIRTIO_F_RING_RESET for vhost and vhost-user devices
Commit69e1c14aa2
("virtio: core: vq reset feature negotation support") enabled VIRTIO_F_RING_RESET by default for all virtio devices. This feature is not currently emulated by QEMU, so for vhost and vhost-user devices we need to make sure it is supported by the offloaded device emulation (in-kernel or in another process). To do this we need to add VIRTIO_F_RING_RESET to the features bitmap passed to vhost_get_features(). This way it will be masked if the device does not support it. This issue was initially discovered with vhost-vsock and vhost-user-vsock, and then also tested with vhost-user-rng which confirmed the same issue. They fail when sending features through VHOST_SET_FEATURES ioctl or VHOST_USER_SET_FEATURES message, since VIRTIO_F_RING_RESET is negotiated by the guest (Linux >= v6.0), but not supported by the device. Fixes:69e1c14aa2
("virtio: core: vq reset feature negotation support") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1318 Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20221121101101.29400-1-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Acked-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Acked-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
2c8311241d
commit
562a7d23bf
@ -52,6 +52,7 @@ static const int user_feature_bits[] = {
|
||||
VIRTIO_F_NOTIFY_ON_EMPTY,
|
||||
VIRTIO_F_RING_PACKED,
|
||||
VIRTIO_F_IOMMU_PLATFORM,
|
||||
VIRTIO_F_RING_RESET,
|
||||
VHOST_INVALID_FEATURE_BIT
|
||||
};
|
||||
|
||||
|
@ -75,6 +75,7 @@ static const int user_feature_bits[] = {
|
||||
VIRTIO_NET_F_MTU,
|
||||
VIRTIO_F_IOMMU_PLATFORM,
|
||||
VIRTIO_F_RING_PACKED,
|
||||
VIRTIO_F_RING_RESET,
|
||||
VIRTIO_NET_F_RSS,
|
||||
VIRTIO_NET_F_HASH_REPORT,
|
||||
|
||||
|
@ -38,6 +38,7 @@ static const int kernel_feature_bits[] = {
|
||||
VIRTIO_RING_F_INDIRECT_DESC,
|
||||
VIRTIO_RING_F_EVENT_IDX,
|
||||
VIRTIO_SCSI_F_HOTPLUG,
|
||||
VIRTIO_F_RING_RESET,
|
||||
VHOST_INVALID_FEATURE_BIT
|
||||
};
|
||||
|
||||
|
@ -36,6 +36,7 @@ static const int user_feature_bits[] = {
|
||||
VIRTIO_RING_F_INDIRECT_DESC,
|
||||
VIRTIO_RING_F_EVENT_IDX,
|
||||
VIRTIO_SCSI_F_HOTPLUG,
|
||||
VIRTIO_F_RING_RESET,
|
||||
VHOST_INVALID_FEATURE_BIT
|
||||
};
|
||||
|
||||
|
@ -32,6 +32,7 @@ static const int user_feature_bits[] = {
|
||||
VIRTIO_F_NOTIFY_ON_EMPTY,
|
||||
VIRTIO_F_RING_PACKED,
|
||||
VIRTIO_F_IOMMU_PLATFORM,
|
||||
VIRTIO_F_RING_RESET,
|
||||
|
||||
VHOST_INVALID_FEATURE_BIT
|
||||
};
|
||||
|
@ -24,6 +24,7 @@ static const int feature_bits[] = {
|
||||
VIRTIO_RING_F_INDIRECT_DESC,
|
||||
VIRTIO_RING_F_EVENT_IDX,
|
||||
VIRTIO_GPIO_F_IRQ,
|
||||
VIRTIO_F_RING_RESET,
|
||||
VHOST_INVALID_FEATURE_BIT
|
||||
};
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
static const int feature_bits[] = {
|
||||
VIRTIO_I2C_F_ZERO_LENGTH_REQUEST,
|
||||
VIRTIO_F_RING_RESET,
|
||||
VHOST_INVALID_FEATURE_BIT
|
||||
};
|
||||
|
||||
|
@ -16,6 +16,11 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "standard-headers/linux/virtio_ids.h"
|
||||
|
||||
static const int feature_bits[] = {
|
||||
VIRTIO_F_RING_RESET,
|
||||
VHOST_INVALID_FEATURE_BIT
|
||||
};
|
||||
|
||||
static void vu_rng_start(VirtIODevice *vdev)
|
||||
{
|
||||
VHostUserRNG *rng = VHOST_USER_RNG(vdev);
|
||||
@ -106,8 +111,10 @@ static void vu_rng_set_status(VirtIODevice *vdev, uint8_t status)
|
||||
static uint64_t vu_rng_get_features(VirtIODevice *vdev,
|
||||
uint64_t requested_features, Error **errp)
|
||||
{
|
||||
/* No feature bits used yet */
|
||||
return requested_features;
|
||||
VHostUserRNG *rng = VHOST_USER_RNG(vdev);
|
||||
|
||||
return vhost_get_features(&rng->vhost_dev, feature_bits,
|
||||
requested_features);
|
||||
}
|
||||
|
||||
static void vu_rng_handle_output(VirtIODevice *vdev, VirtQueue *vq)
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
const int feature_bits[] = {
|
||||
VIRTIO_VSOCK_F_SEQPACKET,
|
||||
VIRTIO_F_RING_RESET,
|
||||
VHOST_INVALID_FEATURE_BIT
|
||||
};
|
||||
|
||||
|
@ -69,6 +69,7 @@ const int vdpa_feature_bits[] = {
|
||||
VIRTIO_NET_F_CTRL_VQ,
|
||||
VIRTIO_F_IOMMU_PLATFORM,
|
||||
VIRTIO_F_RING_PACKED,
|
||||
VIRTIO_F_RING_RESET,
|
||||
VIRTIO_NET_F_RSS,
|
||||
VIRTIO_NET_F_HASH_REPORT,
|
||||
VIRTIO_NET_F_GUEST_ANNOUNCE,
|
||||
|
Loading…
Reference in New Issue
Block a user