Hi
On Fri, Jun 5, 2026 at 3:12 AM Peter Xu <[email protected]> wrote:
>
> While doing that, we still want to keep the Property list that migration
> object used to use. Apply them directly to ObjectClass instead of setting
> them with a DeviceClass.
>
> Manually apply the two extra properties (compat properties, global
> settings) in an instance_post_init() hook, just like most of the rest
> users, see callers of object_apply_compat_props().
>
> Signed-off-by: Peter Xu <[email protected]>
> ---
> migration/migration.h | 2 +-
> migration/migration.c | 33 +++++++++++++++++++--------------
> 2 files changed, 20 insertions(+), 15 deletions(-)
>
> diff --git a/migration/migration.h b/migration/migration.h
> index 841f49b215..8bdb8e8e6b 100644
> --- a/migration/migration.h
> +++ b/migration/migration.h
> @@ -274,7 +274,7 @@ struct MigrationClass {
>
> struct MigrationState {
> /*< private >*/
> - DeviceState parent_obj;
> + Object parent_obj;
>
You need to change MigrationClass.parent_class too
> /*< public >*/
> QemuThread thread;
> diff --git a/migration/migration.c b/migration/migration.c
> index 074d3f2c69..f9f102e78a 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -3966,11 +3966,9 @@ fail:
>
> static void migration_class_init(ObjectClass *klass, const void *data)
> {
> - DeviceClass *dc = DEVICE_CLASS(klass);
> -
> - dc->user_creatable = false;
> - device_class_set_props_n(dc, migration_properties,
> - migration_properties_count);
> + for (int i = 0; i < migration_properties_count; i++) {
> + object_class_add_property(klass, &migration_properties[i]);
> + }
> }
>
> static void migration_instance_finalize(Object *obj)
> @@ -4028,21 +4026,28 @@ static bool migration_object_check(MigrationState
> *ms, Error **errp)
> return migrate_caps_check(old_caps, ms->capabilities, errp);
> }
>
> -static const TypeInfo migration_type = {
> - .name = TYPE_MIGRATION,
> +static void migration_instance_post_init(Object *obj)
> +{
> /*
> - * NOTE: TYPE_MIGRATION is not really a device, as the object is
> - * not created using qdev_new(), it is not attached to the qdev
> - * device tree, and it is never realized.
> + * Apply these properties on top of default values:
> *
> - * TODO: Make this TYPE_OBJECT once QOM provides something like
> - * TYPE_DEVICE's "-global" properties.
> + * (1) machine compat properties
> + * (2) -global settings in cmdlines
> + *
> + * Need to be applied in order so (2) takes precedence over (1).
> */
> - .parent = TYPE_DEVICE,
> + object_apply_compat_props(obj);
> + object_apply_globals(obj);
> +}
> +
> +static const TypeInfo migration_type = {
> + .name = TYPE_MIGRATION,
> + .parent = TYPE_OBJECT,
> .class_init = migration_class_init,
> - .class_size = sizeof(MigrationClass),
> + .class_size = sizeof(ObjectClass),
and this should still be MigrationClass
> .instance_size = sizeof(MigrationState),
> .instance_init = migration_instance_init,
> + .instance_post_init = migration_instance_post_init,
> .instance_finalize = migration_instance_finalize,
> };
>
> --
> 2.53.0
>
>
Otherwise, the series is good to me!