On Fri, Jan 24, 2020 at 02:54:04PM +0100, Igor Mammedov wrote: > On Fri, 24 Jan 2020 11:20:15 +0000 > Salil Mehta <salil.me...@huawei.com> wrote: > > > Hello, > > I am working on vCPU Hotplug feature for ARM64 and I am in mid of > > understanding some aspect of device_add/device_del interface of the QEMU. > > > > Observations: > > 1. Any object initialised by qmp_device_add() gets into /machine/unattached > > container. I traced the flow to code leg inside device_set_realized() > > 2. I could see the reverse qmp_device_del() expects the device to be in > > /machine/peripheral container. > > 3. I could see any object initially added to unattached container did not > > had their parents until object_add_property_child() was called further in > > the leg. > > which effectively meant a new property was created and property table > > populated and child was parented. > > 4. Generally, container /machine/peripheral was being used wherever > > DEVICE(dev)->id was present and non-null. > > > > Question: > > 1. Wanted to confirm my understanding about the use of having separate > > containers like unattached, peripheral and anonymous. > > > 2. At init time all the vcpus goes under *unattached* container. Now, > > qmp_device_del() cannot be used to unplug them. I am wondering > > device is put into 'unattached' in case it wasn't assigned a parent. > Usually it happens when board creates device directly. > > > if all the hotplug devices need to go under the *peripheral* container > > while they are hotplugged and during object init time as well? > > theoretically device_del may use QOM path (the later users can get with > query-hotpluggable-cpus), > but I think it's mostly debugging feature. > > users are supposed to specify 'id' during -device/device_add if they are > going to manage that device > afterwards (like unplugging it). Then they could use that 'id' in other > commands (including device_del) > > So 'id'-ed devices end up in 'peripheral' container > > > 3. I could not see any device being place under *anonymous* container > > during init time. What is the use of this container? > > if I recall it right, devices created with help of device_add but without > 'id' go to this container
BTW, ATM hw/acpi/cpu.c creates _EJ0 for all CPUs (except the 1st one). It might be cleaner to skip it for CPUs which don't have an id - what do you think? > > > > > I would be thankful for your valuable insights and answers and help in > > highlighting any gap in my understanding. > > > > Thanks in anticipation! > > > > Best Regards > > Salil > >