diff options
author | Maxime Coquelin <maxime.coquelin@redhat.com> | 2016-09-13 15:30:30 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2016-09-15 17:30:03 +0300 |
commit | d1b4259f1ab18af24e6a297edb6a8f71691f3256 (patch) | |
tree | bad5cbf06d5085c33a14b9f4a4f7d654e06772ec /hw/virtio/virtio-pci.h | |
parent | d1eb8f2acba579830cf3798c3c15ce51be852c56 (diff) | |
download | qemu-d1b4259f1ab18af24e6a297edb6a8f71691f3256.zip qemu-d1b4259f1ab18af24e6a297edb6a8f71691f3256.tar.gz qemu-d1b4259f1ab18af24e6a297edb6a8f71691f3256.tar.bz2 |
virtio-bus: Plug devices after features are negotiated
Currently, devices are plugged before features are negotiated.
If the backend doesn't support VIRTIO_F_VERSION_1, the transport
needs to rewind some settings.
This is the case for CCW, for which a post_plugged callback had
been introduced, where max_rev field is just updated if
VIRTIO_F_VERSION_1 is not supported by the backend.
For PCI, implementing post_plugged would be much more
complicated, so it needs to know whether the backend supports
VIRTIO_F_VERSION_1 at plug time.
Currently, nothing is done for PCI. Modern capabilities get
exposed to the guest even if VIRTIO_F_VERSION_1 is not supported
by the backend, which confuses the guest.
This patch replaces existing post_plugged solution with an
approach that fits with both transports.
Features negotiation is performed before ->device_plugged() call.
A pre_plugged callback is introduced so that the transports can
set their supported features.
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: qemu-stable@nongnu.org
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com> [ccw]
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Diffstat (limited to 'hw/virtio/virtio-pci.h')
-rw-r--r-- | hw/virtio/virtio-pci.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 0698157..541cbdb 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -181,6 +181,11 @@ static inline void virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy) proxy->disable_legacy = ON_OFF_AUTO_ON; } +static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy) +{ + proxy->disable_modern = true; +} + /* * virtio-scsi-pci: This extends VirtioPCIProxy. */ |