diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2015-05-26 16:34:47 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-05-31 16:27:18 +0200 |
commit | 6b8f1020540c27246277377aa2c3331ad2bfb160 (patch) | |
tree | 882fcff4a803fffaef50573fe343646e1e1f3f30 /hw/virtio/virtio-pci.c | |
parent | 2332333c9738b442fbbd5b83a1eaa6be656ab9b5 (diff) |
virtio: move host_features
Move host_features from the individual transport proxies into
the virtio device. Transports may continue to add feature bits
during device plugging.
This should it make easier to offer different sets of host features
for virtio-1/transitional support.
Tested-by: Shannon Zhao <shannon.zhao@linaro.org>
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>
Diffstat (limited to 'hw/virtio/virtio-pci.c')
-rw-r--r-- | hw/virtio/virtio-pci.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index c931790dd7..8ea723106d 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -306,7 +306,7 @@ static uint32_t virtio_ioport_read(VirtIOPCIProxy *proxy, uint32_t addr) switch (addr) { case VIRTIO_PCI_HOST_FEATURES: - ret = proxy->host_features; + ret = vdev->host_features; break; case VIRTIO_PCI_GUEST_FEATURES: ret = vdev->guest_features; @@ -434,12 +434,6 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address, } } -static unsigned virtio_pci_get_features(DeviceState *d) -{ - VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d); - return proxy->host_features; -} - static int kvm_virtio_pci_vq_vector_use(VirtIOPCIProxy *proxy, unsigned int queue_no, unsigned int vector, @@ -924,6 +918,7 @@ static void virtio_pci_device_plugged(DeviceState *d) VirtioBusState *bus = &proxy->bus; uint8_t *config; uint32_t size; + VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); config = proxy->pci_dev.config; if (proxy->class_code) { @@ -958,10 +953,8 @@ static void virtio_pci_device_plugged(DeviceState *d) proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD; } - virtio_add_feature(&proxy->host_features, VIRTIO_F_NOTIFY_ON_EMPTY); - virtio_add_feature(&proxy->host_features, VIRTIO_F_BAD_FEATURE); - proxy->host_features = virtio_bus_get_vdev_features(bus, - proxy->host_features); + virtio_add_feature(&vdev->host_features, VIRTIO_F_NOTIFY_ON_EMPTY); + virtio_add_feature(&vdev->host_features, VIRTIO_F_BAD_FEATURE); } static void virtio_pci_device_unplugged(DeviceState *d) @@ -999,7 +992,6 @@ static void virtio_pci_reset(DeviceState *qdev) static Property virtio_pci_properties[] = { DEFINE_PROP_BIT("virtio-pci-bus-master-bug-migration", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT, false), - DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features), DEFINE_PROP_END_OF_LIST(), }; @@ -1469,7 +1461,6 @@ static void virtio_pci_bus_class_init(ObjectClass *klass, void *data) k->load_config = virtio_pci_load_config; k->save_queue = virtio_pci_save_queue; k->load_queue = virtio_pci_load_queue; - k->get_features = virtio_pci_get_features; k->query_guest_notifiers = virtio_pci_query_guest_notifiers; k->set_host_notifier = virtio_pci_set_host_notifier; k->set_guest_notifiers = virtio_pci_set_guest_notifiers; |