From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAzyH-0001kC-GB for qemu-devel@nongnu.org; Thu, 09 Jun 2016 09:26:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAzyF-0005SA-Bn for qemu-devel@nongnu.org; Thu, 09 Jun 2016 09:26:04 -0400 Date: Thu, 9 Jun 2016 10:25:52 -0300 From: Eduardo Habkost Message-ID: <20160609132552.GS18662@thinpad.lan.raisama.net> References: <1465226212-254093-1-git-send-email-imammedo@redhat.com> <1465226212-254093-11-git-send-email-imammedo@redhat.com> <20160608170315.GO18662@thinpad.lan.raisama.net> <20160609140735.535045d0@igors-macbook-pro.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160609140735.535045d0@igors-macbook-pro.local> Subject: Re: [Qemu-devel] [PATCH 10/10] pc: parse cpu features only once List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, blauwirbel@gmail.com, qemu-arm@nongnu.org, pbonzini@redhat.com, rth@twiddle.net On Thu, Jun 09, 2016 at 02:07:35PM +0200, Igor Mammedov wrote: > On Wed, 8 Jun 2016 14:03:15 -0300 > Eduardo Habkost wrote: [...] > > > - cpu = pc_new_cpu(machine->cpu_model, apic_id, &local_err); > > > + assert(pcms->possible_cpus->cpus[0].cpu); /* BSP is always > > > present */ > > > + oc = > > > OBJECT_CLASS(CPU_GET_CLASS(pcms->possible_cpus->cpus[0].cpu)); > > > > The same pattern will probably repeat in other machines. I > > wouldn't mind adding a new MachineState::cpu_type field, as we > > already have MachineState::cpu_model. > > > > MachineState::cpu_model could eventually go away if we move all > > parse_features() calls to generic code. > All of above should be done as one step i.e. > add cpu_type + drop cpu_model > When we are ready to call parsing from generic code but not now. > > For calling parsing from generic place, the only blocker is sparc > target. > It needs to be converted to CPU subtypes + features=>properties, > like hat you've done with x86. OK. We just need to keep that in mind and not forget to do that later. > [...] > > > + model_pieces = g_strsplit(machine->cpu_model, ",", 2); > > > + if (!model_pieces[0]) { > > > + error_report("Invalid/empty CPU model name"); > > > + exit(1); > > > + } > > > + > > > + oc = cpu_class_by_name(TYPE_X86_CPU, model_pieces[0]); > > > + if (oc == NULL) { > > > + error_report("Unable to find CPU definition: %s", > > > model_pieces[0]); > > > + exit(1); > > > + } > > > + typename = object_class_get_name(oc); > > > + cc = CPU_CLASS(oc); > > > + cc->parse_features(typename, model_pieces[1], &error_fatal); > > > + g_strfreev(model_pieces); > > > > Can we move this to a generic function to be reused by other > > machines? > It could be generalized and reduce similar site in virt-arm > to 1 function. I'll do it on top of this series. Thanks! -- Eduardo