[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 13/14] vdpa: Expose VHOST_F_LOG_ALL on SVQ
From: |
Eugenio Pérez |
Subject: |
[PATCH v2 13/14] vdpa: Expose VHOST_F_LOG_ALL on SVQ |
Date: |
Sun, 27 Feb 2022 14:41:10 +0100 |
SVQ is able to log the dirty bits by itself, so let's use it to not
block migration.
Also, ignore set and clear of VHOST_F_LOG_ALL on set_features if SVQ is
enabled. Even if the device supports it, the reports would be nonsense
because SVQ memory is in the qemu region.
The log region is still allocated. Future changes might skip that, but
this series is already long enough.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
include/hw/virtio/vhost-vdpa.h | 1 +
hw/virtio/vhost-vdpa.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h
index ee8e939ad0..a29dbb3f53 100644
--- a/include/hw/virtio/vhost-vdpa.h
+++ b/include/hw/virtio/vhost-vdpa.h
@@ -30,6 +30,7 @@ typedef struct vhost_vdpa {
bool iotlb_batch_begin_sent;
MemoryListener listener;
struct vhost_vdpa_iova_range iova_range;
+ uint64_t acked_features;
bool shadow_vqs_enabled;
/* IOVA mapping used by the Shadow Virtqueue */
VhostIOVATree *iova_tree;
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index f7ac62d0d6..58007255fd 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -630,6 +630,7 @@ static int vhost_vdpa_set_features(struct vhost_dev *dev,
}
if (v->shadow_vqs_enabled) {
+ /* We must not ack _F_LOG if SVQ is enabled */
uint64_t features_ok = features;
bool ok;
@@ -640,6 +641,18 @@ static int vhost_vdpa_set_features(struct vhost_dev *dev,
PRIx64", ok: 0x%"PRIx64, features, features_ok);
return -EINVAL;
}
+
+ if ((v->acked_features ^ features) == BIT_ULL(VHOST_F_LOG_ALL)) {
+ /*
+ * QEMU is just trying to enable or disable logging. SVQ handles
+ * this sepparately, so no need to forward this.
+ */
+ v->acked_features = features;
+ return 0;
+ }
+
+ v->acked_features = features;
+ features &= ~BIT_ULL(VHOST_F_LOG_ALL);
}
trace_vhost_vdpa_set_features(dev, features);
@@ -1245,6 +1258,9 @@ static int vhost_vdpa_get_features(struct vhost_dev *dev,
if (ret == 0 && v->shadow_vqs_enabled) {
/* Filter only features that SVQ can offer to guest */
vhost_svq_valid_features(features);
+
+ /* Add SVQ logging capabilities */
+ *features |= BIT_ULL(VHOST_F_LOG_ALL);
}
return ret;
--
2.27.0
- Re: [PATCH v2 07/14] vhost: Shadow virtqueue buffers forwarding, (continued)
- [PATCH v2 08/14] util: Add iova_tree_alloc, Eugenio Pérez, 2022/02/27
- [PATCH v2 09/14] vhost: Add VhostIOVATree, Eugenio Pérez, 2022/02/27
- [PATCH v2 10/14] vdpa: Add custom IOTLB translations to SVQ, Eugenio Pérez, 2022/02/27
- [PATCH v2 11/14] vdpa: Adapt vhost_vdpa_get_vring_base to SVQ, Eugenio Pérez, 2022/02/27
- [PATCH v2 12/14] vdpa: Never set log_base addr if SVQ is enabled, Eugenio Pérez, 2022/02/27
- [PATCH v2 13/14] vdpa: Expose VHOST_F_LOG_ALL on SVQ,
Eugenio Pérez <=
- [PATCH v2 14/14] vdpa: Add x-svq to NetdevVhostVDPAOptions, Eugenio Pérez, 2022/02/27
- Re: [PATCH v2 00/14] vDPA shadow virtqueue, Jason Wang, 2022/02/27
- Re: [PATCH v2 00/14] vDPA shadow virtqueue, Jason Wang, 2022/02/28