diff mbox series

[for,9.0,11/12] vdpa: add vhost_vdpa_net_switchover_ack_needed

Message ID 20231215172830.2540987-12-eperezma@redhat.com (mailing list archive)
State New, archived
Headers show
Series Map memory at destination .load_setup in vDPA-net migration | expand

Commit Message

Eugenio Perez Martin Dec. 15, 2023, 5:28 p.m. UTC
Use migration switchover ack capability to make sure QEMU has mapped all
the guest memory to the device before the source stops the VM and
attempts to complete the migration.

All net vdpa devices support this early map of guest memory, so return
always true.

Signed-off-by: Eugenio PĂ©rez <eperezma@redhat.com>
---
 include/net/net.h | 2 ++
 net/vhost-vdpa.c  | 6 ++++++
 2 files changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/include/net/net.h b/include/net/net.h
index 68282dde31..f8c65dcb86 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -73,6 +73,7 @@  typedef bool (NetCheckPeerType)(NetClientState *, ObjectClass *, Error **);
 /* This can be called before start & pair, so get also the peer */
 typedef int (NetMigrationLoadSetup)(NetClientState *, struct NICState *);
 typedef int (NetMigrationLoadCleanup)(NetClientState *, struct NICState *);
+typedef bool (NetMigrationSwichoverAckNeeded)(const NetClientState *);
 
 typedef struct NetClientInfo {
     NetClientDriver type;
@@ -104,6 +105,7 @@  typedef struct NetClientInfo {
     NetCheckPeerType *check_peer_type;
     NetMigrationLoadSetup *load_setup;
     NetMigrationLoadCleanup *load_cleanup;
+    NetMigrationSwichoverAckNeeded *load_switchover_ack_needed;
 } NetClientInfo;
 
 struct NetClientState {
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 7d4a99878e..9aa958c4f1 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -437,12 +437,18 @@  static int vhost_vdpa_net_load_cleanup(NetClientState *nc, NICState *nic)
                              n->parent_obj.status & VIRTIO_CONFIG_S_DRIVER_OK);
 }
 
+static bool vhost_vdpa_net_switchover_ack_needed(const NetClientState *nc)
+{
+    return true;
+}
+
 static NetClientInfo net_vhost_vdpa_info = {
         .type = NET_CLIENT_DRIVER_VHOST_VDPA,
         .size = sizeof(VhostVDPAState),
         .receive = vhost_vdpa_receive,
         .start = vhost_vdpa_net_data_start,
         .load = vhost_vdpa_net_data_load,
+        .load_switchover_ack_needed = vhost_vdpa_net_switchover_ack_needed,
         .stop = vhost_vdpa_net_client_stop,
         .cleanup = vhost_vdpa_cleanup,
         .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,