qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfio/migration: Fix return value of vfio_migration_realize()
@ 2023-06-15  8:18 Zhenzhong Duan
  2023-06-15  8:53 ` Joao Martins
  0 siblings, 1 reply; 10+ messages in thread
From: Zhenzhong Duan @ 2023-06-15  8:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.williamson, clg, chao.p.peng

We should print "Migration disabled" when migration is blocked
in vfio_migration_realize().

Fix it by reverting return value of migrate_add_blocker(),
meanwhile error out directly once migrate_add_blocker() failed.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 hw/vfio/common.c    | 4 ++--
 hw/vfio/migration.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index fa8fd949b1cf..8505385798f3 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -399,7 +399,7 @@ int vfio_block_multiple_devices_migration(Error **errp)
         multiple_devices_migration_blocker = NULL;
     }
 
-    return ret;
+    return !ret;
 }
 
 void vfio_unblock_multiple_devices_migration(void)
@@ -444,7 +444,7 @@ int vfio_block_giommu_migration(Error **errp)
         giommu_migration_blocker = NULL;
     }
 
-    return ret;
+    return !ret;
 }
 
 void vfio_migration_finalize(void)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 6b58dddb8859..0146521d129a 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -646,12 +646,12 @@ int vfio_migration_realize(VFIODevice *vbasedev, Error **errp)
     }
 
     ret = vfio_block_multiple_devices_migration(errp);
-    if (ret) {
+    if (ret || (errp && *errp)) {
         return ret;
     }
 
     ret = vfio_block_giommu_migration(errp);
-    if (ret) {
+    if (ret || (errp && *errp)) {
         return ret;
     }
 
@@ -667,7 +667,7 @@ add_blocker:
         error_free(vbasedev->migration_blocker);
         vbasedev->migration_blocker = NULL;
     }
-    return ret;
+    return !ret;
 }
 
 void vfio_migration_exit(VFIODevice *vbasedev)
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-06-16 18:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-15  8:18 [PATCH] vfio/migration: Fix return value of vfio_migration_realize() Zhenzhong Duan
2023-06-15  8:53 ` Joao Martins
2023-06-15  9:19   ` Duan, Zhenzhong
2023-06-15 10:22     ` Joao Martins
2023-06-16  2:42       ` Duan, Zhenzhong
2023-06-16  9:05         ` Joao Martins
2023-06-16  9:53           ` Duan, Zhenzhong
2023-06-16 10:12             ` Joao Martins
2023-06-16 14:04               ` Cédric Le Goater
2023-06-16 18:06                 ` Joao Martins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).