mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
sysbus: Fix latent bug with onboard devices
The first call of sysbus_get_default() creates the main system bus and
stores it in QOM as "/machine/unattached/sysbus". This must not
happen before main() creates "/machine", or else container_get() would
"helpfully" create it as "container" object, and the real creation of
"/machine" would later abort with "attempt to add duplicate property
'machine' to object (type 'container')". Has been that way ever since
we wired up busses in QOM (commit f968fc6892
, v1.2.0).
I believe the bug is latent. I got it to bite by trying to
qdev_create() a sysbus device from a machine's .instance_init()
method.
The fix is obvious: store the main system bus in QOM right after
creating "/machine".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20190308131445.17502-5-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
fc4a473482
commit
e2fb3fbbf9
2 changed files with 4 additions and 3 deletions
|
@ -357,9 +357,6 @@ static void main_system_bus_create(void)
|
|||
qbus_create_inplace(main_system_bus, system_bus_info.instance_size,
|
||||
TYPE_SYSTEM_BUS, NULL, "main-system-bus");
|
||||
OBJECT(main_system_bus)->free = g_free;
|
||||
object_property_add_child(container_get(qdev_get_machine(),
|
||||
"/unattached"),
|
||||
"sysbus", OBJECT(main_system_bus), NULL);
|
||||
}
|
||||
|
||||
BusState *sysbus_get_default(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue