From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJGWB-0005Qv-Ux for qemu-devel@nongnu.org; Sat, 02 Jul 2016 04:43:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJGW4-0007F4-Up for qemu-devel@nongnu.org; Sat, 02 Jul 2016 04:43:15 -0400 Received: from 5.mo69.mail-out.ovh.net ([46.105.43.105]:59061) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJGW4-0007Eh-OV for qemu-devel@nongnu.org; Sat, 02 Jul 2016 04:43:08 -0400 Received: from player789.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo69.mail-out.ovh.net (Postfix) with ESMTP id 24859FFC698 for ; Sat, 2 Jul 2016 10:43:08 +0200 (CEST) Date: Sat, 2 Jul 2016 10:42:58 +0200 From: Greg Kurz Message-ID: <20160702104258.40790ade@bahia.lan> In-Reply-To: <20160702081543.GJ21596@in.ibm.com> References: <146741287399.948.15988269239450224065.stgit@bahia.lan> <146741293285.948.2129430864564241483.stgit@bahia.lan> <20160702081543.GJ21596@in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: Bharata B Rao Cc: David Gibson , Benjamin Herrenschmidt , qemu-devel@nongnu.org, Alexander Graf , qemu-ppc@nongnu.org, Cedric Le Goater , Scott Wood , Igor Mammedov On Sat, 2 Jul 2016 13:45:44 +0530 Bharata B Rao wrote: > 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. > I'm pretty sure they don't belong here :) ! But again, this is the very same code that we currently have in the target and I don't want to change behavior here (maybe I should mention it in the changelog). This can be fixed in a followup patch. > Regards, > Bharata. > Thanks for your feedback Bharata ! Cheers. -- Greg