aboutsummaryrefslogtreecommitdiff
path: root/target-s390x
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2016-09-05 10:52:17 +0200
committerCornelia Huck <cornelia.huck@de.ibm.com>2016-09-06 17:06:49 +0200
commit6efadc905038ac21e7a5e67392c88368932ec5a9 (patch)
treed2f50070b075d075b0e5df982bbec0eef20cd918 /target-s390x
parent41868f846d2ca5865c1706dc6529964bfa3dac6c (diff)
s390x/cpumodel: expose CPU class properties
Let's expose the description and migration safety and whether a definition is static, as class properties, this can be helpful in the future. Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Message-Id: <20160905085244.99980-4-dahi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'target-s390x')
-rw-r--r--target-s390x/cpu.c1
-rw-r--r--target-s390x/cpu.h1
-rw-r--r--target-s390x/cpu_models.c25
3 files changed, 27 insertions, 0 deletions
diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c
index 44e53ecd7b..d7d0b62ba0 100644
--- a/target-s390x/cpu.c
+++ b/target-s390x/cpu.c
@@ -445,6 +445,7 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
* object_unref().
*/
dc->cannot_destroy_with_object_finalize_yet = true;
+ s390_cpu_model_class_register_props(oc);
}
static const TypeInfo s390_cpu_type_info = {
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 0ea93216dd..4f14632928 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -633,6 +633,7 @@ extern void subsystem_reset(void);
void s390_cpu_list(FILE *f, fprintf_function cpu_fprintf);
#define cpu_list s390_cpu_list
+void s390_cpu_model_class_register_props(ObjectClass *oc);
void s390_realize_cpu_model(CPUState *cs, Error **errp);
ObjectClass *s390_cpu_class_by_name(const char *name);
diff --git a/target-s390x/cpu_models.c b/target-s390x/cpu_models.c
index 49969e87a1..b043c63cf1 100644
--- a/target-s390x/cpu_models.c
+++ b/target-s390x/cpu_models.c
@@ -110,6 +110,31 @@ static void s390_cpu_model_finalize(Object *obj)
{
}
+static bool get_is_migration_safe(Object *obj, Error **errp)
+{
+ return S390_CPU_GET_CLASS(obj)->is_migration_safe;
+}
+
+static bool get_is_static(Object *obj, Error **errp)
+{
+ return S390_CPU_GET_CLASS(obj)->is_static;
+}
+
+static char *get_description(Object *obj, Error **errp)
+{
+ return g_strdup(S390_CPU_GET_CLASS(obj)->desc);
+}
+
+void s390_cpu_model_class_register_props(ObjectClass *oc)
+{
+ object_class_property_add_bool(oc, "migration-safe", get_is_migration_safe,
+ NULL, NULL);
+ object_class_property_add_bool(oc, "static", get_is_static,
+ NULL, NULL);
+ object_class_property_add_str(oc, "description", get_description, NULL,
+ NULL);
+}
+
#ifdef CONFIG_KVM
static void s390_host_cpu_model_class_init(ObjectClass *oc, void *data)
{