[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 9.0 v2 07/13] vdpa: move iotlb_batch_begin_sent to vhost_vdpa_sha
From: |
Eugenio Pérez |
Subject: |
[PATCH 9.0 v2 07/13] vdpa: move iotlb_batch_begin_sent to vhost_vdpa_shared |
Date: |
Fri, 15 Dec 2023 13:52:44 +0100 |
Next patches will register the vhost_vdpa memory listener while the VM
is migrating at the destination, so we can map the memory to the device
before stopping the VM at the source. The main goal is to reduce the
downtime.
However, the destination QEMU is unaware of which vhost_vdpa device will
register its memory_listener. If the source guest has CVQ enabled, it
will be the CVQ device. Otherwise, it will be the first one.
Move the iotlb_batch_begin_sent member to VhostVDPAShared so all
vhost_vdpa can use it, rather than always in the first / last
vhost_vdpa.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
---
include/hw/virtio/vhost-vdpa.h | 3 ++-
hw/virtio/vhost-vdpa.c | 8 ++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h
index 796a180afa..05219bbcf7 100644
--- a/include/hw/virtio/vhost-vdpa.h
+++ b/include/hw/virtio/vhost-vdpa.h
@@ -38,6 +38,8 @@ typedef struct vhost_vdpa_shared {
/* IOVA mapping used by the Shadow Virtqueue */
VhostIOVATree *iova_tree;
+ bool iotlb_batch_begin_sent;
+
/* Vdpa must send shadow addresses as IOTLB key for data queues, not GPA */
bool shadow_data;
} VhostVDPAShared;
@@ -45,7 +47,6 @@ typedef struct vhost_vdpa_shared {
typedef struct vhost_vdpa {
int index;
uint32_t msg_type;
- bool iotlb_batch_begin_sent;
uint32_t address_space_id;
MemoryListener listener;
uint64_t acked_features;
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 095543395b..85b13e09f4 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -162,11 +162,11 @@ static void vhost_vdpa_listener_begin_batch(struct
vhost_vdpa *v)
static void vhost_vdpa_iotlb_batch_begin_once(struct vhost_vdpa *v)
{
if (v->dev->backend_cap & (0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH) &&
- !v->iotlb_batch_begin_sent) {
+ !v->shared->iotlb_batch_begin_sent) {
vhost_vdpa_listener_begin_batch(v);
}
- v->iotlb_batch_begin_sent = true;
+ v->shared->iotlb_batch_begin_sent = true;
}
static void vhost_vdpa_listener_commit(MemoryListener *listener)
@@ -180,7 +180,7 @@ static void vhost_vdpa_listener_commit(MemoryListener
*listener)
return;
}
- if (!v->iotlb_batch_begin_sent) {
+ if (!v->shared->iotlb_batch_begin_sent) {
return;
}
@@ -193,7 +193,7 @@ static void vhost_vdpa_listener_commit(MemoryListener
*listener)
fd, errno, strerror(errno));
}
- v->iotlb_batch_begin_sent = false;
+ v->shared->iotlb_batch_begin_sent = false;
}
static void vhost_vdpa_iommu_map_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
--
2.39.3
- [PATCH 9.0 v2 00/13] Consolidate common vdpa members in VhostVDPAShared, Eugenio Pérez, 2023/12/15
- [PATCH 9.0 v2 05/13] vdpa: use vdpa shared for tracing, Eugenio Pérez, 2023/12/15
- [PATCH 9.0 v2 04/13] vdpa: move shadow_data to vhost_vdpa_shared, Eugenio Pérez, 2023/12/15
- [PATCH 9.0 v2 01/13] vdpa: add VhostVDPAShared, Eugenio Pérez, 2023/12/15
- [PATCH 9.0 v2 07/13] vdpa: move iotlb_batch_begin_sent to vhost_vdpa_shared,
Eugenio Pérez <=
- [PATCH 9.0 v2 06/13] vdpa: move file descriptor to vhost_vdpa_shared, Eugenio Pérez, 2023/12/15
- [PATCH 9.0 v2 08/13] vdpa: move backend_cap to vhost_vdpa_shared, Eugenio Pérez, 2023/12/15
- [PATCH 9.0 v2 09/13] vdpa: remove msg type of vhost_vdpa, Eugenio Pérez, 2023/12/15
- [PATCH 9.0 v2 10/13] vdpa: move iommu_list to vhost_vdpa_shared, Eugenio Pérez, 2023/12/15
- [PATCH 9.0 v2 02/13] vdpa: move iova tree to the shared struct, Eugenio Pérez, 2023/12/15
- [PATCH 9.0 v2 03/13] vdpa: move iova_range to vhost_vdpa_shared, Eugenio Pérez, 2023/12/15
- [PATCH 9.0 v2 11/13] vdpa: use VhostVDPAShared in vdpa_dma_map and unmap, Eugenio Pérez, 2023/12/15
- [PATCH 9.0 v2 12/13] vdpa: use dev_shared in vdpa_iommu, Eugenio Pérez, 2023/12/15
- [PATCH 9.0 v2 13/13] vdpa: move memory listener to vhost_vdpa_shared, Eugenio Pérez, 2023/12/15