@@ -154,12 +154,35 @@ void virtio_bus_set_vdev_config(VirtioBusState *bus, uint8_t *config)
}
}
+static char *virtio_bus_get_dev_path(DeviceState *dev)
+{
+ DeviceState *parent_dev = DEVICE(OBJECT(dev)->parent);
+ BusClass *parent_bus_klass = BUS_GET_CLASS(qdev_get_parent_bus(parent_dev));
+
+ /* pass this call up to the device's parent's bus to get at
+ * guest-visible hardware topology
+ */
+ if (parent_bus_klass->get_dev_path) {
+ return parent_bus_klass->get_dev_path(parent_dev);
+ }
+
+ return NULL;
+}
+
+static void virtio_bus_class_init(ObjectClass *klass, void *data)
+{
+ BusClass *k = BUS_CLASS(klass);
+
+ k->get_dev_path = virtio_bus_get_dev_path;
+}
+
static const TypeInfo virtio_bus_info = {
.name = TYPE_VIRTIO_BUS,
.parent = TYPE_BUS,
.instance_size = sizeof(VirtioBusState),
.abstract = true,
.class_size = sizeof(VirtioBusClass),
+ .class_init = virtio_bus_class_init,
};
>