summary refs log tree commit diff stats
path: root/hw
diff options
context:
space:
mode:
authorZhenzhong Duan <zhenzhong.duan@intel.com>2025-06-23 18:22:33 +0800
committerCédric Le Goater <clg@redhat.com>2025-06-26 08:55:38 +0200
commitc72d6ebaadcaec1daa995d47716348e150757a51 (patch)
tree94cbfaa29e2f6a6f6658002a316caaac3804d89e /hw
parentabc6249d42f9681d5b659716434ef374c6e0edef (diff)
downloadfocaccia-qemu-c72d6ebaadcaec1daa995d47716348e150757a51.tar.gz
focaccia-qemu-c72d6ebaadcaec1daa995d47716348e150757a51.zip
vfio/container: fails mdev hotplug if add migration blocker failed
It's aggressive to abort a running QEMU process when hotplug a mdev
and it fails migration blocker adding.

Fix by just failing mdev hotplug itself.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250623102235.94877-3-zhenzhong.duan@intel.com
[ clg: Changed test on value returned by migrate_add_blocker_modes() ]
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/vfio/container.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index 2853f6f08b..3e13feaa74 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -992,12 +992,16 @@ static bool vfio_legacy_attach_device(const char *name, VFIODevice *vbasedev,
     if (vbasedev->mdev) {
         error_setg(&vbasedev->cpr.mdev_blocker,
                    "CPR does not support vfio mdev %s", vbasedev->name);
-        migrate_add_blocker_modes(&vbasedev->cpr.mdev_blocker, &error_fatal,
-                                  MIG_MODE_CPR_TRANSFER, -1);
+        if (migrate_add_blocker_modes(&vbasedev->cpr.mdev_blocker, errp,
+                                      MIG_MODE_CPR_TRANSFER, -1) < 0) {
+            goto hiod_unref_exit;
+        }
     }
 
     return true;
 
+hiod_unref_exit:
+    object_unref(vbasedev->hiod);
 device_put_exit:
     vfio_device_put(vbasedev);
 group_put_exit: