From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yajgr-00058i-O3 for qemu-devel@nongnu.org; Wed, 25 Mar 2015 07:41:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yajgm-00040L-P6 for qemu-devel@nongnu.org; Wed, 25 Mar 2015 07:41:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yajgm-000401-Ki for qemu-devel@nongnu.org; Wed, 25 Mar 2015 07:41:36 -0400 Date: Wed, 25 Mar 2015 12:41:26 +0100 From: "Michael S. Tsirkin" Message-ID: <1427283599-12789-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH for-2.3] virtio-serial: fix virtio config size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Amit Shah , Peter Maydell , Cole Robinson commit 9b70c1790acacae54d559d38ca69186a85040bb8 virtio-serial: switch to standard-headers changes virtio_console_config size from 8 to 12 bytes: it adds an optional 4 byte emerg_wr field. As this crosses a power of two boundary, this changes the PCI BAR size, which breaks migration compatibility with old qemu machine types. It's probably a problem for other transports as well. As a temporary fix, as we don't yet support this new field anyway, simply make the config size smaller at init time. Long terms we probably want something along the lines of virtio_net_set_config_size. Reported-by: Cole Robinson Signed-off-by: Michael S. Tsirkin --- Cole, could you pls confirm the following fixes the issue that you reported? Thanks! hw/char/virtio-serial-bus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 9a029d2..d05473f 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -949,8 +949,10 @@ static void virtio_serial_device_realize(DeviceState *dev, Error **errp) return; } + /* We don't support emergency write, skip it for now. */ + /* TODO: cleaner fix, depending on host features. */ virtio_init(vdev, "virtio-serial", VIRTIO_ID_CONSOLE, - sizeof(struct virtio_console_config)); + offsetof(struct virtio_console_config, emerg_wr)); /* Spawn a new virtio-serial bus on which the ports will ride as devices */ qbus_create_inplace(&vser->bus, sizeof(vser->bus), TYPE_VIRTIO_SERIAL_BUS, -- MST