From 5bbb2641861934e1ba52151cb9eb4cfac581346c Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 9 Oct 2017 21:51:02 +0200 Subject: [PATCH] ppc: spapr: register 'host' core type along with the rest of core types consolidate 'host' core type registration by moving it from KVM specific code into spapr_cpu_core.c, similar like it's done in x86 target. Signed-off-by: Igor Mammedov Reviewed-by: Greg Kurz Acked-by: David Gibson Signed-off-by: David Gibson --- hw/ppc/spapr_cpu_core.c | 5 ++++- include/hw/ppc/spapr_cpu_core.h | 1 - target/ppc/kvm.c | 11 ----------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 9810697221..7dbf9c31c5 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -221,7 +221,7 @@ static Property spapr_cpu_core_properties[] = { DEFINE_PROP_END_OF_LIST() }; -void spapr_cpu_core_class_init(ObjectClass *oc, void *data) +static void spapr_cpu_core_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_CLASS(oc); @@ -259,6 +259,9 @@ static const TypeInfo spapr_cpu_core_type_infos[] = { DEFINE_SPAPR_CPU_CORE_TYPE("power8nvl_v1.0"), DEFINE_SPAPR_CPU_CORE_TYPE("power9_v1.0"), DEFINE_SPAPR_CPU_CORE_TYPE("power9_v2.0"), +#ifdef CONFIG_KVM + DEFINE_SPAPR_CPU_CORE_TYPE("host"), +#endif }; DEFINE_TYPES(spapr_cpu_core_type_infos) diff --git a/include/hw/ppc/spapr_cpu_core.h b/include/hw/ppc/spapr_cpu_core.h index 264ce68785..42765de392 100644 --- a/include/hw/ppc/spapr_cpu_core.h +++ b/include/hw/ppc/spapr_cpu_core.h @@ -38,5 +38,4 @@ typedef struct sPAPRCPUCoreClass { } sPAPRCPUCoreClass; char *spapr_get_cpu_core_type(const char *model); -void spapr_cpu_core_class_init(ObjectClass *oc, void *data); #endif diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index c2152ed52c..cb5777afa0 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2508,17 +2508,6 @@ static int kvm_ppc_register_host_cpu_type(void) oc = object_class_by_name(type_info.name); g_assert(oc); -#if defined(TARGET_PPC64) - type_info.name = g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, "host"); - type_info.parent = TYPE_SPAPR_CPU_CORE, - type_info.instance_size = sizeof(sPAPRCPUCore); - type_info.instance_init = NULL; - type_info.class_init = spapr_cpu_core_class_init; - type_info.class_data = (void *) POWERPC_CPU_TYPE_NAME("host"); - type_register(&type_info); - g_free((void *)type_info.name); -#endif - /* * Update generic CPU family class alias (e.g. on a POWER8NVL host, * we want "POWER8" to be a "family" alias that points to the current -- 2.42.0