qemu/hw/virtio
Shmulik Ladkani 0560b0e97d virtio-pci: Set the QEMU_PCI_CAP_EXPRESS capability early in its DeviceClass realize method
In 1811e64 'hw/virtio: Add PCIe capability to virtio devices', the
QEMU_PCI_CAP_EXPRESS capability was added to virtio's pci_dev, within
'virtio_pci_realize' - the pci device object realization method.

This occurs to late, as 'pci_qdev_realize' (DeviceClass.realize of
TYPE_PCI_DEVICE) has already been called, without knowing that the
device instance is indeed an "express" instance, thus allocating
insufficient pci config space.

As a result, device may crash upon attempt to write to the PCIE config
space.

Fix, by arming the QEMU_PCI_CAP_EXPRESS capability early in virtio-pci's
own DeviceClass realize method.

This also makes code cleaner, as 'virtio_pci_realize' may now access the
'pci_is_express' predicate when needed.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Tested-by: Marcel Apfelbaum <marcel@redhat.com>
2015-12-02 21:51:33 +02:00
..
dataplane dataplane: support non-contigious s/g 2015-11-09 09:59:32 +00:00
Makefile.objs dataplane: endianness-aware accesses 2015-02-16 15:07:16 +00:00
vhost-backend.c vhost: rename RESET_DEVICE backto RESET_OWNER 2015-11-12 15:49:33 +02:00
vhost-user.c vhost-user: fix log size 2015-11-18 18:49:27 +02:00
vhost.c Revert "vhost: send SET_VRING_ENABLE at start/stop" 2015-11-26 12:02:11 +02:00
virtio-balloon.c Inhibit ballooning during postcopy 2015-11-10 15:00:28 +01:00
virtio-bus.c virtio: handle non-virtio-1-capable backend for ccw 2015-12-02 19:34:11 +02:00
virtio-mmio.c virtio: allow virtio-1 queue layout 2015-06-10 18:15:04 +02:00
virtio-pci.c virtio-pci: Set the QEMU_PCI_CAP_EXPRESS capability early in its DeviceClass realize method 2015-12-02 21:51:33 +02:00
virtio-pci.h virtio-pci: Set the QEMU_PCI_CAP_EXPRESS capability early in its DeviceClass realize method 2015-12-02 21:51:33 +02:00
virtio-rng.c virtio: get_features() can fail 2015-07-27 18:11:53 +03:00
virtio.c virtio-pci: fix 1.0 virtqueue migration 2015-11-12 15:49:32 +02:00