[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 2/7] hw/misc/macio: Fix crash when listing device prope
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 2/7] hw/misc/macio: Fix crash when listing device properties of macio device |
Date: |
Tue, 10 Apr 2018 22:52:28 +1000 |
From: Thomas Huth <address@hidden>
The macio-newworld device can currently be used to abort QEMU unexpectedly:
$ ppc-softmmu/qemu-system-ppc -S -M ref405ep,accel=qtest -qmp stdio
{"QMP": {"version": {"qemu": {"micro": 50, "minor": 11, "major": 2},
"package": "build-all"}, "capabilities": []}}
{ 'execute': 'qmp_capabilities' }
{"return": {}}
{ 'execute': 'device-list-properties',
'arguments': {'typename': 'macio-newworld'}}
Unexpected error in qemu_chr_fe_init() at chardev/char-fe.c:222:
Device 'serial0' is in use
Aborted (core dumped)
qdev properties should be set during realize(), not during instance_init(),
so move the related code there to fix this problem.
Signed-off-by: Thomas Huth <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Acked-by: Mark Cave-Ayland <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/misc/macio/macio.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 454244f59e..b74a6572b0 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -115,6 +115,13 @@ static void macio_common_realize(PCIDevice *d, Error
**errp)
memory_region_add_subregion(&s->bar, 0x16000,
sysbus_mmio_get_region(sysbus_dev, 0));
+ qdev_prop_set_uint32(DEVICE(&s->escc), "disabled", 0);
+ qdev_prop_set_uint32(DEVICE(&s->escc), "frequency", ESCC_CLOCK);
+ qdev_prop_set_uint32(DEVICE(&s->escc), "it_shift", 4);
+ qdev_prop_set_chr(DEVICE(&s->escc), "chrA", serial_hds[0]);
+ qdev_prop_set_chr(DEVICE(&s->escc), "chrB", serial_hds[1]);
+ qdev_prop_set_uint32(DEVICE(&s->escc), "chnBtype", escc_serial);
+ qdev_prop_set_uint32(DEVICE(&s->escc), "chnAtype", escc_serial);
object_property_set_bool(OBJECT(&s->escc), true, "realized", &err);
if (err) {
error_propagate(errp, err);
@@ -341,13 +348,6 @@ static void macio_instance_init(Object *obj)
object_property_add_child(obj, "dbdma", OBJECT(&s->dbdma), NULL);
object_initialize(&s->escc, sizeof(s->escc), TYPE_ESCC);
- qdev_prop_set_uint32(DEVICE(&s->escc), "disabled", 0);
- qdev_prop_set_uint32(DEVICE(&s->escc), "frequency", ESCC_CLOCK);
- qdev_prop_set_uint32(DEVICE(&s->escc), "it_shift", 4);
- qdev_prop_set_chr(DEVICE(&s->escc), "chrA", serial_hds[0]);
- qdev_prop_set_chr(DEVICE(&s->escc), "chrB", serial_hds[1]);
- qdev_prop_set_uint32(DEVICE(&s->escc), "chnBtype", escc_serial);
- qdev_prop_set_uint32(DEVICE(&s->escc), "chnAtype", escc_serial);
qdev_set_parent_bus(DEVICE(&s->escc), sysbus_get_default());
object_property_add_child(obj, "escc", OBJECT(&s->escc), NULL);
}
--
2.14.3
- [Qemu-ppc] [PULL 0/7] ppc-for-2.12 queue 20180410, David Gibson, 2018/04/10
- [Qemu-ppc] [PULL 1/7] target/ppc: Initialize lazy_tlb_flush correctly, David Gibson, 2018/04/10
- [Qemu-ppc] [PULL 2/7] hw/misc/macio: Fix crash when listing device properties of macio device,
David Gibson <=
- [Qemu-ppc] [PULL 7/7] roms/u-boot-sam460ex: Change to qemu git mirror and update, David Gibson, 2018/04/10
- [Qemu-ppc] [PULL 5/7] tests/boot-serial: Test the sam460ex board, David Gibson, 2018/04/10
- [Qemu-ppc] [PULL 4/7] spapr: Initialize reserved areas list in FDT in H_CAS handler, David Gibson, 2018/04/10
- [Qemu-ppc] [PULL 3/7] target/ppc: Fix backwards migration of msr_mask, David Gibson, 2018/04/10
- [Qemu-ppc] [PULL 6/7] sam460ex: Fix timer frequency and clock multipliers, David Gibson, 2018/04/10
- Re: [Qemu-ppc] [PULL 0/7] ppc-for-2.12 queue 20180410, Peter Maydell, 2018/04/10