diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index e4252528a69d7a8eee57070bbd650be9a8812175..89458690097fa573506f282a5ef8136179c2186b 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -33,6 +33,7 @@ #include "hw/timer/m48t59.h" #include "qemu/log.h" #include "qemu/error-report.h" +#include "qapi/error.h" #include "hw/loader.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" @@ -1350,3 +1351,28 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id) return NULL; } + +void ppc_cpu_parse_features(const char *cpu_model) +{ + CPUClass *cc; + ObjectClass *oc; + const char *typename; + gchar **model_pieces; + + model_pieces = g_strsplit(cpu_model, ",", 2); + if (!model_pieces[0]) { + error_report("Invalid/empty CPU model name"); + exit(1); + } + + oc = cpu_class_by_name(TYPE_POWERPC_CPU, model_pieces[0]); + if (oc == NULL) { + error_report("Unable to find CPU definition: %s", model_pieces[0]); + exit(1); + } + + typename = object_class_get_name(oc); + cc = CPU_CLASS(oc); + cc->parse_features(typename, model_pieces[1], &error_fatal); + g_strfreev(model_pieces); +} diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 0787c664865a5ff608f3e4ef2388dad0a7dc9afc..30d6800ab37c4835aaf83e6ae5c263a16238e749 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1812,6 +1812,8 @@ static void ppc_spapr_init(MachineState *machine) machine->cpu_model = kvm_enabled() ? "host" : "POWER7"; } + ppc_cpu_parse_features(machine->cpu_model); + if (mc->query_hotpluggable_cpus) { char *type = spapr_get_cpu_core_type(machine->cpu_model); diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h index 520c72a08d1138eab51897aa6da4c6e6ed7b9597..00c1fb1e720a10c521cbbc5146b9532eb44af159 100644 --- a/include/hw/ppc/ppc.h +++ b/include/hw/ppc/ppc.h @@ -106,4 +106,5 @@ enum { /* ppc_booke.c */ void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t flags); +void ppc_cpu_parse_features(const char *cpu_model); #endif