virtio-balloon: fix QEMU 4.0 config size migration incompatibility
commit2bbadb08ce272d65e1f78621002008b07d1e0f03
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 10 Jul 2019 14:14:40 +0000 (10 16:14 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 12 Jul 2019 14:56:26 +0000 (12 10:56 -0400)
treee1820bab0f491b4bd98b33b14a8901110610f211
parent4d90b7a0e4aa8051d4a059d49e458e3378aa39ff
virtio-balloon: fix QEMU 4.0 config size migration incompatibility

The virtio-balloon config size changed in QEMU 4.0 even for existing
machine types.  Migration from QEMU 3.1 to 4.0 can fail in some
circumstances with the following error:

  qemu-system-x86_64: get_pci_config_device: Bad config data: i=0x10 read: a1 device: 1 cmask: ff wmask: c0 w1cmask:0

This happens because the virtio-balloon config size affects the VIRTIO
Legacy I/O Memory PCI BAR size.

Introduce a qdev property called "qemu-4-0-config-size" and enable it
only for the QEMU 4.0 machine types.  This way <4.0 machine types use
the old size, 4.0 uses the larger size, and >4.0 machine types use the
appropriate size depending on enabled virtio-balloon features.

Live migration to and from old QEMUs to QEMU 4.1 works again as long as
a versioned machine type is specified (do not use just "pc"!).

Originally-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20190710141440.27635-1-stefanha@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Tested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/core/machine.c
hw/virtio/virtio-balloon.c
include/hw/virtio/virtio-balloon.h