From patchwork Wed Jul 27 09:40:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 107009 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 E37E8B6F69 for ; Wed, 27 Jul 2011 19:40:58 +1000 (EST) Received: from localhost ([::1]:40620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm0bh-0003v0-Qd for incoming@patchwork.ozlabs.org; Wed, 27 Jul 2011 05:40:49 -0400 Received: from eggs.gnu.org ([140.186.70.92]:59986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm0bc-0003uc-2h for qemu-devel@nongnu.org; Wed, 27 Jul 2011 05:40:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qm0ba-00042f-Jz for qemu-devel@nongnu.org; Wed, 27 Jul 2011 05:40:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63809) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm0ba-00042Y-70 for qemu-devel@nongnu.org; Wed, 27 Jul 2011 05:40:42 -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 p6R9efOE016586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Jul 2011 05:40:41 -0400 Received: from bow.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 p6R9edU1010802; Wed, 27 Jul 2011 05:40:39 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Wed, 27 Jul 2011 12:40:16 +0300 Message-Id: <1311759616-6027-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 Cc: hdegoede@redhat.com, armbru@redhat.com Subject: [Qemu-devel] [STABLE v2] virtio-serial-bus: replay guest_open on migration 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 When migrating a host with with a spice agent running the mouse becomes non operational after the migration. This is rhbz #725965. The problem is that after migration spice doesn't know the guest agent is open. Spice is just a char dev here. And a chardev cannot query it's device, the device has to let the chardev know when it is open. Right now after migration the chardev which is recreated is in it's default state, which assumes the guest is disconnected. Char devices carry no information across migration, but the virtio-serial does already carry the guest_connected state. This patch passes that bit to the chardev. Signed-off-by: Alon Levy --- hw/virtio-serial-bus.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index c5eb931..4a6d932 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -618,6 +618,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id) for (i = 0; i < nr_active_ports; i++) { uint32_t id; bool host_connected; + VirtIOSerialPortInfo *info; id = qemu_get_be32(f); port = find_port_by_id(s, id); @@ -626,6 +627,11 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id) } port->guest_connected = qemu_get_byte(f); + info = DO_UPCAST(VirtIOSerialPortInfo, qdev, port->dev.info); + if (port->guest_connected && info->guest_open) { + /* replay guest open */ + info->guest_open(port); + } host_connected = qemu_get_byte(f); if (host_connected != port->host_connected) { /*