[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [Qemu-devel] [PATCH 10/10] pc: parse cpu features only on
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-arm] [Qemu-devel] [PATCH 10/10] pc: parse cpu features only once |
Date: |
Thu, 9 Jun 2016 10:25:52 -0300 |
User-agent: |
Mutt/1.6.1 (2016-04-27) |
On Thu, Jun 09, 2016 at 02:07:35PM +0200, Igor Mammedov wrote:
> On Wed, 8 Jun 2016 14:03:15 -0300
> Eduardo Habkost <address@hidden> 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
- Re: [Qemu-arm] [PATCH 03/10] target-i386: cpu: move xcc->kvm_required check to realize time, (continued)
[Qemu-arm] [PATCH 10/10] pc: parse cpu features only once, Igor Mammedov, 2016/06/06
[Qemu-arm] [PATCH 08/10] cpu: use CPUClass->parse_features() as convertor to global properties, Igor Mammedov, 2016/06/06
[Qemu-arm] [PATCH 05/10] target-i386: cpu: consolidate calls of object_property_parse() in x86_cpu_parse_featurestr, Igor Mammedov, 2016/06/06
[Qemu-arm] [PATCH 07/10] target-sparc: cpu: use sparc_cpu_parse_features() directly, Igor Mammedov, 2016/06/06