virtio: handle non-virtio-1-capable backend for ccw

If you run a qemu advertising VERSION_1 with an old kernel where
vhost did not yet support VERSION_1, you'll end up with a device
that is {modern pci|ccw revision 1} but does not advertise VERSION_1.
This is not a sensible configuration and is rejected by the Linux
guest drivers.

To fix this, add a ->post_plugged() callback invoked after features
have been queried that can handle the VERSION_1 bit being withdrawn
and change ccw to fall back to revision 0 if VERSION_1 is gone.

Note that pci is _not_ fixed; we'll need to rethink the approach
for the next release but at least for pci it's not a regression.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Cornelia Huck 2015-12-02 18:31:57 +01:00 committed by Michael S. Tsirkin
parent 6d0b908a62
commit 11380b3619
3 changed files with 20 additions and 0 deletions

View file

@ -59,6 +59,11 @@ typedef struct VirtioBusClass {
* This is called by virtio-bus just after the device is plugged.
*/
void (*device_plugged)(DeviceState *d, Error **errp);
/*
* Re-evaluate setup after feature bits have been validated
* by the device backend.
*/
void (*post_plugged)(DeviceState *d, Error **errp);
/*
* transport independent exit function.
* This is called by virtio-bus just before the device is unplugged.