From patchwork Tue Jun 21 19:14:06 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: 9191311 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 1157260756 for ; Tue, 21 Jun 2016 19:31:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F05DC27F9C for ; Tue, 21 Jun 2016 19:31:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E526C28330; Tue, 21 Jun 2016 19:31:52 +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 945DD27F9C for ; Tue, 21 Jun 2016 19:31:52 +0000 (UTC) Received: from localhost ([::1]:53877 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFROp-0002ED-Fk for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Jun 2016 15:31:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFR86-0008IU-HV for qemu-devel@nongnu.org; Tue, 21 Jun 2016 15:14:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFR80-0003FT-BT for qemu-devel@nongnu.org; Tue, 21 Jun 2016 15:14:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48552) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFR80-0003FK-5c for qemu-devel@nongnu.org; Tue, 21 Jun 2016 15:14:28 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 D557F627E3 for ; Tue, 21 Jun 2016 19:14:27 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-116-101.ams2.redhat.com [10.36.116.101]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5LJE84d021405; Tue, 21 Jun 2016 15:14:26 -0400 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, mst@redhat.com, amit.shah@redhat.com, quintela@redhat.com, kraxel@redhat.com Date: Tue, 21 Jun 2016 20:14:06 +0100 Message-Id: <1466536447-30146-13-git-send-email-dgilbert@redhat.com> In-Reply-To: <1466536447-30146-1-git-send-email-dgilbert@redhat.com> References: <1466536447-30146-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 21 Jun 2016 19:14:27 +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 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: , 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 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 = {