qemu/hw/core
Markus Armbruster e2fb3fbbf9 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>
2019-03-11 22:53:44 +01:00
..
bus.c qdev: pass an Object * to qbus_set_hotplug_handler() 2019-02-17 21:54:02 +11:00
empty_slot.c core/empty_slot: Convert sysbus init function to realize function 2018-12-13 13:47:57 +00:00
fw-path-provider.c hw/core: Clean up includes 2016-01-29 15:07:25 +00:00
generic-loader.c elf: Add optional function ptr to load_elf() to parse ELF notes 2019-02-05 16:50:16 +01:00
hotplug.c call HotplugHandler->plug() as the last step in device realization 2018-10-19 13:44:12 +02:00
irq.c tcg: drop global lock during TCG code execution 2017-02-24 10:32:45 +00:00
Kconfig kconfig: introduce kconfig files 2019-03-07 21:45:53 +01:00
loader-fit.c hw: Use IEC binary prefix definitions from "qemu/units.h" 2018-07-02 15:41:10 +02:00
loader.c hw/core/loader.c: Read as long as possible in load_image_size() 2019-02-05 16:50:18 +01:00
machine.c virtio-blk: add "discard" and "write-zeroes" properties 2019-02-22 09:42:16 +00:00
Makefile.objs hw/core: Move null-machine into the common-obj list 2018-10-24 07:27:25 +01:00
nmi.c nmi: remove x86 specific nmi handling 2016-05-23 16:53:46 +02:00
null-machine.c hw/core: Move null-machine into the common-obj list 2018-10-24 07:27:25 +01:00
or-irq.c hw/core/or-irq: Support more than 16 inputs to an OR gate 2018-06-15 15:23:34 +01:00
platform-bus.c hw: Do not include "exec/address-spaces.h" if it is not necessary 2018-06-01 14:15:10 +02:00
ptimer.c ptimer: Add TRIGGER_ONLY_ON_DECREMENT policy option 2018-07-09 14:51:34 +01:00
qdev-fw.c linux-user: remove nmi.c and fw-path-provider.c 2018-01-23 14:20:52 +01:00
qdev-properties-system.c hw: set_netdev: remove useless code 2018-12-11 18:28:46 +01:00
qdev-properties.c qdev-props: call object_apply_global_props() 2019-01-07 16:18:42 +04:00
qdev.c qom: Move compat_props machinery from qdev to QOM 2019-03-11 22:53:44 +01:00
register.c hw/core/register: Add trailing '\n' to qemu_log() call 2018-06-08 13:15:33 +01:00
reset.c qemu/queue.h: leave head structs anonymous unless necessary 2019-01-11 15:46:55 +01:00
split-irq.c hw/core/split-irq: Device that splits IRQ lines 2018-03-02 11:03:45 +00:00
stream.c hw/core: Clean up includes 2016-01-29 15:07:25 +00:00
sysbus.c sysbus: Fix latent bug with onboard devices 2019-03-11 22:53:44 +01:00
uboot_image.h Support u-boot noload images for arm as used by, NetBSD/evbarm GENERIC kernel. 2019-01-07 15:46:20 +00:00