qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, mst@redhat.com, amit.shah@redhat.com,
	quintela@redhat.com, kraxel@redhat.com
Subject: [Qemu-devel] [PATCH 12/13] virtio-gpu: Wrap in vmstate
Date: Tue, 21 Jun 2016 20:14:06 +0100	[thread overview]
Message-ID: <1466536447-30146-13-git-send-email-dgilbert@redhat.com> (raw)
In-Reply-To: <1466536447-30146-1-git-send-email-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Forcibly convert it to a vmstate wrapper;  proper conversion
comes later.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 hw/display/virtio-gpu.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 136c095..52f2e7c 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -985,7 +985,7 @@ static const VMStateDescription vmstate_virtio_gpu_unmigratable = {
     .unmigratable = 1,
 };
 
-static void virtio_gpu_save(QEMUFile *f, void *opaque)
+static void virtio_gpu_save(QEMUFile *f, void *opaque, size_t size)
 {
     VirtIOGPU *g = opaque;
     VirtIODevice *vdev = VIRTIO_DEVICE(g);
@@ -1015,7 +1015,7 @@ static void virtio_gpu_save(QEMUFile *f, void *opaque)
     vmstate_save_state(f, &vmstate_virtio_gpu_scanouts, g, NULL);
 }
 
-static int virtio_gpu_load(QEMUFile *f, void *opaque, int version_id)
+static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size)
 {
     VirtIOGPU *g = opaque;
     VirtIODevice *vdev = VIRTIO_DEVICE(g);
@@ -1024,11 +1024,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, int version_id)
     uint32_t resource_id, pformat;
     int i, ret;
 
-    if (version_id != VIRTIO_GPU_VM_VERSION) {
-        return -EINVAL;
-    }
-
-    ret = virtio_load(vdev, f, version_id);
+    ret = virtio_load(vdev, f, VIRTIO_GPU_VM_VERSION);
     if (ret) {
         return ret;
     }
@@ -1164,9 +1160,6 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
 
     if (virtio_gpu_virgl_enabled(g->conf)) {
         vmstate_register(qdev, -1, &vmstate_virtio_gpu_unmigratable, g);
-    } else {
-        register_savevm(qdev, "virtio-gpu", -1, VIRTIO_GPU_VM_VERSION,
-                        virtio_gpu_save, virtio_gpu_load, g);
     }
 }
 
@@ -1214,6 +1207,9 @@ static void virtio_gpu_reset(VirtIODevice *vdev)
 #endif
 }
 
+VMSTATE_VIRTIO_DEVICE(gpu, VIRTIO_GPU_VM_VERSION, virtio_gpu_load,
+                      virtio_gpu_save);
+
 static Property virtio_gpu_properties[] = {
     DEFINE_PROP_UINT32("max_outputs", VirtIOGPU, conf.max_outputs, 1),
 #ifdef CONFIG_VIRGL
@@ -1239,6 +1235,7 @@ static void virtio_gpu_class_init(ObjectClass *klass, void *data)
     vdc->reset = virtio_gpu_reset;
 
     dc->props = virtio_gpu_properties;
+    dc->vmsd = &vmstate_virtio_gpu;
 }
 
 static const TypeInfo virtio_gpu_info = {
-- 
2.7.4

  parent reply	other threads:[~2016-06-21 19:14 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-21 19:13 [Qemu-devel] [PATCH 00/13] virtio migration: Flip outer layer to vmstate Dr. David Alan Gilbert (git)
2016-06-21 19:13 ` [Qemu-devel] [PATCH 01/13] virtio-net: Remove old migration version support Dr. David Alan Gilbert (git)
2016-06-27  6:46   ` Amit Shah
2016-06-21 19:13 ` [Qemu-devel] [PATCH 02/13] virtio-serial: " Dr. David Alan Gilbert (git)
2016-06-27  6:45   ` Amit Shah
2016-06-21 19:13 ` [Qemu-devel] [PATCH 03/13] virtio: Migration helper function and macro Dr. David Alan Gilbert (git)
2016-06-22 17:39   ` Cornelia Huck
2016-06-21 19:13 ` [Qemu-devel] [PATCH 04/13] virtio-scsi: Wrap in vmstate Dr. David Alan Gilbert (git)
2016-06-22 17:40   ` Cornelia Huck
2016-06-21 19:13 ` [Qemu-devel] [PATCH 05/13] virtio-blk: " Dr. David Alan Gilbert (git)
2016-06-22 17:42   ` Cornelia Huck
2016-06-21 19:14 ` [Qemu-devel] [PATCH 06/13] virtio-rng: " Dr. David Alan Gilbert (git)
2016-06-22 17:44   ` Cornelia Huck
2016-06-21 19:14 ` [Qemu-devel] [PATCH 07/13] virtio-balloon: " Dr. David Alan Gilbert (git)
2016-06-22 17:46   ` Cornelia Huck
2016-06-21 19:14 ` [Qemu-devel] [PATCH 08/13] virtio-net: " Dr. David Alan Gilbert (git)
2016-06-23  7:39   ` Cornelia Huck
2016-06-21 19:14 ` [Qemu-devel] [PATCH 09/13] virtio-serial: " Dr. David Alan Gilbert (git)
2016-06-23  7:55   ` Cornelia Huck
2016-06-21 19:14 ` [Qemu-devel] [PATCH 10/13] 9pfs: " Dr. David Alan Gilbert (git)
2016-06-23  8:01   ` Cornelia Huck
2016-06-30  7:02   ` Greg Kurz
2016-06-21 19:14 ` [Qemu-devel] [PATCH 11/13] virtio-input: " Dr. David Alan Gilbert (git)
2016-06-22  6:48   ` Gerd Hoffmann
2016-06-22  9:54     ` Dr. David Alan Gilbert
2016-06-22 10:29       ` Gerd Hoffmann
2016-06-23  8:07   ` Cornelia Huck
2016-06-21 19:14 ` Dr. David Alan Gilbert (git) [this message]
2016-06-23  8:19   ` [Qemu-devel] [PATCH 12/13] virtio-gpu: " Cornelia Huck
2016-06-21 19:14 ` [Qemu-devel] [PATCH 13/13] virtio: Update migration docs Dr. David Alan Gilbert (git)
2016-06-23  8:23   ` Cornelia Huck
2016-06-22  6:53 ` [Qemu-devel] [PATCH 00/13] virtio migration: Flip outer layer to vmstate Gerd Hoffmann
2016-06-22  9:50   ` Dr. David Alan Gilbert
2016-06-22  8:39 ` Cornelia Huck
2016-06-22 10:54   ` Dr. David Alan Gilbert
2016-06-22 17:36     ` Cornelia Huck
2016-06-24  5:49 ` Michael S. Tsirkin
2016-06-24  8:02   ` Dr. David Alan Gilbert
2016-06-27  6:50 ` Amit Shah
2016-06-27  7:53   ` Dr. David Alan Gilbert
2016-06-28  9:04     ` Amit Shah

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=1466536447-30146-13-git-send-email-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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;
as well as URLs for NNTP newsgroup(s).