From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1br4wy-00014s-LY for qemu-devel@nongnu.org; Mon, 03 Oct 2016 11:14:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1br4wt-0003n9-Sg for qemu-devel@nongnu.org; Mon, 03 Oct 2016 11:14:40 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1br4wt-0003mT-JL for qemu-devel@nongnu.org; Mon, 03 Oct 2016 11:14:35 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u93FDI05005796 for ; Mon, 3 Oct 2016 11:14:33 -0400 Received: from e23smtp04.au.ibm.com (e23smtp04.au.ibm.com [202.81.31.146]) by mx0a-001b2d01.pphosted.com with ESMTP id 25upb3c71h-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 03 Oct 2016 11:14:32 -0400 Received: from localhost by e23smtp04.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 4 Oct 2016 01:14:30 +1000 Date: Mon, 3 Oct 2016 20:44:22 +0530 From: Bharata B Rao Reply-To: bharata@linux.vnet.ibm.com References: <147549680021.17386.17361379735084290696.stgit@bahia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <147549680021.17386.17361379735084290696.stgit@bahia> Message-Id: <20161003151422.GA17192@in.ibm.com> Subject: Re: [Qemu-devel] [PATCH] spapr: fix check of cpu alias name in spapr_get_cpu_core_type() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: David Gibson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org On Mon, Oct 03, 2016 at 02:13:20PM +0200, Greg Kurz wrote: > If the user passes an alias name and a property to -cpu, QEMU fails to > find the CPU definition and exits. > > $ qemu-system-ppc64 -cpu POWER8E,compat=power7 > qemu-system-ppc64: Unable to find sPAPR CPU Core definition > > This happens because spapr_get_cpu_core_type() passes the full string from > the command line (i.e. "POWER8E,compat=power7") to ppc_cpu_lookup_alias(), > instead of the alias name piece only (i.e. "POWER8E"). > > The fix is to pass model_pieces[0] to ppc_cpu_lookup_alias(). > > Signed-off-by: Greg Kurz Reviewed-by: Bharata B Rao > --- > hw/ppc/spapr_cpu_core.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c > index 6f0533c34259..35d1873b9ff3 100644 > --- a/hw/ppc/spapr_cpu_core.c > +++ b/hw/ppc/spapr_cpu_core.c > @@ -92,20 +92,20 @@ char *spapr_get_cpu_core_type(const char *model) > gchar **model_pieces = g_strsplit(model, ",", 2); > > core_type = g_strdup_printf("%s-%s", model_pieces[0], TYPE_SPAPR_CPU_CORE); > - g_strfreev(model_pieces); > > /* Check whether it exists or whether we have to look up an alias name */ > if (!object_class_by_name(core_type)) { > const char *realmodel; > > g_free(core_type); > - realmodel = ppc_cpu_lookup_alias(model); > + core_type = NULL; > + realmodel = ppc_cpu_lookup_alias(model_pieces[0]); > if (realmodel) { > - return spapr_get_cpu_core_type(realmodel); > + core_type = spapr_get_cpu_core_type(realmodel); > } > - return NULL; > } > > + g_strfreev(model_pieces); > return core_type; > } >