diff options
author | Bharata B Rao <bharata@linux.vnet.ibm.com> | 2016-06-10 06:29:01 +0530 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2016-06-17 16:33:48 +1000 |
commit | 3b542549661eb216580e8b7683e13caa3950da45 (patch) | |
tree | 2f4b49c558b2f3073ca49107e20d2edeb03ec308 /target-ppc | |
parent | 3f97b53a682d2595747c926c00d78b9d406f1be0 (diff) |
spapr: Abstract CPU core device and type specific core devices
Add sPAPR specific abastract CPU core device that is based on generic
CPU core device. Use this as base type to create sPAPR CPU specific core
devices.
TODO:
- Add core types for other remaining CPU types
- Handle CPU model alias correctly
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target-ppc')
-rw-r--r-- | target-ppc/kvm.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 16208649c5..e14da60b77 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -42,6 +42,9 @@ #include "exec/memattrs.h" #include "sysemu/hostmem.h" #include "qemu/cutils.h" +#if defined(TARGET_PPC64) +#include "hw/ppc/spapr_cpu_core.h" +#endif //#define DEBUG_KVM @@ -2341,6 +2344,19 @@ PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void) return pvr_pcc; } +#if defined(TARGET_PPC64) +static void spapr_cpu_core_host_initfn(Object *obj) +{ + sPAPRCPUCore *core = SPAPR_CPU_CORE(obj); + char *name = g_strdup_printf("%s-" TYPE_POWERPC_CPU, "host"); + ObjectClass *oc = object_class_by_name(name); + + g_assert(oc); + g_free((void *)name); + core->cpu_class = oc; +} +#endif + static int kvm_ppc_register_host_cpu_type(void) { TypeInfo type_info = { @@ -2358,6 +2374,18 @@ static int kvm_ppc_register_host_cpu_type(void) type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc)); type_register(&type_info); +#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 = spapr_cpu_core_host_initfn, + type_info.class_init = NULL; + type_register(&type_info); + g_free((void *)type_info.name); + type_info.instance_size = 0; + type_info.instance_init = NULL; +#endif + /* Register generic family CPU class for a family */ pvr_pcc = ppc_cpu_get_family_class(pvr_pcc); dc = DEVICE_CLASS(pvr_pcc); |