public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, mst@redhat.com
Subject: Re: [PATCH] device-assignment: Register as un-migratable
Date: Mon, 15 Nov 2010 21:05:35 +0100	[thread overview]
Message-ID: <4CE1928F.7060100@web.de> (raw)
In-Reply-To: <20101115194103.15991.41060.stgit@s20.home>

[-- Attachment #1: Type: text/plain, Size: 1953 bytes --]

Am 15.11.2010 20:41, Alex Williamson wrote:
> Use register_device_unmigratable() to declare ourselves as
> non-migratable.
> 
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
> 
>  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);
> +

Isn't this expressible via some VMStateDescription? If not, that should
be changed first.

Jan

>      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);
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

  reply	other threads:[~2010-11-15 20:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-15 19:41 [PATCH] device-assignment: Register as un-migratable Alex Williamson
2010-11-15 20:05 ` Jan Kiszka [this message]
2010-11-15 20:25   ` Alex Williamson
2010-11-15 22:04     ` Jan Kiszka
2010-11-15 22:25       ` Alex Williamson
2010-11-15 22:42         ` Jan Kiszka
2010-11-16  9:42           ` Markus Armbruster

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=4CE1928F.7060100@web.de \
    --to=jan.kiszka@web.de \
    --cc=alex.williamson@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@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