diff options
author | Andreas Färber <afaerber@suse.de> | 2013-02-23 11:22:12 +0000 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2013-03-08 21:04:53 +0100 |
commit | 5ba4576b858c0d6056f59abb7e17a2b63f7905f3 (patch) | |
tree | 1aa6b8ae3180f0caf46576f5d304b57e530fedf7 /target-ppc/translate_init.c | |
parent | 987422bc4a4c6366ca6a7fbfa38a9920fd7ada2f (diff) |
target-ppc: Make host CPU a subclass of the host's CPU model
This avoids assigning individual class fields and contributors
forgetting to add field assignments in KVM-only code.
ppc_cpu_class_find_by_pvr() requires the CPU model classes to be
registered, so defer host CPU type registration to kvm_arch_init().
Only register the host CPU type if there is a class with matching PVR.
This lets us drop error handling from instance_init.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'target-ppc/translate_init.c')
-rw-r--r-- | target-ppc/translate_init.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 1783c22d4d..521cdcca8c 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -8298,13 +8298,6 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name) const char *p; int i, len; - if (strcasecmp(name, "host") == 0) { - if (kvm_enabled()) { - ret = object_class_by_name(TYPE_HOST_POWERPC_CPU); - } - return ret; - } - /* Check if the given name is a PVR */ len = strlen(name); if (len == 10 && name[0] == '0' && name[1] == 'x') { @@ -8405,6 +8398,9 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data) return; } #endif + if (unlikely(strcmp(typename, TYPE_HOST_POWERPC_CPU) == 0)) { + return; + } name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_POWERPC_CPU)); @@ -8427,6 +8423,11 @@ void ppc_cpu_list(FILE *f, fprintf_function cpu_fprintf) g_slist_foreach(list, ppc_cpu_list_entry, &s); g_slist_free(list); +#ifdef CONFIG_KVM + cpu_fprintf(f, "\n"); + cpu_fprintf(f, "PowerPC %-16s\n", "host"); +#endif + cpu_fprintf(f, "\n"); for (i = 0; i < ARRAY_SIZE(ppc_cpu_aliases); i++) { ObjectClass *oc = ppc_cpu_class_by_name(ppc_cpu_aliases[i].model); |