pxa2xx: Avoid object_get_link_property() assertion for "parent_bus"
PATCH 1/1 pxa2xx: Avoid object_get_link_property() assertion for "parent_bus"
pxa2xx_i2c_init() creates a pxa2xx-i2c-slave device on a second i2c-bus, which has a NULL parent device. This causes an assertion in object_get_canonical_path() when accessing pxa2xx-i2c-slave's "parent_bus" link<bus> property in tosa and likely other PXA2xx machines.
Fix this by using the pxa2xx_i2c device, created just before, as parent.
--- hw/arm/pxa2xx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/arm/pxa2xx.c +3 -1
@@ -1479,6 +1479,7 @@ PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base,DeviceState *dev;SysBusDevice *i2c_dev;PXA2xxI2CState *s; +i2c_bus *i2cbus; dev =qdev_create (NULL ,TYPE_PXA2XX_I2C );qdev_prop_set_uint32 (dev,"size" , region_size +1 );
@@ -1491,7 +1492,8 @@ PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base, s =PXA2XX_I2C (i2c_dev);/* FIXME: Should the slave device really be on a separate bus? */ - dev =i2c_create_slave (i2c_init_bus (NULL ,"dummy" ),"pxa2xx-i2c-slave" ,0 ); + i2cbus =i2c_init_bus (dev,"dummy" ); + dev =i2c_create_slave (i2cbus,"pxa2xx-i2c-slave" ,0 ); s->slave =FROM_I2C_SLAVE (PXA2xxI2CSlaveState,I2C_SLAVE (dev)); s->slave->host = s;
Signature · 1 line
1.8.1.4
Am 04.08.2013 15:05, schrieb Andreas Färber:
Quoted 8 lines
pxa2xx_i2c_init()creates a pxa2xx-i2c-slave device on a second i2c-bus, which has a NULL parent device. This causes an assertion inobject_get_canonical_path()when accessing pxa2xx-i2c-slave's "parent_bus" link<bus> property in tosa and likely other PXA2xx machines.Fix this by using the
pxa2xx_i2cdevice, created just before, as parent.Signed-off-by Andreas Färber <[email protected]>
CC'ing Anthony as this may be lurking elsewhere, too.
Unfortunately qtest can still only send QMP command but does not return the response, so we can't generically test walking the QOM composition tree in my proposed qom-test.
Andreas
Quoted 26 lines
--- hw/arm/pxa2xx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)hw/arm/pxa2xx.c +3
-1@@ -1479,6 +1479,7 @@ PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base,DeviceState *dev;SysBusDevice *i2c_dev;PXA2xxI2CState *s; +i2c_bus *i2cbus; dev =qdev_create (NULL ,TYPE_PXA2XX_I2C );qdev_prop_set_uint32 (dev,"size" , region_size +1 );@@ -1491,7 +1492,8 @@ PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base, s =PXA2XX_I2C (i2c_dev);/* FIXME: Should the slave device really be on a separate bus? */ - dev =i2c_create_slave (i2c_init_bus (NULL ,"dummy" ),"pxa2xx-i2c-slave" ,0 ); + i2cbus =i2c_init_bus (dev,"dummy" ); + dev =i2c_create_slave (i2cbus,"pxa2xx-i2c-slave" ,0 ); s->slave =FROM_I2C_SLAVE (PXA2xxI2CSlaveState,I2C_SLAVE (dev)); s->slave->host = s;
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Am 04.08.2013 15:17, schrieb Andreas Färber:
Quoted 8 lines
Am 04.08.2013 15:05, schrieb Andreas Färber:
Quoted 7 lines
pxa2xx_i2c_init()creates a pxa2xx-i2c-slave device on a second i2c-bus, which has a NULL parent device. This causes an assertion inobject_get_canonical_path()when accessing pxa2xx-i2c-slave's "parent_bus" link<bus> property in tosa and likely other PXA2xx machines.Fix this by using the
pxa2xx_i2cdevice, created just before, as parent.
Quoted 7 lines
Quoted 1 line
Signed-off-by Andreas Färber <[email protected]>CC'ing Anthony as this may be lurking elsewhere, too.
Unfortunately qtest can still only send QMP command but does not return the response, so we can't generically test walking the QOM composition tree in my proposed qom-test.
Came up with another way to test: The attached patch complementing my earlier qom-test series (and based on some more -kernel/-bios error avoidance for qtest) asserts that all buses except SysBus in the machine default configurations have a parent. SysBus is known to sit on /machine/unattached/sysbus and thus is fine, too.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
hw/core/qdev.c +1 -0
@@ -445,6 +445,7 @@ static void qbus_realize(BusState *bus, DeviceState *parent, const char *name)object_property_add_child (OBJECT (bus->parent), bus->name,OBJECT (bus),NULL );object_unref (OBJECT (bus)); }else if (bus !=sysbus_get_default ()) { +g_assert_not_reached ();/* TODO: once all bus devices are qdevified, only reset handler for main_system_bus should be registered here. */ qemu_register_reset (qbus_reset_all_fn, bus);
tests/Makefile +1 -0
@@ -103,6 +103,7 @@ check-qtest-microblaze-y += tests/qom-test$(EXESUF) check-qtest-microblazeel-y = $(check-qtest-microblaze-y) check-qtest-moxie-y += tests/qom-test$(EXESUF) check-qtest-or32-y += tests/qom-test$(EXESUF) +check-qtest-s390x-y += tests/qom-test$(EXESUF) check-qtest-unicore32-y += tests/qom-test$(EXESUF) check-qtest-xtensa-y += tests/qom-test$(EXESUF) check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
tests/qom-test.c +71 -2
101 lines not on this page · raw message
Anthony Liguori
AppliedApplied. Thanks.
Regards,
Anthony Liguori