On Fri, Nov 04, 2016 at 01:26:41PM +1100, Alexey Kardashevskiy wrote:
> On 30/10/16 22:11, David Gibson wrote:
> > The 'cpu_version' field in PowerPCCPU is badly named.  It's named after the
> > 'cpu-version' device tree property where it is advertised, but that meaning
> > may not be obvious in most places it appears.
> > 
> > Worse, it doesn't even really correspond to that device tree property.  The
> > property contains either the processor's PVR, or, if the CPU is running in
> > a compatibility mode, a special "logical PVR" representing which mode.
> > 
> > Rename the cpu_version field, and a number of related variables to
> > compat_pvr to make this clearer.
> > 
> > Signed-off-by: David Gibson <da...@gibson.dropbear.id.au>
> > ---
> >  hw/ppc/spapr.c              |  4 ++--
> >  hw/ppc/spapr_hcall.c        | 30 +++++++++++++++---------------
> >  target-ppc/cpu.h            |  6 +++---
> >  target-ppc/kvm.c            |  4 ++--
> >  target-ppc/kvm_ppc.h        |  4 ++--
> >  target-ppc/translate_init.c | 10 +++++-----
> >  6 files changed, 29 insertions(+), 29 deletions(-)
> > 
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index b7762ee..276cefa 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -149,8 +149,8 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int 
> > offset, PowerPCCPU *cpu,
> >      uint32_t gservers_prop[smt_threads * 2];
> >      int index = ppc_get_vcpu_dt_id(cpu);
> >  
> > -    if (cpu->cpu_version) {
> > -        ret = fdt_setprop_cell(fdt, offset, "cpu-version", 
> > cpu->cpu_version);
> > +    if (cpu->compat_pvr) {
> 
> 
> Nit: g_assert(cpu->compat_pvr & 0x0F000000); may be?

That change wouldn't belong in this patch, which is purely a
mechanical s/cpu_version/compat_pvr/.

In general, I have considered such an assert(), but held back, because
I hand't spotted an actual document saying that range was explicitly
reserved for logical PVRs.  If you have such a reference, I'll look at
adding such an assert somewhere.

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature

Reply via email to