On 18/03/2025 11:53, Cédric Le Goater wrote:
External email: Use caution opening links or attachments


vfio_mig_active() is part of the VFIO migration API. Move the
definitions where VFIO migration is implemented.

Signed-off-by: Cédric Le Goater <c...@redhat.com>

Reviewed-by: Avihai Horon <avih...@nvidia.com>

One nit below though.

---
  hw/vfio/common.c    | 16 ----------------
  hw/vfio/migration.c | 16 ++++++++++++++++
  2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 
1a0d9290f88c9774a98f65087a36b86922b21a73..4205f4f7ec87e1a2a5e4110eabc8fde835d39c7f
 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -66,22 +66,6 @@ int vfio_kvm_device_fd = -1;
   * Device state interfaces
   */

-bool vfio_mig_active(void)
-{
-    VFIODevice *vbasedev;
-
-    if (QLIST_EMPTY(&vfio_device_list)) {
-        return false;
-    }
-
-    QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
-        if (vbasedev->migration_blocker) {
-            return false;
-        }
-    }
-    return true;
-}
-
  static Error *multiple_devices_migration_blocker;

  /*
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 
fbff46cfc35e0ee69e9599c9f8efc7437bbe3370..b5fb0d218808d010d8210612d3182dde8f33514b
 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -1062,6 +1062,22 @@ void vfio_mig_add_bytes_transferred(unsigned long val)
      qatomic_add(&bytes_transferred, val);
  }

+bool vfio_mig_active(void)

We already have vfio_migration_* prefix in this file.
I'd say let's use it and rename to vfio_migration_is_active?

Thanks.

+{
+    VFIODevice *vbasedev;
+
+    if (QLIST_EMPTY(&vfio_device_list)) {
+        return false;
+    }
+
+    QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
+        if (vbasedev->migration_blocker) {
+            return false;
+        }
+    }
+    return true;
+}
+
  /*
   * Return true when either migration initialized or blocker registered.
   * Currently only return false when adding blocker fails which will
--
2.48.1


Reply via email to