Received: from eggs.gnu.org ([2001:4830:134:3::10]:40449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYfLn-0004Gb-3w for qemu-devel@nongnu.org; Fri, 11 Apr 2014 13:34:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYfLa-0007Fu-Bg for qemu-devel@nongnu.org; Fri, 11 Apr 2014 13:34:51 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:54287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYfLZ-0007FI-HN for qemu-devel@nongnu.org; Fri, 11 Apr 2014 13:34:38 -0400 Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 12 Apr 2014 03:34:34 +1000 From: Alexey Kardashevskiy Date: Sat, 12 Apr 2014 03:34:26 +1000 Message-Id: <1397237667-22292-3-git-send-email-aik@ozlabs.ru> In-Reply-To: <1397237667-22292-1-git-send-email-aik@ozlabs.ru> References: <1397237667-22292-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH v2 2/3] target-ppc: Move alias lookup after class lookup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , qemu-ppc@nongnu.org, Alexander Graf This moves aliases lookup after CPU class lookup. This is to let new generic CPU to be found first if it is present and only if it is not (TCG case), use aliases. Signed-off-by: Alexey Kardashevskiy --- target-ppc/translate_init.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index c7afa62..709094c 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -8228,12 +8228,6 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name) } } - for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) { - if (strcmp(ppc_cpu_aliases[i].alias, name) == 0) { - return ppc_cpu_class_by_alias(&ppc_cpu_aliases[i]); - } - } - list = object_class_get_list(TYPE_POWERPC_CPU, false); item = g_slist_find_custom(list, name, ppc_cpu_compare_class_name); if (item != NULL) { @@ -8241,7 +8235,17 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name) } g_slist_free(list); - return ret; + if (ret) { + return ret; + } + + for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) { + if (strcmp(ppc_cpu_aliases[i].alias, name) == 0) { + return ppc_cpu_class_by_alias(&ppc_cpu_aliases[i]); + } + } + + return NULL; } PowerPCCPU *cpu_ppc_init(const char *cpu_model) -- 1.8.4.rc4