public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] device-assignment: Register as un-migratable
@ 2010-11-15 23:11 Alex Williamson
  2010-11-17 13:55 ` Marcelo Tosatti
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Williamson @ 2010-11-15 23:11 UTC (permalink / raw)
  To: kvm; +Cc: alex.williamson, mst, jan.kiszka

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

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

 v3: Use .name instead of repeating "pci-assign"
 v2: Use dummy vmsd instead of dummy save_state

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

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index bde231d..41dec36 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -1434,6 +1434,10 @@ static void assigned_dev_unregister_msix_mmio(AssignedDevice *dev)
     dev->msix_table_page = NULL;
 }
 
+static const VMStateDescription vmstate_assigned_device = {
+    .name = "pci-assign"
+};
+
 static int assigned_initfn(struct PCIDevice *pci_dev)
 {
     AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
@@ -1490,6 +1494,12 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
 
     assigned_dev_load_option_rom(dev);
     QLIST_INSERT_HEAD(&devs, dev, next);
+
+    /* Register a vmsd so that we can mark it unmigratable. */
+    vmstate_register(&dev->dev.qdev, 0, &vmstate_assigned_device, dev);
+    register_device_unmigratable(&dev->dev.qdev,
+                                 vmstate_assigned_device.name, dev);
+
     return 0;
 
 assigned_out:
@@ -1503,6 +1513,7 @@ static int assigned_exitfn(struct PCIDevice *pci_dev)
 {
     AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
 
+    vmstate_unregister(&dev->dev.qdev, &vmstate_assigned_device, dev);
     QLIST_REMOVE(dev, next);
     deassign_device(dev);
     free_assigned_device(dev);


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

* Re: [PATCH v3] device-assignment: Register as un-migratable
  2010-11-15 23:11 [PATCH v3] device-assignment: Register as un-migratable Alex Williamson
@ 2010-11-17 13:55 ` Marcelo Tosatti
  0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2010-11-17 13:55 UTC (permalink / raw)
  To: Alex Williamson; +Cc: kvm, mst, jan.kiszka

On Mon, Nov 15, 2010 at 04:11:19PM -0700, Alex Williamson wrote:
> Use register_device_unmigratable() to declare ourselves as
> non-migratable.
> 
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
> 
>  v3: Use .name instead of repeating "pci-assign"
>  v2: Use dummy vmsd instead of dummy save_state
> 
>  hw/device-assignment.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)

Applied, thanks.


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

end of thread, other threads:[~2010-11-17 13:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-15 23:11 [PATCH v3] device-assignment: Register as un-migratable Alex Williamson
2010-11-17 13:55 ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox