error_setg(&multiple_devices_migration_blocker,
"Multiple VFIO devices migration is supported only if all of "
"them support P2P migration");
- ret = migrate_add_blocker(&multiple_devices_migration_blocker, errp);
+ ret = migrate_add_blocker_normal(&multiple_devices_migration_blocker, errp);
return ret;
}
#include "qemu/osdep.h"
#include "hw/vfio/vfio-common.h"
+#include "migration/misc.h"
#include "qapi/error.h"
+#include "sysemu/runstate.h"
+
+static int vfio_cpr_reboot_notifier(NotifierWithReturn *notifier,
+ MigrationEvent *e, Error **errp)
+{
+ if (e->type == MIG_EVENT_PRECOPY_SETUP &&
+ !runstate_check(RUN_STATE_SUSPENDED) && !vm_get_suspended()) {
+
+ error_setg(errp,
+ "VFIO device only supports cpr-reboot for runstate suspended");
+
+ return -1;
+ }
+ return 0;
+}
int vfio_cpr_register_container(VFIOContainerBase *bcontainer, Error **errp)
{
+ migration_add_notifier_mode(&bcontainer->cpr_reboot_notifier,
+ vfio_cpr_reboot_notifier,
+ MIG_MODE_CPR_REBOOT);
return 0;
}
void vfio_cpr_unregister_container(VFIOContainerBase *bcontainer)
{
+ migration_remove_notifier(&bcontainer->cpr_reboot_notifier);
}
vbasedev->migration_blocker = error_copy(err);
error_free(err);
- return migrate_add_blocker(&vbasedev->migration_blocker, errp);
+ return migrate_add_blocker_normal(&vbasedev->migration_blocker, errp);
}
/* ---------------------------------------------------------------------- */
QLIST_ENTRY(VFIOContainerBase) next;
QLIST_HEAD(, VFIODevice) device_list;
GList *iova_ranges;
+ NotifierWithReturn cpr_reboot_notifier;
} VFIOContainerBase;
typedef struct VFIOGuestIOMMU {