Commit 9f9bdf43 authored by Markus Armbruster's avatar Markus Armbruster
Browse files

sysbus: Make devices picking up backends unavailable with -device



Device models aren't supposed to go on fishing expeditions for
backends.  They should expose suitable properties for the user to set.
For onboard devices, board code sets them.

A number of sysbus devices pick up block backends in their init() /
instance_init() methods with drive_get_next() instead: sl-nand,
milkymist-memcard, pl181, generic-sdhci.

Likewise, a number of sysbus devices pick up character backends in
their init() / realize() methods with qemu_char_get_next_serial():
cadence_uart, digic-uart, etraxfs,serial, lm32-juart, lm32-uart,
milkymist-uart, pl011, stm32f2xx-usart, xlnx.xps-uartlite.

All these mistakes are already marked FIXME.  See the commit that
added these FIXMEs for a more detailed explanation of what's wrong.

Fortunately, only machines ppce500 and pseries-* support -device with
sysbus devices, and none of the devices above is supported with these
machines.

Set cannot_instantiate_with_device_add_yet to preserve our luck.

Cc: Andrzej Zaborowski <balrogg@gmail.com>
Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: Antony Pavlov <antonynpavlov@gmail.com>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: Michael Walle <michael@walle.cc>
Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
parent 19109131
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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 = {
+2 −0
Original line number Diff line number Diff line
@@ -537,6 +537,8 @@ static void cadence_uart_class_init(ObjectClass *klass, void *data)
    dc->realize = cadence_uart_realize;
    dc->vmsd = &vmstate_cadence_uart;
    dc->reset = cadence_uart_reset;
    /* Reason: realize() method uses qemu_char_get_next_serial() */
    dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo cadence_uart_info = {
+2 −0
Original line number Diff line number Diff line
@@ -177,6 +177,8 @@ static void digic_uart_class_init(ObjectClass *klass, void *data)
    dc->realize = digic_uart_realize;
    dc->reset = digic_uart_reset;
    dc->vmsd = &vmstate_digic_uart;
    /* Reason: realize() method uses qemu_char_get_next_serial() */
    dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo digic_uart_info = {
+2 −0
Original line number Diff line number Diff line
@@ -236,6 +236,8 @@ static void etraxfs_ser_class_init(ObjectClass *klass, void *data)

    k->init = etraxfs_ser_init;
    dc->reset = etraxfs_ser_reset;
    /* Reason: init() method uses qemu_char_get_next_serial() */
    dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo etraxfs_ser_info = {
+2 −0
Original line number Diff line number Diff line
@@ -145,6 +145,8 @@ static void lm32_juart_class_init(ObjectClass *klass, void *data)
    k->init = lm32_juart_init;
    dc->reset = juart_reset;
    dc->vmsd = &vmstate_lm32_juart;
    /* Reason: init() method uses qemu_char_get_next_serial() */
    dc->cannot_instantiate_with_device_add_yet = true;
}

static const TypeInfo lm32_juart_info = {
Loading