On Thu, Jun 09, 2016 at 02:07:35PM +0200, Igor Mammedov wrote: > On Wed, 8 Jun 2016 14:03:15 -0300 > Eduardo Habkost <ehabk...@redhat.com> 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