s390x: Register all CPU properties as class properties
Class properties make QOM introspection simpler and easier, as they don't require an object to be instantiated. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Acked-by: Cornelia Huck <cohuck@redhat.com> Message-Id: <20200921221045.699690-13-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
1f14e38893
commit
ab76d63a88
@ -302,7 +302,6 @@ static void s390_cpu_initfn(Object *obj)
|
|||||||
timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_cpu_timer, cpu);
|
timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_cpu_timer, cpu);
|
||||||
s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu);
|
s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu);
|
||||||
#endif
|
#endif
|
||||||
s390_cpu_model_register_props(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void s390_cpu_finalize(Object *obj)
|
static void s390_cpu_finalize(Object *obj)
|
||||||
|
@ -1089,25 +1089,6 @@ static void set_feature_group(Object *obj, Visitor *v, const char *name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void s390_cpu_model_register_props(Object *obj)
|
|
||||||
{
|
|
||||||
S390FeatGroup group;
|
|
||||||
S390Feat feat;
|
|
||||||
|
|
||||||
for (feat = 0; feat < S390_FEAT_MAX; feat++) {
|
|
||||||
const S390FeatDef *def = s390_feat_def(feat);
|
|
||||||
object_property_add(obj, def->name, "bool", get_feature,
|
|
||||||
set_feature, NULL, (void *) feat);
|
|
||||||
object_property_set_description(obj, def->name, def->desc);
|
|
||||||
}
|
|
||||||
for (group = 0; group < S390_FEAT_GROUP_MAX; group++) {
|
|
||||||
const S390FeatGroupDef *def = s390_feat_group_def(group);
|
|
||||||
object_property_add(obj, def->name, "bool", get_feature_group,
|
|
||||||
set_feature_group, NULL, (void *) group);
|
|
||||||
object_property_set_description(obj, def->name, def->desc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void s390_cpu_model_initfn(Object *obj)
|
static void s390_cpu_model_initfn(Object *obj)
|
||||||
{
|
{
|
||||||
S390CPU *cpu = S390_CPU(obj);
|
S390CPU *cpu = S390_CPU(obj);
|
||||||
@ -1215,11 +1196,27 @@ static char *get_description(Object *obj, Error **errp)
|
|||||||
|
|
||||||
void s390_cpu_model_class_register_props(ObjectClass *oc)
|
void s390_cpu_model_class_register_props(ObjectClass *oc)
|
||||||
{
|
{
|
||||||
|
S390FeatGroup group;
|
||||||
|
S390Feat feat;
|
||||||
|
|
||||||
object_class_property_add_bool(oc, "migration-safe", get_is_migration_safe,
|
object_class_property_add_bool(oc, "migration-safe", get_is_migration_safe,
|
||||||
NULL);
|
NULL);
|
||||||
object_class_property_add_bool(oc, "static", get_is_static,
|
object_class_property_add_bool(oc, "static", get_is_static,
|
||||||
NULL);
|
NULL);
|
||||||
object_class_property_add_str(oc, "description", get_description, NULL);
|
object_class_property_add_str(oc, "description", get_description, NULL);
|
||||||
|
|
||||||
|
for (feat = 0; feat < S390_FEAT_MAX; feat++) {
|
||||||
|
const S390FeatDef *def = s390_feat_def(feat);
|
||||||
|
object_class_property_add(oc, def->name, "bool", get_feature,
|
||||||
|
set_feature, NULL, (void *) feat);
|
||||||
|
object_class_property_set_description(oc, def->name, def->desc);
|
||||||
|
}
|
||||||
|
for (group = 0; group < S390_FEAT_GROUP_MAX; group++) {
|
||||||
|
const S390FeatGroupDef *def = s390_feat_group_def(group);
|
||||||
|
object_class_property_add(oc, def->name, "bool", get_feature_group,
|
||||||
|
set_feature_group, NULL, (void *) group);
|
||||||
|
object_class_property_set_description(oc, def->name, def->desc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_KVM
|
#ifdef CONFIG_KVM
|
||||||
|
@ -260,7 +260,6 @@ static inline void s390_cpu_unhalt(S390CPU *cpu)
|
|||||||
|
|
||||||
|
|
||||||
/* cpu_models.c */
|
/* cpu_models.c */
|
||||||
void s390_cpu_model_register_props(Object *obj);
|
|
||||||
void s390_cpu_model_class_register_props(ObjectClass *oc);
|
void s390_cpu_model_class_register_props(ObjectClass *oc);
|
||||||
void s390_realize_cpu_model(CPUState *cs, Error **errp);
|
void s390_realize_cpu_model(CPUState *cs, Error **errp);
|
||||||
ObjectClass *s390_cpu_class_by_name(const char *name);
|
ObjectClass *s390_cpu_class_by_name(const char *name);
|
||||||
|
Loading…
Reference in New Issue
Block a user