Port-i386 archive

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

Re: Surely cpumodel isn't cumulative?



> On Mon, 30 Nov 2009, Stephen Borrill wrote:
> >> From i386/coretemp.c:
> >
> >        cpumodel = CPUID2MODEL(ci->ci_signature);
> >        /* extended model */
> >        cpumodel += CPUID2EXTMODEL(ci->ci_signature);
> >
> > But EXTMODEL is extra detail within a given model, they
> > can't be added together.
> >
> > i.e. model 0xe with ext model 0x1 is not the same as 0xf.
> >
> > Any unforeseen issues with just removing the second cpumodel
> > line (or altering it to cpuextmodel)?
> 
> This patch works for me on Xeon X3430:
> 
> --- coretemp.c  25 Mar 2009 22:53:51 -0000      1.12
> +++ coretemp.c  30 Nov 2009 15:28:40 -0000
> @@ -67,7 +67,7 @@
>          struct coretemp_softc *sc;
>          uint32_t regs[4];
>          uint64_t msr;
> -       int cpumodel, cpumask;
> +       int cpumodel, cpuextmodel, cpumask;
> 
>          /*
>           * CPUID 0x06 returns 1 if the processor has on-die thermal
> @@ -85,7 +85,7 @@
>              (int)device_unit(ci->ci_dev));
>          cpumodel = CPUID2MODEL(ci->ci_signature);
>          /* extended model */
> -       cpumodel += CPUID2EXTMODEL(ci->ci_signature);
> +       cpuextmodel = CPUID2EXTMODEL(ci->ci_signature);
>          cpumask = ci->ci_signature & 15;

On AMD you would write here:

   if (cpumodel == 0xf)
       cpumodel += cpuextmodel;

and the hunk below would work unchanged.
Check the Intel docs if you can do that on Intel, too.

 
>          /*
> @@ -113,7 +113,8 @@
>           * from the Linux coretemp driver.
>           */
>          sc->sc_tjmax = 100;
> -       if ((cpumodel == 0xf && cpumask >= 2) || cpumodel == 0xe) {
> +       if ((cpumodel == 0xf && cpumask >= 2) ||
> +           (cpumodel == 0xe && cpuextmodel != 1)) {
>                  msr = rdmsr(MSR_IA32_EXT_CONFIG);
>                  if (msr & (1 << 30))
>                          sc->sc_tjmax = 85;
> 
> -- 
> Stephen


Home | Main Index | Thread Index | Old Index