diff mbox

[2/4] hw/s390x/s390-virtio-bus: Add virtio_s390_device_plugged for s390-virtio

Message ID 1429272826-4145-3-git-send-email-shannon.zhao@linaro.org
State New
Headers show

Commit Message

Shannon Zhao April 17, 2015, 12:13 p.m. UTC
Add virtio_s390_device_plugged, it can be used to get backend's features.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 hw/s390x/s390-virtio-bus.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox

Patch

diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
index 047c963..31fdf94 100644
--- a/hw/s390x/s390-virtio-bus.c
+++ b/hw/s390x/s390-virtio-bus.c
@@ -504,6 +504,15 @@  static unsigned virtio_s390_get_features(DeviceState *d)
     return dev->host_features;
 }
 
+/* This is called by virtio-bus just after the device is plugged. */
+static void virtio_s390_device_plugged(DeviceState *d)
+{
+    VirtIOS390Device *dev = to_virtio_s390_device(d);
+
+    dev->host_features = virtio_bus_get_vdev_features(&dev->bus,
+                                                      dev->host_features);
+}
+
 /**************** S390 Virtio Bus Device Descriptions *******************/
 
 static Property s390_virtio_net_properties[] = {
@@ -715,6 +724,7 @@  static void virtio_s390_bus_class_init(ObjectClass *klass, void *data)
     bus_class->max_dev = 1;
     k->notify = virtio_s390_notify;
     k->get_features = virtio_s390_get_features;
+    k->device_plugged = virtio_s390_device_plugged;
 }
 
 static const TypeInfo virtio_s390_bus_info = {