i.MX 8M Plus EVK Fixes
cover i.MX 8M Plus EVK Fixes
As discussed in [1], this series fixes the SoC class to be not user-creatable to prevent a crash, and to be derived from TYPE_SYS_BUS_DEVICE to make reset work properly. It also removes an unused define.
[1] https://lore.kernel.org/qemu-devel/[email protected]/
Bernhard Beschow (2):
hw/arm/fsl-imx8mp: Make SoC not user-creatable, derive from
TYPE_SYS_BUS_DEVICE
hw/arm/fsl-imx8mp: Remove unused define
include/hw/arm/fsl-imx8mp.h | 4 ++-- hw/arm/fsl-imx8mp.c | 4 +++- hw/arm/imx8mp-evk.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
2.48.1
PATCH 1/2 hw/arm/fsl-imx8mp: Make SoC not user-creatable, derive from TYPE_SYS_BUS_DEVICE
Fixes a crash when creating the SoC object on the command line:
$ ./qemu-system-aarch64 -M virt -device fsl-imx8mp ** ERROR:../../devel/qemu/tcg/tcg.c:1006:tcg_register_thread: assertion failed: (n < tcg_max_ctxs) Bail out! ERROR:../../devel/qemu/tcg/tcg.c:1006:tcg_register_thread: assertion failed: (n < tcg_max_ctxs) Aborted (core dumped)
Furthermore, the SoC object should be derived from TYPE_SYS_BUS_DEVICE such that it gets properly reset.
--- include/hw/arm/fsl-imx8mp.h | 3 ++- hw/arm/fsl-imx8mp.c | 4 +++- hw/arm/imx8mp-evk.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-)
include/hw/arm/fsl-imx8mp.h +2 -1
@@ -26,6 +26,7 @@#include "hw/timer/imx_gpt.h" #include "hw/usb/hcd-dwc3.h" #include "hw/watchdog/wdt_imx2.h" +#include "hw/sysbus.h" #include "qom/object.h" #include "qemu/units.h"
@@ -49,7 +50,7 @@ enum FslImx8mpConfiguration { };struct FslImx8mpState { -DeviceState parent_obj; +SysBusDevice parent_obj;ARMCPU cpu[FSL_IMX8MP_NUM_CPUS ];GICv3State gic;
hw/arm/fsl-imx8mp.c +3 -1
@@ -698,13 +698,15 @@ static void fsl_imx8mp_class_init(ObjectClass *oc, void *data)device_class_set_props (dc, fsl_imx8mp_properties); dc->realize = fsl_imx8mp_realize; +/* Reason: SoC can only be instantiated from a board */ + dc->user_creatable = false; dc->desc ="i.MX 8M Plus SoC" ; }static const TypeInfo fsl_imx8mp_types[] = { { .name =TYPE_FSL_IMX8MP , - .parent =TYPE_DEVICE , + .parent =TYPE_SYS_BUS_DEVICE , .instance_size =sizeof (FslImx8mpState), .instance_init = fsl_imx8mp_init, .class_init = fsl_imx8mp_class_init,
hw/arm/imx8mp-evk.c +1 -1
@@ -37,7 +37,7 @@ static void imx8mp_evk_init(MachineState *machine) s =FSL_IMX8MP (object_new (TYPE_FSL_IMX8MP ));object_property_add_child (OBJECT (machine),"soc" ,OBJECT (s));object_property_set_uint (OBJECT (s),"fec1-phy-num" ,1 , &error_fatal); -qdev_realize (DEVICE (s),NULL , &error_fatal); +sysbus_realize_and_unref (SYS_BUS_DEVICE (s), &error_fatal);memory_region_add_subregion (get_system_memory (),FSL_IMX8MP_RAM_START , machine->ram);
Signature · 1 line
2.48.1
Re: [PATCH 1/2] hw/arm/fsl-imx8mp: Make SoC not user-creatable, derive from TYPE_SYS_BUS_DEVICE
Quoted 17 lines · Bernhard Beschow
Fixes a crash when creating the SoC object on the command line:
$ ./qemu-system-aarch64 -M virt -device fsl-imx8mp ** ERROR:../../devel/qemu/tcg/tcg.c:1006:tcg_register_thread: assertion failed: (n < tcg_max_ctxs) Bail out! ERROR:../../devel/qemu/tcg/tcg.c:1006:tcg_register_thread: assertion failed: (n < tcg_max_ctxs) Aborted (core dumped)Furthermore, the SoC object should be derived from
TYPE_SYS_BUS_DEVICEsuch that it gets properly reset.Fixes a4eefc69b237 "hw/arm: Add i.MX 8M Plus EVK board"Reported-by Thomas Huth <[email protected]>Suggested-by Peter Maydell <[email protected]>Signed-off-by Bernhard Beschow <[email protected]>
Quoted 5 lines
--- include/hw/arm/fsl-imx8mp.h | 3 ++- hw/arm/fsl-imx8mp.c | 4 +++- hw/arm/imx8mp-evk.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-)
Re: [PATCH 1/2] hw/arm/fsl-imx8mp: Make SoC not user-creatable, derive from TYPE_SYS_BUS_DEVICE
In reply to Bernhard BeschowQuoted 49 lines · Bernhard Beschow
Fixes a crash when creating the SoC object on the command line:
$ ./qemu-system-aarch64 -M virt -device fsl-imx8mp ** ERROR:../../devel/qemu/tcg/tcg.c:1006:tcg_register_thread: assertion failed: (n < tcg_max_ctxs) Bail out! ERROR:../../devel/qemu/tcg/tcg.c:1006:tcg_register_thread: assertion failed: (n < tcg_max_ctxs) Aborted (core dumped)Furthermore, the SoC object should be derived from
TYPE_SYS_BUS_DEVICEsuch that it gets properly reset.Fixes a4eefc69b237 "hw/arm: Add i.MX 8M Plus EVK board"Reported-by Thomas Huth <[email protected]>Suggested-by Peter Maydell <[email protected]>Signed-off-by Bernhard Beschow <[email protected]>---
include/hw/arm/fsl-imx8mp.h | 3 ++- hw/arm/fsl-imx8mp.c | 4 +++- hw/arm/imx8mp-evk.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-)include/hw/arm/fsl-imx8mp.h +2
-1@@ -26,6 +26,7 @@#include "hw/timer/imx_gpt.h" #include "hw/usb/hcd-dwc3.h" #include "hw/watchdog/wdt_imx2.h" +#include "hw/sysbus.h" #include "qom/object.h" #include "qemu/units.h" @@ -49,7 +50,7 @@ enum FslImx8mpConfiguration { };struct FslImx8mpState { -DeviceState parent_obj; +SysBusDevice parent_obj;ARMCPU cpu[FSL_IMX8MP_NUM_CPUS ];GICv3State gic;hw/arm/fsl-imx8mp.c +0
-0
hw/arm/fsl-imx8mp.c static void fsl_imx8mp_class_init(ObjectClass *oc, void *data) · line 702
Quoted 5 lines
hw/arm/fsl-imx8mp.c +2
-0@@ -698,13 +698,15 @@ static void fsl_imx8mp_class_init(ObjectClass *oc, void *data)device_class_set_props (dc, fsl_imx8mp_properties); dc->realize = fsl_imx8mp_realize; +/* Reason: SoC can only be instantiated from a board */ + dc->user_creatable = false;
I think sysbus devices are not user creatable by default (that's why dynamic sysbus device was introduced) so either this or the .parent change below is enough. You can have both just in case but maybe not necessary as other sysbus devices usually don't set user_createble either.
Regards,
BALATON Zoltan
Quoted 25 lines
hw/arm/fsl-imx8mp.c +1
-1dc->desc ="i.MX 8M Plus SoC" ; }static const TypeInfo fsl_imx8mp_types[] = { { .name =TYPE_FSL_IMX8MP , - .parent =TYPE_DEVICE , + .parent =TYPE_SYS_BUS_DEVICE , .instance_size =sizeof (FslImx8mpState), .instance_init = fsl_imx8mp_init, .class_init = fsl_imx8mp_class_init,hw/arm/imx8mp-evk.c +1
-1@@ -37,7 +37,7 @@ static void imx8mp_evk_init(MachineState *machine) s =FSL_IMX8MP (object_new (TYPE_FSL_IMX8MP ));object_property_add_child (OBJECT (machine),"soc" ,OBJECT (s));object_property_set_uint (OBJECT (s),"fec1-phy-num" ,1 , &error_fatal); -qdev_realize (DEVICE (s),NULL , &error_fatal); +sysbus_realize_and_unref (SYS_BUS_DEVICE (s), &error_fatal);memory_region_add_subregion (get_system_memory (),FSL_IMX8MP_RAM_START , machine->ram);
Re: [PATCH 1/2] hw/arm/fsl-imx8mp: Make SoC not user-creatable, derive from TYPE_SYS_BUS_DEVICE
Quoted 28 lines · BALATON Zoltan
Quoted 26 lines · Bernhard Beschow
Fixes a crash when creating the SoC object on the command line:
$ ./qemu-system-aarch64 -M virt -device fsl-imx8mp ** ERROR:../../devel/qemu/tcg/tcg.c:1006:tcg_register_thread: assertion failed: (n < tcg_max_ctxs) Bail out! ERROR:../../devel/qemu/tcg/tcg.c:1006:tcg_register_thread: assertion failed: (n < tcg_max_ctxs) Aborted (core dumped)Furthermore, the SoC object should be derived from
TYPE_SYS_BUS_DEVICEsuch that it gets properly reset.Fixes a4eefc69b237 "hw/arm: Add i.MX 8M Plus EVK board"Reported-by Thomas Huth <[email protected]>Suggested-by Peter Maydell <[email protected]>Signed-off-by Bernhard Beschow <[email protected]>hw/arm/fsl-imx8mp.c +0
-0@@ -698,13 +698,15 @@ static void fsl_imx8mp_class_init(ObjectClass *oc, void *data)device_class_set_props (dc, fsl_imx8mp_properties); dc->realize = fsl_imx8mp_realize;
Quoted 7 lines
hw/arm/fsl-imx8mp.c static void fsl_imx8mp_class_init(ObjectClass *oc, void *data) · line 702
Quoted 2 lines
hw/arm/fsl-imx8mp.c +2
-0+/* Reason: SoC can only be instantiated from a board */ + dc->user_creatable = false;I think sysbus devices are not user creatable by default (that's why dynamic sysbus device was introduced) so either this or the .parent change below is enough. You can have both just in case but maybe not necessary as other sysbus devices usually don't set
user_createbleeither.
Yes, that's correct -- we don't need to manually set the user_creatable flag here now we've changed the parent class to be sysbus.
-- PMM
Re: [PATCH 1/2] hw/arm/fsl-imx8mp: Make SoC not user-creatable, derive from TYPE_SYS_BUS_DEVICE
Am 13. März 2025 10:12:18 UTC schrieb Peter Maydell <[email protected]>:
Quoted 37 lines · BALATON Zoltan
Quoted 28 lines · Bernhard Beschow
Quoted 26 lines
Fixes a crash when creating the SoC object on the command line:
$ ./qemu-system-aarch64 -M virt -device fsl-imx8mp ** ERROR:../../devel/qemu/tcg/tcg.c:1006:tcg_register_thread: assertion failed: (n < tcg_max_ctxs) Bail out! ERROR:../../devel/qemu/tcg/tcg.c:1006:tcg_register_thread: assertion failed: (n < tcg_max_ctxs) Aborted (core dumped)Furthermore, the SoC object should be derived from
TYPE_SYS_BUS_DEVICEsuch that it gets properly reset.Fixes a4eefc69b237 "hw/arm: Add i.MX 8M Plus EVK board"Reported-by Thomas Huth <[email protected]>Suggested-by Peter Maydell <[email protected]>Signed-off-by Bernhard Beschow <[email protected]>hw/arm/fsl-imx8mp.c +0
-0@@ -698,13 +698,15 @@ static void fsl_imx8mp_class_init(ObjectClass *oc, void *data)device_class_set_props (dc, fsl_imx8mp_properties); dc->realize = fsl_imx8mp_realize;Quoted 7 lines
hw/arm/fsl-imx8mp.c static void fsl_imx8mp_class_init(ObjectClass *oc, void *data) · line 702
Quoted 2 lines
hw/arm/fsl-imx8mp.c +2
-0+/* Reason: SoC can only be instantiated from a board */ + dc->user_creatable = false;I think sysbus devices are not user creatable by default (that's why dynamic sysbus device was introduced) so either this or the .parent change below is enough. You can have both just in case but maybe not necessary as other sysbus devices usually don't set
user_createbleeither.
Quoted 3 lines
Yes, that's correct -- we don't need to manually set the
user_creatableflag here now we've changed the parent class to be sysbus.
I'll send a patch later this day.
Best regards,
Bernhard
Quoted 2 lines
-- PMM
PATCH 2/2 hw/arm/fsl-imx8mp: Remove unused define
In reply to Bernhard BeschowThe SoC has three SPI controllers, not four. Remove the extra define of an SPI IRQ.
--- include/hw/arm/fsl-imx8mp.h | 1 - 1 file changed, 1 deletion(-)
include/hw/arm/fsl-imx8mp.h +0 -1
@@ -238,7 +238,6 @@ enum FslImx8mpIrqs {FSL_IMX8MP_ECSPI1_IRQ =31 ,FSL_IMX8MP_ECSPI2_IRQ =32 ,FSL_IMX8MP_ECSPI3_IRQ =33 , -FSL_IMX8MP_ECSPI4_IRQ =34 ,FSL_IMX8MP_I2C1_IRQ =35 , FSL_IMX8MP_I2C2_IRQ = 36,
Signature · 1 line
2.48.1