diff mbox

[RFC,ppc-next] target-ppc: Report CPU aliases for QMP

Message ID 1361641944-21179-1-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber Feb. 23, 2013, 5:52 p.m. UTC
The QMP query-cpu-definitions implementation iterated over CPU classes
only, which were getting less and less as aliases were extracted.

Keep them in QMP as valid -cpu arguments even if not guaranteed stable.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-ppc/translate_init.c |   21 +++++++++++++++++++++
 1 Datei geändert, 21 Zeilen hinzugefügt(+)

Comments

Alexander Graf Feb. 25, 2013, 1:24 p.m. UTC | #1
On 23.02.2013, at 18:52, Andreas Färber wrote:

> The QMP query-cpu-definitions implementation iterated over CPU classes
> only, which were getting less and less as aliases were extracted.
> 
> Keep them in QMP as valid -cpu arguments even if not guaranteed stable.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>

I think this makes a lot of sense. Before, we weren't treating aliases and real cpu types differently either.

Thanks, applied to ppc-next.


Alex
diff mbox

Patch

diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 9cb8daa..d4871d1 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -8407,11 +8407,32 @@  CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
 {
     CpuDefinitionInfoList *cpu_list = NULL;
     GSList *list;
+    int i;
 
     list = object_class_get_list(TYPE_POWERPC_CPU, false);
     g_slist_foreach(list, ppc_cpu_defs_entry, &cpu_list);
     g_slist_free(list);
 
+    for (i = 0; i < ARRAY_SIZE(ppc_cpu_aliases); i++) {
+        const PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
+        ObjectClass *oc;
+        CpuDefinitionInfoList *entry;
+        CpuDefinitionInfo *info;
+
+        oc = ppc_cpu_class_by_name(alias->model);
+        if (oc == NULL) {
+            continue;
+        }
+
+        info = g_malloc0(sizeof(*info));
+        info->name = g_strdup(alias->alias);
+
+        entry = g_malloc0(sizeof(*entry));
+        entry->value = info;
+        entry->next = cpu_list;
+        cpu_list = entry;
+    }
+
     return cpu_list;
 }