+VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size)
+{
+    VirtIOS390Bus *bus;
+
+    bus = (VirtIOS390Bus *)qbus_create(&s390_virtio_bus_info, NULL, 
"s390-virtio");

While a cast works the political correct way to do this is using DO_UPCAST.

Also I'd suggest to add a sysbus -> s390-virtio bus bridge device, so your bus gets properly hooked up in the device tree. Have a look at the (quite simple) "isabus-bridge" device in isa-bus.c, which is used with 'qemu -M isapc'. You'll see the s390-virtio bus and all virtio devices attached to it in 'info qtree' then.

+    bus = (VirtIOS390Bus *)dev->qdev.parent_bus;

DO_UPCAST().

+VirtIOS390Device *s390_virtio_bus_console(VirtIOS390Bus *bus)
+{
+    return bus->console;
+}

What this is needed for?

cheers,
  Gerd


Reply via email to