hw/arm: Mark the "fsl, imx" devices with user_creatable = false
cover hw/arm: Mark the "fsl, imx" devices with user_creatable = false
These devices can not be used by the user directly and cause QEMU to abort() if the user tried it anyway. So simply mark the devices with user_creatable = false to avoid that the users can run into this unpleasant situation.
Thomas Huth (3):
hw/arm: Mark the "fsl,imx6" device with user_creatable = false hw/arm: Mark the "fsl,imx25" device with user_creatable = false hw/arm: Mark the "fsl,imx31" device with user_creatable = false
hw/arm/fsl-imx25.c | 6 +++++- hw/arm/fsl-imx31.c | 6 +++++- hw/arm/fsl-imx6.c | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/3 hw/arm: Mark the "fsl, imx6" device with user_creatable = false
This device causes QEMU to abort if the user tries to instantiate it:
$ qemu-system-aarch64 -M sabrelite -smp 1,maxcpus=2 -device fsl,,imx6 Unexpected error in qemu_chr_fe_init() at chardev/char-fe.c:222: qemu-system-aarch64: -device fsl,,imx6: Device 'serial0' is in use Aborted (core dumped)
The device uses serial_hds[] directly in its realize function, so it can not be instantiated again by the user.
--- hw/arm/fsl-imx6.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/fsl-imx6.c +2 -1
@@ -440,8 +440,9 @@ static void fsl_imx6_class_init(ObjectClass *oc, void *data)DeviceClass *dc =DEVICE_CLASS (oc); dc->realize = fsl_imx6_realize; - dc->desc ="i.MX6 SOC" ; +/* Reason: Uses serial_hds[] in the realize() function */ + dc->user_creatable = false; }static const TypeInfo fsl_imx6_type_info = {
Signature · 1 line
1.8.3.1
PATCH 2/3 hw/arm: Mark the "fsl, imx25" device with user_creatable = false
In reply to Thomas HuthQEMU currently crashes when the user tries to instantiate the fsl,imx25 device manually:
$ aarch64-softmmu/qemu-system-aarch64 -S -M imx25-pdk -device fsl,,imx25 ** ERROR:/home/thuth/devel/qemu/tcg/tcg.c:538:tcg_register_thread: assertion failed: (n < max_cpus)
The imx25-pdk board (which is the one that uses this CPU type) only supports one CPU, and the realize function of the "fsl,imx25" device also uses serial_hds[] directly, so this device clearly can not be instantiated twice and thus we should mark it with user_creatable = 0.
--- hw/arm/fsl-imx25.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
hw/arm/fsl-imx25.c +5 -1
@@ -288,8 +288,12 @@ static void fsl_imx25_class_init(ObjectClass *oc, void *data)DeviceClass *dc =DEVICE_CLASS (oc); dc->realize = fsl_imx25_realize; - dc->desc ="i.MX25 SOC" ; +/* +* Reason: uses serial_hds in realize and the imx25 board does not +* support multiple CPUs +*/ + dc->user_creatable = false; }static const TypeInfo fsl_imx25_type_info = {
Signature · 1 line
1.8.3.1
PATCH 3/3 hw/arm: Mark the "fsl, imx31" device with user_creatable = false
In reply to Thomas HuthQEMU currently crashes when the user tries to instantiate the fsl,imx31 device manually:
$ aarch64-softmmu/qemu-system-aarch64 -M kzm -device fsl,,imx31 ** ERROR:/home/thuth/devel/qemu/tcg/tcg.c:538:tcg_register_thread: assertion failed: (n < max_cpus) Aborted (core dumped)
The kzm board (which is the one that uses this CPU type) only supports one CPU, and the realize function of the "fsl,imx31" device also uses serial_hds[] directly, so this device clearly can not be instantiated twice and thus we should mark it with user_creatable = false.
--- hw/arm/fsl-imx31.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
hw/arm/fsl-imx31.c +5 -1
@@ -260,8 +260,12 @@ static void fsl_imx31_class_init(ObjectClass *oc, void *data)DeviceClass *dc =DEVICE_CLASS (oc); 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 = {
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 10 lines · Thomas Huth
These devices can not be used by the user directly and cause QEMU to
abort()if the user tried it anyway. So simply mark the devices withuser_creatable= false to avoid that the users can run into this unpleasant situation.Thomas Huth (3):
hw/arm: Mark the "fsl,imx6" device withuser_creatable= false hw/arm: Mark the "fsl,imx25" device withuser_creatable= false hw/arm: Mark the "fsl,imx31" device withuser_creatable= false
Quoted 4 lines
hw/arm/fsl-imx25.c | 6 +++++- hw/arm/fsl-imx31.c | 6 +++++- hw/arm/fsl-imx6.c | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-)
Applied to target-arm.next, thanks.
-- PMM