On Tue, 6 Oct 2020, Eduardo Habkost wrote:
Hi,
While trying to understand how QOM properties are used in QEMU, I
stumbled upon multiple cases where alias properties are added at
realize time.
Now, I don't understand why those properties exist. As the
properties are added at realize time, I assume they aren't
supposed to be touched by the user at all. If they are not
supposed to be touched by the user, what exactly is the purpose
of those QOM properties?
For reference, these are the cases I've found:
$ git grep -nwpE
'object_property_add_alias|qdev_pass_gpios|qdev_alias_all_properties' | grep
-A1 realize
hw/arm/allwinner-a10.c=71=static void aw_a10_realize(DeviceState *dev, Error
**errp)
hw/arm/allwinner-a10.c:89: qdev_pass_gpios(DEVICE(&s->intc), dev, NULL);
--
hw/arm/allwinner-h3.c=232=static void allwinner_h3_realize(DeviceState *dev,
Error **errp)
hw/arm/allwinner-h3.c:359: object_property_add_alias(OBJECT(s), "sd-bus",
OBJECT(&s->mmc0),
--
hw/arm/armsse.c=429=static void armsse_realize(DeviceState *dev, Error **errp)
hw/arm/armsse.c:1092: qdev_pass_gpios(dev_secctl, dev, "mscexp_status");
--
hw/arm/armv7m.c=149=static void armv7m_realize(DeviceState *dev, Error **errp)
hw/arm/armv7m.c:219: qdev_pass_gpios(DEVICE(&s->nvic), dev, NULL);
--
hw/arm/bcm2835_peripherals.c=128=static void
bcm2835_peripherals_realize(DeviceState *dev, Error **errp)
hw/arm/bcm2835_peripherals.c:322: object_property_add_alias(OBJECT(s), "sd-bus",
OBJECT(&s->gpio), "sd-bus");
--
hw/arm/bcm2836.c=69=static void bcm2836_realize(DeviceState *dev, Error **errp)
hw/arm/bcm2836.c:87: object_property_add_alias(OBJECT(s), "sd-bus",
OBJECT(&s->peripherals),
hw/arm/msf2-soc.c=79=static void m2sxxx_soc_realize(DeviceState *dev_soc, Error
**errp)
hw/arm/msf2-soc.c:170: object_property_add_alias(OBJECT(s), bus_name,
--
hw/arm/nrf51_soc.c=58=static void nrf51_soc_realize(DeviceState *dev_soc, Error
**errp)
hw/arm/nrf51_soc.c:138: qdev_pass_gpios(DEVICE(&s->gpio), dev_soc, NULL);
--
hw/arm/xlnx-zynqmp.c=276=static void xlnx_zynqmp_realize(DeviceState *dev,
Error **errp)
hw/arm/xlnx-zynqmp.c:522: object_property_add_alias(OBJECT(s), bus_name, sdhci,
"sd-bus");
--
hw/misc/mac_via.c=1011=static void mac_via_realize(DeviceState *dev, Error
**errp)
hw/misc/mac_via.c:1028: object_property_add_alias(OBJECT(dev), "irq[0]",
OBJECT(ms),
Mark likely knows this one. I think he mentioned once that it may be used
for storing reference to some object that needs to be accessed later but I
could be wrong, haven't checked actual code only recalling from memory.
Regards,
BALATON Zoltan
--
hw/ppc/spapr_drc.c=511=static void realize(DeviceState *d, Error **errp)
hw/ppc/spapr_drc.c:530: object_property_add_alias(root_container, link_name,
hw/riscv/sifive_e.c=186=static void sifive_e_soc_realize(DeviceState *dev,
Error **errp)
hw/riscv/sifive_e.c:233: qdev_pass_gpios(DEVICE(&s->gpio), dev, NULL);
hw/riscv/sifive_u.c=651=static void sifive_u_soc_realize(DeviceState *dev,
Error **errp)
hw/riscv/sifive_u.c:743: qdev_pass_gpios(DEVICE(&s->gpio), dev, NULL);