CI: https://gitlab.com/peterx/qemu/-/pipelines/2577688365
This is v1 of the series, rfc can be found here:
https://lore.kernel.org/r/20251209162857.857593-1-peterx@redhat.com
I got no positive feedback on OBJECT_COMPAT in rfc, so I dropped it.
This v1 removed all OBJECT_COMPAT patches, instead migration object will
stick with custom instance_post_init() to apply compat / global properties.
The goal of this series is to remove TYPE_DEVICE dependency for migration
object. As a side effect, making qdev-properties available to all objects
not only qdev.
After this series, other TYPE_OBJECT can also leverage qdev properties.
Quite a few features I liked:
- simple declaration on setter/getter/defaults, objects can define, e.g.,
Property prop = DEFINE_PROP_UINT32(...);
Then in its class_init(), do:
object_class_add_property(klass, &prop);
- support compat properties, and one more line to support -globals
Two things I intentionally didn't do:
- Go further to remove qdev properties dependency for migration object. In
that case I will need to implement most of the qdev property logic
separately, duplicating code.
- Go further to make qdev-properties to be some generic object-properties
concept. Logically we can do that but the rename all over the places
will be a huge diffstat. I don't want this simple and straightforward
change to be buried inside. So I hope (1) either it's not urgently
needed, then we can so far stick with calling it qdev-properties (say, if
we try grep qdev under qom/ we still get something.. so it's not like
we're 100% cleared out on that..), or (2) at least it can be done
separately as a separate goal.
Comments welcomed, thanks.
Peter Xu (4):
qdev: Pave way for exporting Property to be used in non-qdev
qdev: Introduce helper object_apply_globals()
qdev: Refactor and rename of qdev_class_add_property()
migration: Remove dependency to TYPE_DEVICE
include/hw/core/qdev-properties.h | 11 +++++++++
migration/migration.h | 2 +-
hw/core/qdev-properties.c | 36 ++++++++++++++++++++++-------
migration/migration.c | 33 +++++++++++++++-----------
tests/unit/test-qdev-global-props.c | 6 ++++-
5 files changed, 64 insertions(+), 24 deletions(-)
--
2.53.0