Hi,
While working on a prototype and configuring a whole machine using QMP
we run into the following scenario.
Some device models use array properties. The array is allocated when
len-<arrayname> property is set, then, individual elements of the array
can be set as any other property (see description above the
DEFINE_PROP_ARRAY definition in qdev-properties.h for more details). We
need to do both (allocate the array and set its elements) before the
device can be realized. Attempting to set len-<arrayname> and array
elements in a single device_add command does not work because the order
of setting properties is not guaranteed, i.e. we're likely attempting to
set an element of the array that's not yet allocated.
Allowing the device initialize and realize phases to be split would
solve this problem. For example, the device_add would be issued with
'realized=false', we can set the len-<arrayname> in the same device_add
command or a following qom-set command, then we would use a sequence of
qom-set commands to set array elements, and at the end, we would realize
the device by issuing qom-set path=<device_id> property=realized
value=true. This is what we currently do in our prototype.
Another situation where we found that splitting initialize and realize
phases would solve a problem has been presented here:
https://lists.gnu.org/archive/html/qemu-devel/2021-06/msg07272.html
We would appreciate your feedback, any other proposals for solving both
problems are welcome.
Thanks,
Mirela
- RFC: QMP configuration - allocating/setting qdev array p... Mirela Grujic
-