A number of sysbus devices abuse drive_get_next(): sl-nand, milkymist-memcard, pl181, generic-sdhci. If you can't see what's wrong with their use of drive_get_next(), check out the FIXMEs in their init() methods and the commit that added them.
We're in luck, though: only machines ppce500 and pseries-* support -device with sysbus devices, and none of the devices above is available with these machines. Set cannot_instantiate_with_device_add_yet to preserve our luck. Signed-off-by: Markus Armbruster <arm...@redhat.com> --- hw/arm/spitz.c | 2 ++ hw/sd/milkymist-memcard.c | 2 ++ hw/sd/pl181.c | 2 ++ hw/sd/sdhci.c | 3 +++ 4 files changed, 9 insertions(+) diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index da02932..5bf032a 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -1036,6 +1036,8 @@ static void sl_nand_class_init(ObjectClass *klass, void *data) k->init = sl_nand_init; dc->vmsd = &vmstate_sl_nand_info; dc->props = sl_nand_properties; + /* Reason: init() method uses drive_get() */ + dc->cannot_instantiate_with_device_add_yet = true; } static const TypeInfo sl_nand_info = { diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index 0cc53d9..2209ef1 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -297,6 +297,8 @@ static void milkymist_memcard_class_init(ObjectClass *klass, void *data) k->init = milkymist_memcard_init; dc->reset = milkymist_memcard_reset; dc->vmsd = &vmstate_milkymist_memcard; + /* Reason: init() method uses drive_get_next() */ + dc->cannot_instantiate_with_device_add_yet = true; } static const TypeInfo milkymist_memcard_info = { diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index bf37da6..11fcd47 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -508,6 +508,8 @@ static void pl181_class_init(ObjectClass *klass, void *data) sdc->init = pl181_init; k->vmsd = &vmstate_pl181; k->reset = pl181_reset; + /* Reason: init() method uses drive_get_next() */ + k->cannot_instantiate_with_device_add_yet = true; } static const TypeInfo pl181_info = { diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index ab13505..e4c70b5 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -1297,12 +1297,15 @@ static void sdhci_sysbus_class_init(ObjectClass *klass, void *data) dc->vmsd = &sdhci_vmstate; dc->props = sdhci_properties; dc->realize = sdhci_sysbus_realize; + /* Reason: instance_init() method uses drive_get_next() */ + dc->cannot_instantiate_with_device_add_yet = true; } static const TypeInfo sdhci_sysbus_info = { .name = TYPE_SYSBUS_SDHCI, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(SDHCIState), + /* FIXME SysBusDeviceClass init() instead of .instance_init */ .instance_init = sdhci_sysbus_init, .instance_finalize = sdhci_sysbus_finalize, .class_init = sdhci_sysbus_class_init, -- 1.9.3