public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>, Alex Williamson <alex.williamson@redhat.com>
Subject: [PATCH] pci-assign: Use declarative interface to prevent migration
Date: Wed, 31 Aug 2011 13:57:56 +0200	[thread overview]
Message-ID: <4E5E21C4.9000408@siemens.com> (raw)

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/device-assignment.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index bfa0edf..288f80c 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -1523,9 +1523,7 @@ static void assigned_dev_unregister_msix_mmio(AssignedDevice *dev)
 
 static const VMStateDescription vmstate_assigned_device = {
     .name = "pci-assign",
-    .fields = (VMStateField []) {
-        VMSTATE_END_OF_LIST()
-    }
+    .unmigratable = 1,
 };
 
 static void reset_assigned_device(DeviceState *dev)
@@ -1643,11 +1641,6 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
 
     add_boot_device_path(dev->bootindex, &pci_dev->qdev, NULL);
 
-    /* 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:
@@ -1661,7 +1654,6 @@ 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);
@@ -1698,6 +1690,7 @@ static PCIDeviceInfo assign_info = {
     .qdev.name    = "pci-assign",
     .qdev.desc    = "pass through host pci devices to the guest",
     .qdev.size    = sizeof(AssignedDevice),
+    .qdev.vmsd    = &vmstate_assigned_device,
     .qdev.reset   = reset_assigned_device,
     .init         = assigned_initfn,
     .exit         = assigned_exitfn,

             reply	other threads:[~2011-08-31 11:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31 11:57 Jan Kiszka [this message]
2011-08-31 12:48 ` [PATCH] pci-assign: Use declarative interface to prevent migration Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E5E21C4.9000408@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=alex.williamson@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox