From patchwork Tue Jun 24 17:20:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 363571 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 00A31140087 for ; Wed, 25 Jun 2014 03:22:25 +1000 (EST) Received: from localhost ([::1]:33054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzUQJ-0004q9-P6 for incoming@patchwork.ozlabs.org; Tue, 24 Jun 2014 13:22:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzUOe-0001qQ-4X for qemu-devel@nongnu.org; Tue, 24 Jun 2014 13:20:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzUOU-0002wm-JQ for qemu-devel@nongnu.org; Tue, 24 Jun 2014 13:20:40 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:50254) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzUOU-0002we-AF for qemu-devel@nongnu.org; Tue, 24 Jun 2014 13:20:30 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Jun 2014 18:20:29 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 24 Jun 2014 18:20:27 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id E174B1B08041 for ; Tue, 24 Jun 2014 18:20:58 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s5OHKRrs36110410 for ; Tue, 24 Jun 2014 17:20:27 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s5OHKQwq001828 for ; Tue, 24 Jun 2014 11:20:26 -0600 Received: from smtp.lab.toulouse-stg.fr.ibm.com (srv01.lab.toulouse-stg.fr.ibm.com [9.101.4.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s5OHKP7s001811; Tue, 24 Jun 2014 11:20:25 -0600 Received: from bahia.local (icon-9-164-148-109.megacenter.de.ibm.com [9.164.148.109]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 42EE9210FFE; Tue, 24 Jun 2014 19:20:24 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 24 Jun 2014 19:20:23 +0200 Message-ID: <20140624172015.17522.8394.stgit@bahia.local> In-Reply-To: <20140624151955.17522.62537.stgit@bahia.local> References: <20140624151955.17522.62537.stgit@bahia.local> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14062417-3548-0000-0000-0000004403F4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.112 Cc: Kevin Wolf , Peter Maydell , Stefan Hajnoczi , Juan Quintela , Rusty Russell , Alexander Graf , "Michael S. Tsirkin" , aneesh.kumar@linux.vnet.ibm.com, Anthony Liguori , Amit Shah , Paolo Bonzini , Andreas =?utf-8?q?F=C3=A4rber?= Subject: [Qemu-devel] [PATCH v9 08/22] virtio-rng: implement per-device migration calls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org While we are here, we also check virtio_load() return value. Signed-off-by: Greg Kurz Reviewed-by: Alexander Graf --- hw/virtio/virtio-rng.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 025de81..1356aca 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -107,19 +107,20 @@ static void virtio_rng_save(QEMUFile *f, void *opaque) static int virtio_rng_load(QEMUFile *f, void *opaque, int version_id) { - VirtIORNG *vrng = opaque; - VirtIODevice *vdev = VIRTIO_DEVICE(vrng); - if (version_id != 1) { return -EINVAL; } - virtio_load(vdev, f, version_id); + return virtio_load(VIRTIO_DEVICE(opaque), f, version_id); +} +static int virtio_rng_load_device(VirtIODevice *vdev, QEMUFile *f, + int version_id) +{ /* We may have an element ready but couldn't process it due to a quota * limit. Make sure to try again after live migration when the quota may * have been reset. */ - virtio_rng_process(vrng); + virtio_rng_process(VIRTIO_RNG(vdev)); return 0; } @@ -219,6 +220,7 @@ static void virtio_rng_class_init(ObjectClass *klass, void *data) vdc->realize = virtio_rng_device_realize; vdc->unrealize = virtio_rng_device_unrealize; vdc->get_features = get_features; + vdc->load = virtio_rng_load_device; } static void virtio_rng_initfn(Object *obj)