Deriving from TYPE_SYS_BUS_DEVICE fixes the SoC object to be reset upon machine reset.
Signed-off-by: Bernhard Beschow <[email protected]> --- include/hw/arm/fsl-imx31.h | 5 ++--- hw/arm/fsl-imx31.c | 7 +------ hw/arm/kzm.c | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/include/hw/arm/fsl-imx31.h b/include/hw/arm/fsl-imx31.h index 41232a2237..ea916de15a 100644 --- a/include/hw/arm/fsl-imx31.h +++ b/include/hw/arm/fsl-imx31.h @@ -25,6 +25,7 @@ #include "hw/i2c/imx_i2c.h" #include "hw/gpio/imx_gpio.h" #include "hw/watchdog/wdt_imx2.h" +#include "hw/core/sysbus.h" #include "system/memory.h" #include "target/arm/cpu.h" #include "qom/object.h" @@ -38,10 +39,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(FslIMX31State, FSL_IMX31) #define FSL_IMX31_NUM_GPIOS 3 struct FslIMX31State { - /*< private >*/ - DeviceState parent_obj; + SysBusDevice parent_obj; - /*< public >*/ ARMCPU cpu; IMXAVICState avic; IMX31CCMState ccm; diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index 190f863355..dd929c1085 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -224,16 +224,11 @@ static void fsl_imx31_class_init(ObjectClass *oc, const void *data) dc->realize = fsl_imx31_realize; dc->desc = "i.MX31 SOC"; - /* - * Reason: uses serial_hds in realize and the kzm board does not - * support multiple CPUs - */ - dc->user_creatable = false; } static const TypeInfo fsl_imx31_type_info = { .name = TYPE_FSL_IMX31, - .parent = TYPE_DEVICE, + .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(FslIMX31State), .instance_init = fsl_imx31_init, .class_init = fsl_imx31_class_init, diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c index 387bf54ced..1e139c2c1f 100644 --- a/hw/arm/kzm.c +++ b/hw/arm/kzm.c @@ -69,7 +69,7 @@ static void kzm_init(MachineState *machine) object_initialize_child(OBJECT(machine), "soc", &s->soc, TYPE_FSL_IMX31); - qdev_realize(DEVICE(&s->soc), NULL, &error_fatal); + sysbus_realize_and_unref(SYS_BUS_DEVICE(&s->soc), &error_fatal); /* Check the amount of memory is compatible with the SOC */ if (machine->ram_size > (FSL_IMX31_SDRAM0_SIZE + FSL_IMX31_SDRAM1_SIZE)) { -- 2.55.0
