mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
hw/s390x/css-bridge: Realize sysbus device before accessing it
qbus_new() should not be called on unrealized device. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20231019071611.98885-10-philmd@linaro.org>
This commit is contained in:
parent
675d717b9e
commit
840b4495ef
1 changed files with 3 additions and 4 deletions
|
@ -95,7 +95,6 @@ static const TypeInfo virtual_css_bus_info = {
|
||||||
|
|
||||||
VirtualCssBus *virtual_css_bus_init(void)
|
VirtualCssBus *virtual_css_bus_init(void)
|
||||||
{
|
{
|
||||||
VirtualCssBus *cbus;
|
|
||||||
BusState *bus;
|
BusState *bus;
|
||||||
DeviceState *dev;
|
DeviceState *dev;
|
||||||
|
|
||||||
|
@ -103,19 +102,19 @@ VirtualCssBus *virtual_css_bus_init(void)
|
||||||
dev = qdev_new(TYPE_VIRTUAL_CSS_BRIDGE);
|
dev = qdev_new(TYPE_VIRTUAL_CSS_BRIDGE);
|
||||||
object_property_add_child(qdev_get_machine(), TYPE_VIRTUAL_CSS_BRIDGE,
|
object_property_add_child(qdev_get_machine(), TYPE_VIRTUAL_CSS_BRIDGE,
|
||||||
OBJECT(dev));
|
OBJECT(dev));
|
||||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
|
||||||
|
|
||||||
/* Create bus on bridge device */
|
/* Create bus on bridge device */
|
||||||
bus = qbus_new(TYPE_VIRTUAL_CSS_BUS, dev, "virtual-css");
|
bus = qbus_new(TYPE_VIRTUAL_CSS_BUS, dev, "virtual-css");
|
||||||
cbus = VIRTUAL_CSS_BUS(bus);
|
|
||||||
|
|
||||||
/* Enable hotplugging */
|
/* Enable hotplugging */
|
||||||
qbus_set_hotplug_handler(bus, OBJECT(dev));
|
qbus_set_hotplug_handler(bus, OBJECT(dev));
|
||||||
|
|
||||||
|
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||||
|
|
||||||
css_register_io_adapters(CSS_IO_ADAPTER_VIRTIO, true, false,
|
css_register_io_adapters(CSS_IO_ADAPTER_VIRTIO, true, false,
|
||||||
0, &error_abort);
|
0, &error_abort);
|
||||||
|
|
||||||
return cbus;
|
return VIRTUAL_CSS_BUS(bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************** Virtual-css Bus Bridge Device ********************/
|
/***************** Virtual-css Bus Bridge Device ********************/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue