Received: from eggs.gnu.org ([2001:4830:134:3::10]:40440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnYaS-0000sV-1N for qemu-devel@nongnu.org; Fri, 23 Sep 2016 18:04:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bnYaP-0003m6-Ty for qemu-devel@nongnu.org; Fri, 23 Sep 2016 18:04:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55748) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnYaP-0003lw-OP for qemu-devel@nongnu.org; Fri, 23 Sep 2016 18:04:49 -0400 Date: Sat, 24 Sep 2016 01:04:48 +0300 From: "Michael S. Tsirkin" Message-ID: <1474668213-15643-10-git-send-email-mst@redhat.com> References: <1474668213-15643-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1474668213-15643-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL v2 09/19] virtio: migrate vdev->broken flag List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefan Hajnoczi , Cornelia Huck From: Stefan Hajnoczi Send a subsection if the vdev->broken flag is set. This allows live migration of broken virtio devices. The subsection is only sent if vdev->broken has been set. In most cases the flag will be clear and no subsection will be sent. Signed-off-by: Stefan Hajnoczi Reviewed-by: Cornelia Huck Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Cornelia Huck --- hw/virtio/virtio.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 1671ea8..bac6b51 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1343,6 +1343,13 @@ static bool virtio_extra_state_needed(void *opaque) k->has_extra_state(qbus->parent); } +static bool virtio_broken_needed(void *opaque) +{ + VirtIODevice *vdev = opaque; + + return vdev->broken; +} + static const VMStateDescription vmstate_virtqueue = { .name = "virtqueue_state", .version_id = 1, @@ -1457,6 +1464,17 @@ static const VMStateDescription vmstate_virtio_64bit_features = { } }; +static const VMStateDescription vmstate_virtio_broken = { + .name = "virtio/broken", + .version_id = 1, + .minimum_version_id = 1, + .needed = &virtio_broken_needed, + .fields = (VMStateField[]) { + VMSTATE_BOOL(broken, VirtIODevice), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_virtio = { .name = "virtio", .version_id = 1, @@ -1470,6 +1488,7 @@ static const VMStateDescription vmstate_virtio = { &vmstate_virtio_64bit_features, &vmstate_virtio_virtqueues, &vmstate_virtio_ringsize, + &vmstate_virtio_broken, &vmstate_virtio_extra_state, NULL } -- MST