Re: [PATCH 2/2 v3] MIPS: Ingenic: Fix bugs when calculate bogomips/lpj.

From: Paul Burton
Date: Fri Aug 02 2019 - 13:32:34 EST


Hi Paul,

On Thu, Aug 01, 2019 at 09:26:09PM -0400, Paul Cercueil wrote:
> > diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
> > index eb527a1..2bdd3e1 100644
> > --- a/arch/mips/kernel/cpu-probe.c
> > +++ b/arch/mips/kernel/cpu-probe.c
> > @@ -1964,6 +1964,13 @@ static inline void cpu_probe_ingenic(struct
> > cpuinfo_mips *c, unsigned int cpu)
> > c->cputype = CPU_XBURST;
> > c->writecombine = _CACHE_UNCACHED_ACCELERATED;
> > __cpu_name[cpu] = "Ingenic XBurst";
> > + /*
> > + * The XBurst core by default attempts to avoid branch target
> > + * buffer lookups by detecting & special casing loops. This
> > + * feature will cause BogoMIPS and lpj calculate in error.
> > + * Set cp0 config7 bit 4 to disable this feature.
> > + */
> > + set_c0_config7(MIPS_CONF7_BTB_LOOP_EN);
>
> Shouldn't it be MIPS_CONF7_BTB_LOOP_DIS then?
> Since the feature is disabled when the bit is set.

The name comes from the fact that we're enabling loops to use the BTB,
in contrast to the default state where this bit is zero & the bad
optimization kicks in causing loops not to use the BTB.

Thanks,
Paul