[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/53] virtio-net: clear guest_announce feature if no cvq backend
From: |
Michael S. Tsirkin |
Subject: |
[PULL 09/53] virtio-net: clear guest_announce feature if no cvq backend |
Date: |
Thu, 2 Mar 2023 03:24:58 -0500 |
From: Eugenio Pérez <eperezma@redhat.com>
Since GUEST_ANNOUNCE is emulated the feature bit could be set without
backend support. This happens in the vDPA case.
However, backend vDPA parent may not have CVQ support. This causes an
incoherent feature set, and the driver may refuse to start. This
happens in virtio-net Linux driver.
This may be solved differently in the future. Qemu is able to emulate a
CVQ just for guest_announce purposes, helping guest to notify the new
location with vDPA devices that does not support it. However, this is
left as a TODO as it is way more complex to backport.
Tested with vdpa_net_sim, toggling manually VIRTIO_NET_F_CTRL_VQ in the
driver and migrating it with x-svq=on.
Fixes: 980003debddd ("vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in
vhost-vdpa")
Reported-by: Dawar, Gautam <gautam.dawar@amd.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230124161159.2182117-1-eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: David Edmondson <david.edmondson@oracle.com>
Reviewed-by: Gautam Dawar <gautam.dawar@amd.com>
Tested-by: Gautam Dawar <gautam.dawar@amd.com>
Tested-by: Lei Yang <leiyang@redhat.com>
---
hw/net/virtio-net.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 3ae909041a..09d5c7a664 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -820,6 +820,21 @@ static uint64_t virtio_net_get_features(VirtIODevice
*vdev, uint64_t features,
features |= (1ULL << VIRTIO_NET_F_MTU);
}
+ /*
+ * Since GUEST_ANNOUNCE is emulated the feature bit could be set without
+ * enabled. This happens in the vDPA case.
+ *
+ * Make sure the feature set is not incoherent, as the driver could refuse
+ * to start.
+ *
+ * TODO: QEMU is able to emulate a CVQ just for guest_announce purposes,
+ * helping guest to notify the new location with vDPA devices that does not
+ * support it.
+ */
+ if (!virtio_has_feature(vdev->backend_features, VIRTIO_NET_F_CTRL_VQ)) {
+ virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_ANNOUNCE);
+ }
+
return features;
}
--
MST
- [PULL 00/53] virtio,pc,pci: features, cleanups, fixes, Michael S. Tsirkin, 2023/03/02
- [PULL 01/53] hw/smbios: fix field corruption in type 4 table, Michael S. Tsirkin, 2023/03/02
- [PULL 02/53] Revert "x86: don't let decompressed kernel image clobber setup_data", Michael S. Tsirkin, 2023/03/02
- [PULL 04/53] Revert "x86: re-initialize RNG seed when selecting kernel", Michael S. Tsirkin, 2023/03/02
- [PULL 03/53] Revert "x86: do not re-randomize RNG seed on snapshot load", Michael S. Tsirkin, 2023/03/02
- [PULL 05/53] Revert "x86: reinitialize RNG seed on system reboot", Michael S. Tsirkin, 2023/03/02
- [PULL 09/53] virtio-net: clear guest_announce feature if no cvq backend,
Michael S. Tsirkin <=
- [PULL 11/53] vhost-user-gpio: Configure vhost_dev when connecting, Michael S. Tsirkin, 2023/03/02
- [PULL 16/53] docs: vhost-user: replace _SLAVE_ with _BACKEND_, Michael S. Tsirkin, 2023/03/02
- [PULL 07/53] Revert "x86: return modified setup_data only if read as memory, not as file", Michael S. Tsirkin, 2023/03/02
- [PULL 13/53] vhost-user-rng: Back up vqs before cleaning up vhost_dev, Michael S. Tsirkin, 2023/03/02
- [PULL 17/53] libvhost-user: Adopt new backend naming, Michael S. Tsirkin, 2023/03/02
- [PULL 10/53] backends/vhost-user: remove the ioeventfd check, Michael S. Tsirkin, 2023/03/02
- [PULL 12/53] vhost-user-i2c: Back up vqs before cleaning up vhost_dev, Michael S. Tsirkin, 2023/03/02
- [PULL 14/53] virtio-rng-pci: fix transitional migration compat for vectors, Michael S. Tsirkin, 2023/03/02