[PATCH] device-assignment: Register as un-migratable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use register_device_unmigratable() to declare ourselves as
non-migratable.

Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
---

 hw/device-assignment.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index bde231d..cd93941 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -1434,6 +1434,13 @@ static void assigned_dev_unregister_msix_mmio(AssignedDevice *dev)
     dev->msix_table_page = NULL;
 }
 
+/* This should never get called, but we're required to create a save_state
+ * handler or else the no_migrate flag will never be checked. */
+static void assigned_save(QEMUFile* f, void *opaque)
+{
+    abort();
+}
+
 static int assigned_initfn(struct PCIDevice *pci_dev)
 {
     AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
@@ -1490,6 +1497,13 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
 
     assigned_dev_load_option_rom(dev);
     QLIST_INSERT_HEAD(&devs, dev, next);
+
+    /* Assigned devices are not migratable, register a save
+     * state entry so that we can mark it unmigratable. */
+    register_savevm(&dev->dev.qdev, "pci-assign", 0, 0,
+                    assigned_save, NULL, dev);
+    register_device_unmigratable(&dev->dev.qdev, "pci-assign", dev);
+
     return 0;
 
 assigned_out:
@@ -1503,6 +1517,7 @@ static int assigned_exitfn(struct PCIDevice *pci_dev)
 {
     AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
 
+    unregister_savevm(&dev->dev.qdev, "pci-assign", dev);
     QLIST_REMOVE(dev, next);
     deassign_device(dev);
     free_assigned_device(dev);

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux