From patchwork Thu Apr 28 12:04:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 93211 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 731E9B6F4E for ; Thu, 28 Apr 2011 22:04:54 +1000 (EST) Received: from localhost ([::1]:58093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFPxj-0002uU-Bw for incoming@patchwork.ozlabs.org; Thu, 28 Apr 2011 08:04:51 -0400 Received: from eggs.gnu.org ([140.186.70.92]:32789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFPxG-0002qg-LT for qemu-devel@nongnu.org; Thu, 28 Apr 2011 08:04:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFPxF-0002ef-Mz for qemu-devel@nongnu.org; Thu, 28 Apr 2011 08:04:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFPxF-0002eW-5w for qemu-devel@nongnu.org; Thu, 28 Apr 2011 08:04:21 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3SC4KqD012108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Apr 2011 08:04:20 -0400 Received: from playa.tlv.redhat.com (dhcp-3-110.tlv.redhat.com [10.35.3.110]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3SC4Fm5003428 for ; Thu, 28 Apr 2011 08:04:19 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Thu, 28 Apr 2011 15:04:14 +0300 Message-Id: <1303992254-4940-4-git-send-email-alevy@redhat.com> In-Reply-To: <1303992254-4940-1-git-send-email-alevy@redhat.com> References: <1303992254-4940-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCHv2 3/3] virtio-serial-bus: on migration send status of pending ports bh 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 migration protocol bumped to 4, adding a single byte per port which is 1 if there is a bh scheduled, 0 otherwise. --- hw/virtio-serial-bus.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index 8556e08..7fb8ade 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -536,7 +536,7 @@ static void virtio_serial_save(QEMUFile *f, void *opaque) qemu_put_byte(f, port->guest_connected); qemu_put_byte(f, port->host_connected); - elem_popped = 0; + elem_popped = 0; if (port->elem.out_num) { elem_popped = 1; } @@ -548,6 +548,8 @@ static void virtio_serial_save(QEMUFile *f, void *opaque) qemu_put_buffer(f, (unsigned char *)&port->elem, sizeof(port->elem)); } + /* Pending bh */ + qemu_put_byte(f, !!qemu_bh_is_scheduled(port->bh)); } } @@ -558,7 +560,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id) uint32_t max_nr_ports, nr_active_ports, ports_map; unsigned int i; - if (version_id > 3) { + if (version_id > 4) { return -EINVAL; } @@ -637,7 +639,13 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id) virtio_serial_throttle_port(port, false); } } + if (version_id > 3) { + if (qemu_get_byte(f)) { + qemu_bh_schedule(port->bh); + } + } } + return 0; } @@ -889,7 +897,7 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *conf) * Register for the savevm section with the virtio-console name * to preserve backward compat */ - register_savevm(dev, "virtio-console", -1, 3, virtio_serial_save, + register_savevm(dev, "virtio-console", -1, 4, virtio_serial_save, virtio_serial_load, vser); return vdev;