qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 10/10] pc: parse cpu features only once


From: Eduardo Habkost
Subject: Re: [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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]