From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFXwO-0006pB-Qh for qemu-devel@nongnu.org; Tue, 21 Jun 2016 22:31:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFXwD-0007ym-8O for qemu-devel@nongnu.org; Tue, 21 Jun 2016 22:30:55 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:42472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFXwC-0007y3-VG for qemu-devel@nongnu.org; Tue, 21 Jun 2016 22:30:45 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u5M2TQFm055008 for ; Tue, 21 Jun 2016 22:30:39 -0400 Received: from e23smtp01.au.ibm.com (e23smtp01.au.ibm.com [202.81.31.143]) by mx0a-001b2d01.pphosted.com with ESMTP id 23pe0491um-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 21 Jun 2016 22:30:39 -0400 Received: from localhost by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 22 Jun 2016 12:30:37 +1000 Date: Wed, 22 Jun 2016 08:00:28 +0530 From: Bharata B Rao Reply-To: bharata@linux.vnet.ibm.com References: <1466238846-21365-1-git-send-email-bharata@linux.vnet.ibm.com> <20160621090957.20152960@igors-macbook-pro.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160621090957.20152960@igors-macbook-pro.local> Message-Id: <20160622023027.GB5613@in.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v0 1/1] spapr: Support setting of compat CPU type for CPU cores List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, thuth@redhat.com, Eduardo Habkost On Tue, Jun 21, 2016 at 09:09:57AM +0200, Igor Mammedov wrote: > On Sat, 18 Jun 2016 14:04:06 +0530 > Bharata B Rao wrote: > > > Compat CPU type is typically specified on -cpu cmdline option like: > > -cpu host,compat=power7 or -cpu POWER8E,compat=power7 etc. > > With the introduction of sPAPR CPU core devices, we need to support > > the same for core devices too. > > > > Support the specification of CPU compat type on device_add command for > > sPAPRCPUCore devices like: > > (qemu) device_add > > POWER8E-spapr-cpu-core,id=core3,compat=power7,core-id=24 > > > > Signed-off-by: Bharata B Rao > > --- > > Applies on ppc-for-2.7 branch of David Gibson's tree. > > > > hw/ppc/spapr.c | 8 +++++ > > hw/ppc/spapr_cpu_core.c | 73 > > +++++++++++++++++++++++++++++++++++++++++ > > include/hw/ppc/spapr_cpu_core.h | 2 ++ 3 files changed, 83 > > insertions(+) > > > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > index 778fa25..2049d7d 100644 > > --- a/hw/ppc/spapr.c > > +++ b/hw/ppc/spapr.c > > @@ -1807,6 +1807,7 @@ static void ppc_spapr_init(MachineState > > *machine) if (i < spapr_cores) { > > char *type = > > spapr_get_cpu_core_type(machine->cpu_model); Object *core; > > + char *compat; > > > > if (!object_class_by_name(type)) { > > error_report("Unable to find sPAPR CPU Core > > definition"); @@ -1818,6 +1819,13 @@ static void > > ppc_spapr_init(MachineState *machine) &error_fatal); > > object_property_set_int(core, core_dt_id, > > CPU_CORE_PROP_CORE_ID, &error_fatal); > > + compat = > > spapr_get_cpu_compat_type(machine->cpu_model); > > + if (compat) { > > + object_property_set_str(core, compat, "compat", > > + &error_fatal); > > + g_free(compat); > > + } > > + > > object_property_set_bool(core, true, "realized", > > &error_fatal); } > > } > > diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c > > index 3a5da09..9eb63cc 100644 > > --- a/hw/ppc/spapr_cpu_core.c > > +++ b/hw/ppc/spapr_cpu_core.c > > @@ -96,6 +96,24 @@ char *spapr_get_cpu_core_type(const char *model) > > return core_type; > > } > > > > +/* > > + * Returns the CPU compat type specified in -cpu @model. > > + */ > > +char *spapr_get_cpu_compat_type(const char *model) > CPUClass already has such parser and hook to override it in case of > target does legacy parsing, see CPUClass->parse_features. > Maybe extending generic core in similar way and reusing generic parser > will do the job. In fact, I am already using CPUClass->parse_features() to set the feature properties (which right now is only compat= for us) for core device. What I need in the above routine spapr_get_cpu_compat_type() is to extract "compat=", so that I can verify that the compat type specified with -device matches with what was specified with -cpu. > > However we are in progress [1] of converting legacy > -cpu cpuname,feat1=x,feat2=y,... > into a set of global properties > -global cputype.feat1=x ... > > it would be better if you wouldn't start using -cpu for features > but use directly -global mechanism, > for that you need only have a corresponding property in spapr_core type. Will this work be part of 2.7 ? If not, we will have to use -cpu to extract the compat type since powerpc core hotplug is already upstream. Regards, Bharata.