diff mbox series

[RFC,V1,01/12] vfio: move cpr_exec_notifier

Message ID 1721502937-87102-2-git-send-email-steven.sistare@oracle.com (mailing list archive)
State New, archived
Headers show
Series Live update: iommufd | expand

Commit Message

Steven Sistare July 20, 2024, 7:15 p.m. UTC
Move the cpr notifier to the base container.  This change will be squashed
into the "live update: vfio" series.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
 hw/vfio/cpr-legacy.c                  | 10 +++++-----
 include/hw/vfio/vfio-common.h         |  1 -
 include/hw/vfio/vfio-container-base.h |  1 +
 3 files changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c
index 8f6224e..91be762 100644
--- a/hw/vfio/cpr-legacy.c
+++ b/hw/vfio/cpr-legacy.c
@@ -107,9 +107,9 @@  static const VMStateDescription vfio_container_vmstate = {
 static int vfio_cpr_fail_notifier(NotifierWithReturn *notifier,
                                   MigrationEvent *e, Error **errp)
 {
-    VFIOContainer *container =
-        container_of(notifier, VFIOContainer, cpr_exec_notifier);
-    VFIOContainerBase *bcontainer = &container->bcontainer;
+    VFIOContainerBase *bcontainer =
+        container_of(notifier, VFIOContainerBase, cpr_exec_notifier);
+    VFIOContainer *container = VFIO_CONTAINER(bcontainer);
 
     if (e->type != MIG_EVENT_PRECOPY_FAILED) {
         return 0;
@@ -147,7 +147,7 @@  bool vfio_legacy_cpr_register_container(VFIOContainerBase *bcontainer,
 
     vmstate_register(NULL, -1, &vfio_container_vmstate, container);
 
-    migration_add_notifier_mode(&container->cpr_exec_notifier,
+    migration_add_notifier_mode(&bcontainer->cpr_exec_notifier,
                                 vfio_cpr_fail_notifier,
                                 MIG_MODE_CPR_EXEC);
     return true;
@@ -158,5 +158,5 @@  void vfio_legacy_cpr_unregister_container(VFIOContainerBase *bcontainer)
     VFIOContainer *container = VFIO_CONTAINER(bcontainer);
 
     vmstate_unregister(NULL, &vfio_container_vmstate, container);
-    migration_remove_notifier(&container->cpr_exec_notifier);
+    migration_remove_notifier(&bcontainer->cpr_exec_notifier);
 }
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index 1902c8f..9512a0c 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -81,7 +81,6 @@  typedef struct VFIOContainer {
     VFIOContainerBase bcontainer;
     int fd; /* /dev/vfio/vfio, empowered by the attached groups */
     unsigned iommu_type;
-    NotifierWithReturn cpr_exec_notifier;
     bool vaddr_unmapped;
     QLIST_HEAD(, VFIOGroup) group_list;
 } VFIOContainer;
diff --git a/include/hw/vfio/vfio-container-base.h b/include/hw/vfio/vfio-container-base.h
index 3d30365..f8b7b26 100644
--- a/include/hw/vfio/vfio-container-base.h
+++ b/include/hw/vfio/vfio-container-base.h
@@ -52,6 +52,7 @@  typedef struct VFIOContainerBase {
     QLIST_HEAD(, VFIODevice) device_list;
     GList *iova_ranges;
     NotifierWithReturn cpr_reboot_notifier;
+    NotifierWithReturn cpr_exec_notifier;
     Error *cpr_blocker;
 } VFIOContainerBase;