Skip to contentSkip to conversation

single-binary: compile once migration files

PATCH Superseded Pierrick Bouvier 4 participants 9 messages Jul 25, 2025 – Jul 28, 2025 Arm/Amlogic Meson SoC support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover single-binary: compile once migration files

This series removes target dependencies in migration code.

Pierrick Bouvier (3):
migration: compile migration/ram.c once
migration: rename target.c to vfio.c
migration/vfio: compile only once

 migration/vfio-stub.c          | 16 ++++++++++++++++
 migration/{target.c => vfio.c} | 16 +---------------
 migration/meson.build          |  8 ++++----
 3 files changed, 21 insertions(+), 19 deletions(-)
 create mode 100644 migration/vfio-stub.c
 rename migration/{target.c => vfio.c} (67%)
Signature · 1 line
2.47.2
#1 lore raw

PATCH 1/3 migration: compile migration/ram.c once

---
 migration/meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
migration/meson.build +2 -2
index 9aa48b290e2..36fb950b3b1 100644
@@ -31,6 +31,7 @@ system_ss.add(files(
   'multifd-zero-page.c',
   'options.c',
   'postcopy-ram.c',
+  'ram.c',
   'savevm.c',
   'socket.c',
   'tls.c',
@@ -50,5 +51,4 @@ system_ss.add(when: uadk, if_true: files('multifd-uadk.c'))
 system_ss.add(when: qatzip, if_true: files('multifd-qatzip.c'))
 
 specific_ss.add(when: 'CONFIG_SYSTEM_ONLY',
-                if_true: files('ram.c',
-                               'target.c'))
+                if_true: files('target.c'))
Signature · 1 line
2.47.2
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] migration: compile migration/ram.c once

Quoted 18 lines · Pierrick Bouvier
---
  migration/meson.build | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
migration/meson.build +1 -0
index 9aa48b290e2..36fb950b3b1 100644
@@ -31,6 +31,7 @@ system_ss.add(files(
    'multifd-zero-page.c',
    'options.c',
    'postcopy-ram.c',
+  'ram.c',
    'savevm.c',
    'socket.c',
    'tls.c',

migration/meson.build system_ss.add(when: uadk, if_true: files('multifd-uadk.c')) · line 54

Quoted 6 lines
migration/meson.build +1 -2
@@ -50,5 +51,4 @@ system_ss.add(when: uadk, if_true: files('multifd-uadk.c'))
  system_ss.add(when: qatzip, if_true: files('multifd-qatzip.c'))
 
  specific_ss.add(when: 'CONFIG_SYSTEM_ONLY',
-                if_true: files('ram.c',
-                               'target.c'))
+                if_true: files('target.c'))

r~

#3 lore raw

PATCH 2/3 migration: rename target.c to vfio.c

In reply to Pierrick Bouvier
---
 migration/{target.c => vfio.c} | 2 +-
 migration/meson.build          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
 rename migration/{target.c => vfio.c} (90%)
migration/vfio.c renamed from migration/target.c +1 -1
similarity index 90%
rename from migration/target.c
rename to migration/vfio.c
index 12fd399f0c5..0b64e49ef06 100644
@@ -1,5 +1,5 @@
 /*
- * QEMU live migration - functions that need to be compiled target-specific
+ * QEMU live migration - VFIO
  *
  * This work is licensed under the terms of the GNU GPL, version 2
  * or (at your option) any later version.
migration/meson.build +1 -1
index 36fb950b3b1..45e9445f97d 100644
@@ -51,4 +51,4 @@ system_ss.add(when: uadk, if_true: files('multifd-uadk.c'))
 system_ss.add(when: qatzip, if_true: files('multifd-qatzip.c'))
 
 specific_ss.add(when: 'CONFIG_SYSTEM_ONLY',
-                if_true: files('target.c'))
+                if_true: files('vfio.c'))
Signature · 1 line
2.47.2
Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] migration: rename target.c to vfio.c

Quoted 26 lines · Pierrick Bouvier
---
  migration/{target.c => vfio.c} | 2 +-
  migration/meson.build          | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

rename migration/{target.c => vfio.c} (90%)

migration/vfio.c renamed from migration/target.c +1 -1
similarity index 90%
rename from migration/target.c
rename to migration/vfio.c
index 12fd399f0c5..0b64e49ef06 100644
@@ -1,5 +1,5 @@
  /*
- * QEMU live migration - functions that need to be compiled target-specific
+ * QEMU live migration - VFIO
   *
   * This work is licensed under the terms of the GNU GPL, version 2
   * or (at your option) any later version.
migration/meson.build +0 -0
index 36fb950b3b1..45e9445f97d 100644

migration/meson.build system_ss.add(when: uadk, if_true: files('multifd-uadk.c')) · line 54

Quoted 5 lines
migration/meson.build +1 -1
@@ -51,4 +51,4 @@ system_ss.add(when: uadk, if_true: files('multifd-uadk.c'))
  system_ss.add(when: qatzip, if_true: files('multifd-qatzip.c'))
 
  specific_ss.add(when: 'CONFIG_SYSTEM_ONLY',
-                if_true: files('target.c'))
+                if_true: files('vfio.c'))

r~

#5 lore raw

PATCH 3/3 migration/vfio: compile only once

In reply to Pierrick Bouvier
---
 migration/vfio-stub.c | 16 ++++++++++++++++
 migration/vfio.c      | 14 --------------
 migration/meson.build |  6 +++---
 3 files changed, 19 insertions(+), 17 deletions(-)
 create mode 100644 migration/vfio-stub.c
migration/vfio-stub.c new file +16 -0
new file mode 100644
index 00000000000..f59ebe075dc
@@ -0,0 +1,16 @@
+/*
+ * QEMU live migration - stubs for VFIO
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "migration.h"
+
+void migration_populate_vfio_info(MigrationInfo *info)
+{
+}
+
+void migration_reset_vfio_bytes_transferred(void)
+{
+}
migration/vfio.c +0 -14
index 0b64e49ef06..af6ae2c1e19 100644
@@ -8,13 +8,8 @@
 #include "qemu/osdep.h"
 #include "qapi/qapi-types-migration.h"
 #include "migration.h"
-#include CONFIG_DEVICES
-
-#ifdef CONFIG_VFIO
 #include "hw/vfio/vfio-migration.h"
-#endif
 
-#ifdef CONFIG_VFIO
 void migration_populate_vfio_info(MigrationInfo *info)
 {
     if (vfio_migration_active()) {
@@ -27,12 +22,3 @@ void migration_reset_vfio_bytes_transferred(void)
 {
     vfio_migration_reset_bytes_transferred();
 }
-#else
-void migration_populate_vfio_info(MigrationInfo *info)
-{
-}
-
-void migration_reset_vfio_bytes_transferred(void)
-{
-}
-#endif
migration/meson.build +3 -3
index 45e9445f97d..0f71544a825 100644
@@ -49,6 +49,6 @@ system_ss.add(when: zstd, if_true: files('multifd-zstd.c'))
 system_ss.add(when: qpl, if_true: files('multifd-qpl.c'))
 system_ss.add(when: uadk, if_true: files('multifd-uadk.c'))
 system_ss.add(when: qatzip, if_true: files('multifd-qatzip.c'))
-
-specific_ss.add(when: 'CONFIG_SYSTEM_ONLY',
-                if_true: files('vfio.c'))
+system_ss.add(when: 'CONFIG_VFIO',
+              if_true: files('vfio.c'),
+              if_false: files('vfio-stub.c'))
Signature · 1 line
2.47.2
Acked-by on the v1 series
#7 lore raw
In reply to Pierrick Bouvier
Quoted 7 lines · Pierrick Bouvier

This series removes target dependencies in migration code.

Pierrick Bouvier (3):
migration: compile migration/ram.c once
migration: rename target.c to vfio.c
migration/vfio: compile only once

Quoted 6 lines
 migration/vfio-stub.c          | 16 ++++++++++++++++
 migration/{target.c => vfio.c} | 16 +---------------
 migration/meson.build          |  8 ++++----
 3 files changed, 21 insertions(+), 19 deletions(-)
 create mode 100644 migration/vfio-stub.c
 rename migration/{target.c => vfio.c} (67%)

Series:

Reviewed-by on the v1 series
#8 lore raw
In reply to Pierrick Bouvier
Quoted 7 lines · Pierrick Bouvier

This series removes target dependencies in migration code.

Pierrick Bouvier (3):
migration: compile migration/ram.c once
migration: rename target.c to vfio.c
migration/vfio: compile only once

Quoted 6 lines
 migration/vfio-stub.c          | 16 ++++++++++++++++
 migration/{target.c => vfio.c} | 16 +---------------
 migration/meson.build          |  8 ++++----
 3 files changed, 21 insertions(+), 19 deletions(-)
 create mode 100644 migration/vfio-stub.c
 rename migration/{target.c => vfio.c} (67%)
Signature · 1 line
Peter Xu