From patchwork Tue Jul 12 12:19:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 9225223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 948B660572 for ; Tue, 12 Jul 2016 12:37:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8485427BFF for ; Tue, 12 Jul 2016 12:37:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7967927EED; Tue, 12 Jul 2016 12:37:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_HK_NAME_DR autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2665F27BFF for ; Tue, 12 Jul 2016 12:37:24 +0000 (UTC) Received: from localhost ([::1]:40107 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMwwF-0005kh-8o for patchwork-qemu-devel@patchwork.kernel.org; Tue, 12 Jul 2016 08:37:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMwfI-00027O-3p for qemu-devel@nongnu.org; Tue, 12 Jul 2016 08:19:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMwfE-00077o-2F for qemu-devel@nongnu.org; Tue, 12 Jul 2016 08:19:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMwfD-00077j-Se for qemu-devel@nongnu.org; Tue, 12 Jul 2016 08:19:47 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8452F3B720 for ; Tue, 12 Jul 2016 12:19:47 +0000 (UTC) Received: from dgilbert-t530.home.treblig.org (vpn1-6-34.ams2.redhat.com [10.36.6.34]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6CCJQqS024539; Tue, 12 Jul 2016 08:19:46 -0400 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, mst@redhat.com, amit.shah@redhat.com, quintela@redhat.com Date: Tue, 12 Jul 2016 13:19:24 +0100 Message-Id: <1468325965-22818-13-git-send-email-dgilbert@redhat.com> In-Reply-To: <1468325965-22818-1-git-send-email-dgilbert@redhat.com> References: <1468325965-22818-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 12 Jul 2016 12:19:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 12/13] virtio-gpu: Wrap in vmstate X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cornelia.huck@del.ibm.com, kraxel@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Dr. David Alan Gilbert" Forcibly convert it to a vmstate wrapper; proper conversion comes later. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Cornelia Huck --- 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 f8b0274..24149f7 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -991,7 +991,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); @@ -1021,7 +1021,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); @@ -1030,11 +1030,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; } @@ -1170,9 +1166,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); } } @@ -1220,6 +1213,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 @@ -1245,6 +1241,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 = {