On 03/05/2018 08:22, Alexey Kardashevskiy wrote: > On 2/5/18 7:50 pm, Paolo Bonzini wrote: >> On 02/05/2018 11:33, Alexey Kardashevskiy wrote: >>>>>>>> +# Note: the handler creates an object, enumerates properties and >>>>>>>> destroys >>>>>>>> +# the object so it only lists properties created in >>>>>>>> TypeInfo::instance_init(). >>>>>>>> +# Since the instance_init() callback of the device object adds >>>>>>>> +# DeviceClass::props as object properties, they will be listed as >>>>>>>> well. >>> >>> There are roughly 400 of realize(), this is will take a bit of time :) >>> imho what it does belongs to .json, why it does exactly that belongs to the >>> git commit log. I'll walk through the realize() hook though, educate >>> myself, at least :) >> >> Cheer up, there are only 300 callers of object_property_add_* (apart >> from object_property_add_child which is generally not an issue). You >> could look at those instead. :) > > I did not have to go too far for an example: > > piix4_pm_realize() calls piix4_pm_add_propeties() and acpi_pcihp_init() and > piix4_acpi_system_hot_add_init() and these guys create > bool/uint8_ptr/uint16_ptr/uint32_ptr properties: > > > > hw/acpi/piix4.c|477| object_property_add_uint8_ptr(OBJECT(s), > ACPI_PM_PROP_ACPI_ENABLE_CMD, > hw/acpi/piix4.c|479| object_property_add_uint8_ptr(OBJECT(s), > ACPI_PM_PROP_ACPI_DISABLE_CMD, > hw/acpi/piix4.c|481| object_property_add_uint32_ptr(OBJECT(s), > ACPI_PM_PROP_GPE0_BLK, > hw/acpi/piix4.c|483| object_property_add_uint32_ptr(OBJECT(s), > ACPI_PM_PROP_GPE0_BLK_LEN, > hw/acpi/piix4.c|485| object_property_add_uint16_ptr(OBJECT(s), > ACPI_PM_PROP_SCI_INT, > hw/acpi/piix4.c|487| object_property_add_uint32_ptr(OBJECT(s), > ACPI_PM_PROP_PM_IO_BASE, > hw/acpi/piix4.c|642| object_property_add_bool(OBJECT(s), "cpu-hotplug-legacy",
Thanks! Though that could be done in instance_init as well. ICH9 already does it that way. >> Seriously, I think the problem with the comment is only that the reader >> most likely doesn't care about instance_init() or props, as those are >> QEMU implementation details. > > So I am putting the chunk below (cut-n-pasted from this thread) for each > command (i.e. twice) instead of my stuff and repost? Yes, please. paolo