Commit a1fbdb9361 for qemu.org

commit a1fbdb9361f11f2cce2a253f3816a6474af155d2
Author: Oguzhan KAYNAK <kaynak.oguzhan0@gmail.com>
Date:   Fri Nov 27 19:59:22 2026 +0300

    vfio-user: block migration

    vfio-user devices lack a migration blocker, so migration can complete
    successfully without transferring device state. The destination VM is
    left with an unconfigured device, for example with its BARs unassigned,
    and -only-migratable does not reject such a device.

    Block migration until vfio-user migration support is implemented. Block
    all migration modes because vfio-user does not support CPR either.

    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/5002
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Oguzhan KAYNAK <kaynak.oguzhan0@gmail.com>
    Reviewed-by: Cédric Le Goater <clg@redhat.com>
    Link: https://lore.kernel.org/qemu-devel/20261127165922.66105-1-kaynak.oguzhan0@gmail.com
    Signed-off-by: Cédric Le Goater <clg@redhat.com>

diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
index e3749cdd39..d3ae2c150a 100644
--- a/hw/vfio-user/pci.c
+++ b/hw/vfio-user/pci.c
@@ -11,6 +11,7 @@
 #include "qapi/qapi-type-infos-sockets.h"
 #include "qapi-visit-sockets.h"
 #include "qemu/error-report.h"
+#include "migration/blocker.h"

 #include "hw/core/qdev-properties.h"
 #include "hw/vfio/pci.h"
@@ -284,6 +285,13 @@ static void vfio_user_pci_realize(PCIDevice *pdev, Error **errp)
         return;
     }
     vbasedev->proxy = proxy;
+
+    error_setg(&vbasedev->migration_blocker,
+               "%s: migration is not supported", vbasedev->name);
+    if (migrate_add_blocker(&vbasedev->migration_blocker, errp) < 0) {
+        goto error;
+    }
+
     vfio_user_set_handler(vbasedev, vfio_user_pci_process_req, vdev);

     if (udev->send_queued) {
@@ -358,6 +366,7 @@ out_teardown:
     vfio_pci_teardown_msi(vdev);
     vfio_pci_bars_exit(vdev);
 error:
+    migrate_del_blocker(&vbasedev->migration_blocker);
     error_prepend(errp, VFIO_MSG_PREFIX, vdev->vbasedev.name);
     vfio_pci_put_device(vdev);
 }