Received: from eggs.gnu.org ([2001:4830:134:3::10]:51581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJG5o-0003Yl-8Q for qemu-devel@nongnu.org; Sat, 02 Jul 2016 04:16:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJG5k-0002Sg-0Q for qemu-devel@nongnu.org; Sat, 02 Jul 2016 04:15:59 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:7819 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJG5j-0002SY-RP for qemu-devel@nongnu.org; Sat, 02 Jul 2016 04:15:55 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u628F7fN127148 for ; Sat, 2 Jul 2016 04:15:55 -0400 Received: from e28smtp01.in.ibm.com (e28smtp01.in.ibm.com [125.16.236.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 23x9rhr8bn-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sat, 02 Jul 2016 04:15:55 -0400 Received: from localhost by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 2 Jul 2016 13:45:52 +0530 Date: Sat, 2 Jul 2016 13:45:44 +0530 From: Bharata B Rao Reply-To: bharata@linux.vnet.ibm.com References: <146741287399.948.15988269239450224065.stgit@bahia.lan> <146741293285.948.2129430864564241483.stgit@bahia.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <146741293285.948.2129430864564241483.stgit@bahia.lan> Message-Id: <20160702081543.GJ21596@in.ibm.com> Subject: Re: [Qemu-devel] [PATCH v2 7/7] ppc: move the cpu_dt_id logic to machine code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: David Gibson , Benjamin Herrenschmidt , qemu-devel@nongnu.org, Alexander Graf , qemu-ppc@nongnu.org, Cedric Le Goater , Scott Wood , Igor Mammedov On Sat, Jul 02, 2016 at 12:42:12AM +0200, Greg Kurz wrote: > Now that every supported machine type is able to provide a cpu_index, we > can safely move all the cpu_dt_id bits to the machine code. > > TODO: the cpu_dt_id logic remains the same wannabe generic one as before > because of its target code background: machine types should provide their > own cpu_dt_id logic (it is required by the future powernv machine type for > example). > > Signed-off-by: Greg Kurz > --- > hw/ppc/ppc.c | 28 +++++++++++++++++++++++++++- > target-ppc/translate_init.c | 30 ------------------------------ > 2 files changed, 27 insertions(+), 31 deletions(-) > > diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c > index 12de255fb211..506b493bf43b 100644 > --- a/hw/ppc/ppc.c > +++ b/hw/ppc/ppc.c > @@ -1354,7 +1354,33 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id) > > void ppc_set_vcpu_dt_id(PowerPCCPU *cpu, int cpu_index, Error **errp) > { > - ; > + int max_smt = kvmppc_smt_threads(); > + int vcpu_dt_id; > + > + if (smp_threads > max_smt) { > + error_setg(errp, "Cannot support more than %d threads on PPC with %s", > + max_smt, kvm_enabled() ? "KVM" : "TCG"); > + return; > + } > + if (!is_power_of_2(smp_threads)) { > + error_setg(errp, "Cannot support %d threads on PPC with %s, " > + "threads count must be a power of 2.", > + smp_threads, kvm_enabled() ? "KVM" : "TCG"); > + return; > + } Not sure if the above two checks belong here in the routine which set the cpu_dt_id. Regards, Bharata.