* VRM(VRD) detection versus CPUID
@ 2005-05-19 6:25 Rudolf Marek
2005-05-19 6:25 ` Rudolf Marek
` (22 more replies)
0 siblings, 23 replies; 24+ messages in thread
From: Rudolf Marek @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
Hello,
I finally finished some code to detect correct VRM using CPUID.
What the code does?
If AMD
/*Duron&Ahlon has VRM 9x*/
if Opteron VRM_AMD_OPTERON
If INTEL
FOR /* P6 Family */
ret = VRM_INTEL_8x;
but /* 0xB Tualatin */ and maybe /* 0x9 ????? it has 0.13um */
has ret = VRM_INTEL_85;
FOR p4 Family
everything except model 3 has ret = VRM_INTEL_9x;
model 3 is prescott 90nm it has VRD 10 (my name is ret VRM_INTEL_10x; /* 0x3 prescott */)
ELSE
VRM_NONE
I belive this is correct.
You can get it here:
http://ssh.cz/~ruik/cpuidvrm.c
http://ssh.cz/~ruik/Makefile
make -C /usr/src/linux-2.6.6 SUBDIRS=$PWD modules
Cut & paste from relevant part of source will follow at the end of this
message.
What is needed now ?
0) review by people here
1) test the code for different processors, mainly see if Tualatin is
working and opteron. Simply insmod the module and see
the output VRM_NONE = 0 etc..
2) how to or who will incorporate this into the drivers? (Khali maybe?)
3) Little problem:
//Linux/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
#define CPUID_PROCESSOR_SIGNATURE 1 /* function 1
*/
#define OPTERON_XFAM_MOD 0x00000f50 /* xtended fam, fam +
model */
#define CPUID_XFAM_MOD 0x0ff00ff0 /* xtended fam, fam +
model */
I need this from that header file but dont know how to get it clever way.
Thats all for now. Comments wellcome.
Thanks
Regards
Rudolf
C0re code:
typedef enum { VRM_NONE,VRM_INTEL_8x, VRM_INTEL_85,VRM_INTEL_9x,
VRM_INTEL_10x,,VRM_AMD_OPTERON} vrm_t;
static vrm_t whichVRM(void) {
vrm_t ret=VRM_NONE;
struct cpuinfo_x86 *c = cpu_data;
u32 eax;
if (c->x86_vendor = X86_VENDOR_AMD) {
if (c->x86 = 6) {
/*Duron&Ahlon has VRM 9x*/
ret = VRM_INTEL_9x;
} else
{
eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
if ((eax & CPUID_XFAM_MOD) = OPTERON_XFAM_MOD) {
/* opteron */
ret = VRM_AMD_OPTERON; }
}
}
else if (c->x86_vendor = X86_VENDOR_INTEL) {
if (c->x86=6) {
/* P6 Family */
ret = VRM_INTEL_8x;
if ((c->x86_model = 0xB) || (c->x86_model = 0x9)) {
ret = VRM_INTEL_85; /* 0x9 ????? it has 0.13um */
/* 0xB Tualatin */
}
} else if (c->x86=0xF) {
/*P4 family*/
ret = VRM_INTEL_9x;
if (c->x86_model = 3) {
ret = VRM_INTEL_10x; /* 0x3 prescott */
}
}
} else {
ret = VRM_NONE;
}
return ret;
}
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (10 preceding siblings ...)
2005-05-19 6:25 ` Jean Delvare
@ 2005-05-19 6:25 ` Mark M. Hoffman
2005-05-19 6:25 ` Rudolf Marek
` (10 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Mark M. Hoffman @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
Hi Rudolf:
* Rudolf Marek <R.Marek@sh.cvut.cz> [2004-06-30 19:38:33 +0200]:
>
> Hello,
>
> I finally finished some code to detect correct VRM using CPUID.
>
> What the code does?
>
> If AMD
> /*Duron&Ahlon has VRM 9x*/
> if Opteron VRM_AMD_OPTERON
> If INTEL
> FOR /* P6 Family */
> ret = VRM_INTEL_8x;
> but /* 0xB Tualatin */ and maybe /* 0x9 ????? it has 0.13um */
> has ret = VRM_INTEL_85;
> FOR p4 Family
> everything except model 3 has ret = VRM_INTEL_9x;
> model 3 is prescott 90nm it has VRD 10 (my name is ret > VRM_INTEL_10x; /* 0x3 prescott */)
> ELSE
> VRM_NONE
>
> I belive this is correct.
It's not a bad start. I wonder if it should be implemented literally as
a table; with vendor id, family, model, and stepping. Walk the table to
find the answer. Although, I guess the VRM spec can't differ due to
different processor stepping alone?
> You can get it here:
>
> http://ssh.cz/~ruik/cpuidvrm.c
> http://ssh.cz/~ruik/Makefile
> make -C /usr/src/linux-2.6.6 SUBDIRS=$PWD modules
As I found it, it doesn't actually compile for me... misplaced paren.
> Cut & paste from relevant part of source will follow at the end of this
> message.
>
> What is needed now ?
>
> 0) review by people here
> 1) test the code for different processors, mainly see if Tualatin is
> working and opteron. Simply insmod the module and see
> the output VRM_NONE = 0 etc..
> 2) how to or who will incorporate this into the drivers? (Khali maybe?)
>
> 3) Little problem:
> //Linux/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
> #define CPUID_PROCESSOR_SIGNATURE 1 /* function 1
> */
> #define OPTERON_XFAM_MOD 0x00000f50 /* xtended fam, fam +
> model */
> #define CPUID_XFAM_MOD 0x0ff00ff0 /* xtended fam, fam +
> model */
>
> I need this from that header file but dont know how to get it clever way.
That's a symptom of a bigger problem... we don't want to suddenly make
all the sensors chip drivers depend on x86. I.e. we'll need trivial stubs
for other architectures. How many of those even have VID? No idea.
Regards,
--
Mark M. Hoffman
mhoffman@lightlink.com
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (13 preceding siblings ...)
2005-05-19 6:25 ` Rudolf Marek
@ 2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Jean Delvare
` (7 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Jean Delvare @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
>> ELSE
>> VRM_NONE
I would say VRM_UNKNOWN. You don't know about any other CPU, especially
not any *future* CPU.
>It's not a bad start. I wonder if it should be implemented literally as
>a table; with vendor id, family, model, and stepping. Walk the table to
>find the answer. Although, I guess the VRM spec can't differ due to
>different processor stepping alone?
Ever seen a CPUID table from Intel docs? You wouldn't believe there are
that many different versions for each CPU. If we can forget about the
stepping it *may* be possible to have a way shorter table, but it's
likely to be still rather large.
Ruik, can we actually forget about the stepping (at least for the
existing CPUs)?
If we don't go with a simple (but large) lookup table, there are two
choices left: simple algorithmic and rules-based (much like dmi_scan.c
does). I think that the latter is the easier to maintain. Rules would
look like:
{ cpu manufacturer, family, from product, to product, (from stepping, to
stepping), VRM }
If stepping (or even product) is not relevant we define a negative
constant standing for "any" and use it.
I guess that it'll be stlighly slower than raw algorithmic but it
doesn't matter. It'll still be fast enough and is really only called
once.
>> 0) review by people here
>> 1) test the code for different processors, mainly see if Tualatin is
>> working and opteron. Simply insmod the module and see
>> the output VRM_NONE = 0 etc..
I have a Tualatin on my laptop but unfortunately no hardware monitoring
chip on it, and I don't think the BIOS will let me know the voltage...
I'll still try this evening.
>> 2) how to or who will incorporate this into the drivers? (Khali maybe?)
The good thing here is that it can be done step by step. We can just add
the function to i2c_sensor, then convert existing drivers to it as time
permits. I don't think we want a separate modue for it, do we?
Maybe we can merge i2c_vid.h into i2c_sensor.h after that, or maybe we
don't care.
>> 3) Little problem:
>> //Linux/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
>> #define CPUID_PROCESSOR_SIGNATURE 1 /* function 1
>> */
>> #define OPTERON_XFAM_MOD 0x00000f50 /* xtended fam, fam +
>> model */
>> #define CPUID_XFAM_MOD 0x0ff00ff0 /* xtended fam, fam +
>> model */
>>
>> I need this from that header file but dont know how to get it clever way.
>
>That's a symptom of a bigger problem... we don't want to suddenly make
>all the sensors chip drivers depend on x86. I.e. we'll need trivial stubs
>for other architectures. How many of those even have VID? No idea.
I don't see the problem. We know which architecture we are compiling the
module for. Just enclose the whole stuff (including the arch-specific
#include) into #ifdef CONFIG_X86. For other archs we default to an empty
function returning VRM_UNKNOWN. If we later learn about non-x86 chips
we'll update the file.
Am I missing something?
Jean Delvare
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (5 preceding siblings ...)
2005-05-19 6:25 ` Jean Delvare
@ 2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Greg KH
` (15 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Rudolf Marek @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
> >> ELSE
> >> VRM_NONE
>
> I would say VRM_UNKNOWN. You don't know about any other CPU, especially
> not any *future* CPU.
Sure
> Ruik, can we actually forget about the stepping (at least for the
> existing CPUs)?
Yes we can, but we must care about extended family and extended model in
future
>
> If we don't go with a simple (but large) lookup table, there are two
> choices left: simple algorithmic and rules-based (much like dmi_scan.c
> does). I think that the latter is the easier to maintain. Rules would
> look like:
>
> { cpu manufacturer, family, from product, to product, (from stepping, to
> stepping), VRM }
>
> If stepping (or even product) is not relevant we define a negative
> constant standing for "any" and use it.
Before I answer this.
I think We dont need that header file. I need only some masks from that
#defines so I can live without that. It wont be use in table concept
anyway.
Output from CPUID:
eax = cpuid_eax(1);
Bits Description
0..3 Stepping
4..7 Model c->x86_model
8..11 Family c->x86
12..13 Processor type
16..19 Extended Model
20..27 Extended Family
??? unknown value?
-- dont care
F in Family => refer to extended family.
Exteded model seems unused
Here is the table:
c->x86_vendor=VENDOR_AMD
============
Family|Model|ExtFamily|ExtModel
=============== 6 -- -- -- VRM_INTEL_9x; //athlons etc
F 4 0 ??? perhaps 9x //Athlon 64
F 5 0 ??? VRM_AMD_OPTERON //Opteron
c->x86_vendor = X86_VENDOR_INTEL
================
Family|Model|ExtFamily|ExtModel
=============== 6 B -- -- VRM_INTEL_85 /* 0xB Tualatin */
6 9 -- -- VRM_INTEL_85 // this is also 0.13um
6 -- -- -- VRM_INTEL_8x //rest P6 CPU's
7 ??????????????????????? ??????????? //Itanium
F 3 0 -- VRM_INTEL_10x //Pentium P4 (0.09 um)
F -- 0 -- VRM_INTEL_9x //All P4 before Prescott
F ??? 1 ??? ?????????? //Itanium 2
For completeness only
==========
F 0 0 -- VRM_INTEL_9x //Pentium IV (0.18 um)
F 1 0 -- VRM_INTEL_9x //Pentium IV (0.18 um)
F 2 0 -- VRM_INTEL_9x //Pentium IV (0.13 um)
> I have a Tualatin on my laptop but unfortunately no hardware monitoring
> chip on it, and I don't think the BIOS will let me know the voltage...
> I'll still try this evening.
Only try if that code really finds it :) If it will produce right
number...
>
> >> 2) how to or who will incorporate this into the drivers? (Khali maybe?)
>
> The good thing here is that it can be done step by step. We can just add
> the function to i2c_sensor, then convert existing drivers to it as time
> permits. I don't think we want a separate modue for it, do we?
No function will be great I think.
One think in closing. I found Itanium2 VID and they are different from all
above...
I guess I should implement some code that will go through the tables it
the format I proposed?
Regards
Rudolf
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
@ 2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Jean Delvare
` (21 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Rudolf Marek @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
I think we can get rid off the Extened family and extended model
I just found:
The terms effective family and effective model describe the expanded 8-bit
family and 8-bit model numbers as computed using the extended family,
family, extended model, and model fields.
So if family is 0xF just add extended family to it
and extended model bit concat with model.
ef_family = ext_fam + 0xF
ef_model = ext_model<<4 + model
I found this in AMD Processor Recognition Application Note page 28.
On the other hand on page 75 of Intel Processor Identification
and the CPUID Instruction Application Note 485
in the code is if model is 0xF extended model is printed.
I havent seen any CPU with family F model F and with some ext model
specified did someone?
Maybe we can do that computation in case of family F and save two fields
from table for all cases.
Any ideas, comments?
Regards
Rudolf
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (3 preceding siblings ...)
2005-05-19 6:25 ` Jean Delvare
@ 2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Jean Delvare
` (17 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Rudolf Marek @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
Hello
I just made second version of VRM detection code. I won't be here starting
from friday afternoon until sunday evening.
Any comments & ideas ? :)
Thanks
Regards
Rudolf
Here is produced code:
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
typedef enum { VRM_UNKNOWN,VRM_INTEL_8x, VRM_INTEL_85,VRM_INTEL_9x, \
VRM_INTEL_10x, VRM_INTEL_ITANIUM2,VRM_AMD_OPTERON} vrm_t;
typedef struct {
u8 vendor;
u8 eff_family;
u8 eff_model;
vrm_t vrm_type;
} vrm_models_t;
#define ANY 0xFF
vrm_models_t vrm_models[] = {
{X86_VENDOR_AMD,0x6,ANY,VRM_INTEL_9x}, //athlon duron etc
{X86_VENDOR_AMD,0xF,4,VRM_INTEL_9x}, //Athlon 64
{X86_VENDOR_AMD,0xF,5,VRM_AMD_OPTERON},
{X86_VENDOR_INTEL,0x6,0x9,VRM_INTEL_85}, /* 0.13um too */
{X86_VENDOR_INTEL,0x6,0xB,VRM_INTEL_85}, /* 0xB Tualatin */
{X86_VENDOR_INTEL,0x6,ANY,VRM_INTEL_8x}, /* any P6 */
{X86_VENDOR_INTEL,0x7,ANY,VRM_UNKNOWN}, /* Itanium */
{X86_VENDOR_INTEL,0xF,0x3,VRM_INTEL_10x}, /* P4 Prescott */
{X86_VENDOR_INTEL,0xF,ANY,VRM_INTEL_9x}, /* P4 before
Prescott*/
{X86_VENDOR_INTEL,0x10,ANY,VRM_INTEL_ITANIUM2} /*Itanium 2*/
};
#define num_models (sizeof(vrm_models) / sizeof(vrm_models_t) )
vrm_t find_vrm(u8 ef,u8 em,u8 vendor) {
int i;
for (i=0;i<num_models;i++) {
if (vrm_models[i].vendor=vendor)
if
((vrm_models[i].eff_family=ef)&&((vrm_models[i].eff_model=ef)|| \
((vrm_models[i].eff_model=ANY)))) return vrm_models[i].vrm_type;
}
return VRM_UNKNOWN;
}
static vrm_t whichVRM(void) {
struct cpuinfo_x86 *c = cpu_data;
u32 eax;
u8 f,m;
if (c->x86 < 6) return VRM_UNKNOWN; /* any CPU with familly lower than 6
dont have VID and/or CPUID*/
eax = cpuid_eax(1);
f = ((eax & 0x00000F00)>>8);
m = ((eax & 0x000000F0)>>4);
if (f = 0xF) {
f+=((eax & 0x00F00000)>>20);
m+=((eax & 0x000F0000)>>16)<<4;
}
return find_vrm(f,m,c->x86_vendor);
}
complete source http://ssh.cz/~ruik/cpuidvrm2.c
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (14 preceding siblings ...)
2005-05-19 6:25 ` Jean Delvare
@ 2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Jean Delvare
` (6 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Jean Delvare @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
>typedef struct {
>u8 vendor;
>u8 eff_family;
>u8 eff_model;
>vrm_t vrm_type;
>} vrm_models_t;
>#define ANY 0xFF
What is 0xFF is ever a valid value for eff_model?
>vrm_models_t vrm_models[] = {
> {X86_VENDOR_AMD,0x6,ANY,VRM_INTEL_9x}, //athlon duron etc
> {X86_VENDOR_AMD,0xF,4,VRM_INTEL_9x}, //Athlon 64
> {X86_VENDOR_AMD,0xF,5,VRM_AMD_OPTERON},
> {X86_VENDOR_INTEL,0x6,0x9,VRM_INTEL_85}, /* 0.13um too */
> {X86_VENDOR_INTEL,0x6,0xB,VRM_INTEL_85}, /* 0xB Tualatin */
> {X86_VENDOR_INTEL,0x6,ANY,VRM_INTEL_8x}, /* any P6 */
> {X86_VENDOR_INTEL,0x7,ANY,VRM_UNKNOWN}, /* Itanium */
> {X86_VENDOR_INTEL,0xF,0x3,VRM_INTEL_10x}, /* P4 Prescott */
> {X86_VENDOR_INTEL,0xF,ANY,VRM_INTEL_9x}, /* P4 before
>Prescott*/
> {X86_VENDOR_INTEL,0x10,ANY,VRM_INTEL_ITANIUM2} /*Itanium 2*/
> };
>#define num_models (sizeof(vrm_models) / sizeof(vrm_models_t) )
I think that the usual practice for this kind of lookup tables is to have
an "empty" final line and rely on it to detect the end of the table.
Your method looks OK too, but maybe there's a reason why kernel folks
seem to prefer the empty last line?
>vrm_t find_vrm(u8 ef,u8 em,u8 vendor) {
>int i;
>
>for (i=0;i<num_models;i++) {
> if (vrm_models[i].vendor=vendor)
> if
>((vrm_models[i].eff_family=ef)&&((vrm_models[i].eff_model=ef)|| \
^^
em
> ((vrm_models[i].eff_model=ANY)))) return vrm_models[i].vrm_type;
> }
>return VRM_UNKNOWN;
>}
>static vrm_t whichVRM(void) {
>struct cpuinfo_x86 *c = cpu_data;
>
>u32 eax;
>u8 f,m;
Please use longer variable names in the final code. Short varible names
make the code harder to read.
> eax = cpuid_eax(1);
> f = ((eax & 0x00000F00)>>8);
> m = ((eax & 0x000000F0)>>4);
> if (f = 0xF) {
> f+=((eax & 0x00F00000)>>20);
No <<4 here?
> m+=((eax & 0x000F0000)>>16)<<4;
> }
>return find_vrm(f,m,c->x86_vendor);
Looks overwise really good, I'll test this on as many systems as
possible soon.
Thanks,
Jean Delvare
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (16 preceding siblings ...)
2005-05-19 6:25 ` Jean Delvare
@ 2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Rudolf Marek
` (4 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Rudolf Marek @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
On Fri, 2 Jul 2004, Jean Delvare wrote:
>
> >typedef struct {
> >u8 vendor;
> >u8 eff_family;
> >u8 eff_model;
> >vrm_t vrm_type;
> >} vrm_models_t;
> >#define ANY 0xFF
>
> What is 0xFF is ever a valid value for eff_model?
No, model is 4 bit :)
>
> >vrm_models_t vrm_models[] = {
> > {X86_VENDOR_AMD,0x6,ANY,VRM_INTEL_9x}, //athlon duron etc
> > {X86_VENDOR_AMD,0xF,4,VRM_INTEL_9x}, //Athlon 64
> > {X86_VENDOR_AMD,0xF,5,VRM_AMD_OPTERON},
> > {X86_VENDOR_INTEL,0x6,0x9,VRM_INTEL_85}, /* 0.13um too */
> > {X86_VENDOR_INTEL,0x6,0xB,VRM_INTEL_85}, /* 0xB Tualatin */
> > {X86_VENDOR_INTEL,0x6,ANY,VRM_INTEL_8x}, /* any P6 */
> > {X86_VENDOR_INTEL,0x7,ANY,VRM_UNKNOWN}, /* Itanium */
> > {X86_VENDOR_INTEL,0xF,0x3,VRM_INTEL_10x}, /* P4 Prescott */
> > {X86_VENDOR_INTEL,0xF,ANY,VRM_INTEL_9x}, /* P4 before
> >Prescott*/
> > {X86_VENDOR_INTEL,0x10,ANY,VRM_INTEL_ITANIUM2} /*Itanium 2*/
> > };
> >#define num_models (sizeof(vrm_models) / sizeof(vrm_models_t) )
>
> I think that the usual practice for this kind of lookup tables is to have
> an "empty" final line and rely on it to detect the end of the table.
> Your method looks OK too, but maybe there's a reason why kernel folks
> seem to prefer the empty last line?
I will take a look to kernel code.
>
> >vrm_t find_vrm(u8 ef,u8 em,u8 vendor) {
> >int i;
> >
> >for (i=0;i<num_models;i++) {
> > if (vrm_models[i].vendor=vendor)
> > if
> >((vrm_models[i].eff_family=ef)&&((vrm_models[i].eff_model=ef)|| \
>
> ^^
> em
>
oops :) I tested only the ANY case for this PII Thanks.
> > ((vrm_models[i].eff_model=ANY)))) return vrm_models[i].vrm_type;
> > }
> >return VRM_UNKNOWN;
> >}
>
> >static vrm_t whichVRM(void) {
> >struct cpuinfo_x86 *c = cpu_data;
> >
> >u32 eax;
> >u8 f,m;
>
> Please use longer variable names in the final code. Short varible names
> make the code harder to read.
I will do.
>
> > eax = cpuid_eax(1);
> > f = ((eax & 0x00000F00)>>8);
> > m = ((eax & 0x000000F0)>>4);
> > if (f = 0xF) {
> > f+=((eax & 0x00F00000)>>20);
>
> No <<4 here?
No according to AMD paper is family "additive", model is "concat" so
thatswhy it is shifted by 4;
> > m+=((eax & 0x000F0000)>>16)<<4;
> > }
> >return find_vrm(f,m,c->x86_vendor);
>
> Looks overwise really good,
I'm not sure if we can leave 0x000F0000 such things there...
>I'll test this on as many systems as
> possible soon.
>
Ok thank you.
Rudolf
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
2005-05-19 6:25 ` Rudolf Marek
@ 2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Jean Delvare
` (20 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Jean Delvare @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
>> What is 0xFF is ever a valid value for eff_model?
>
>No, model is 4 bit :)
That's not what your code below suggests:
m = ((eax & 0x000000F0)>>4);
m+=((eax & 0x000F0000)>>16)<<4;
That's 8-bit to me.
>> > f+=((eax & 0x00F00000)>>20);
>>
>> No <<4 here?
>
>
>No according to AMD paper is family "additive", model is "concat" so
>thatswhy it is shifted by 4;
Do Intel agree with that?
I don't think it's safe to follow AMD here. It means that we cannot
differenciate between, say, (m=0xf, xm=0) and (m=0xe, xm=1). What if
these end up having different DRM? Using "concat" for the family
doesn't cost much as far as I can see, maybe additional lines in the
table by frankly I doubt it.
>I'm not sure if we can leave 0x000F0000 such things there...
That's fine with me. Just do some defines for these so as to make the
code more readable (but I don't expect the values to change, ever).
Oh, BTW, maybe you could start implementing the architecture dispatcher?
Your code is valid only for X86, isn't it? So you'd need to detect
that and provide a default callback function for other architectures.
Another remark: you've defined an enum for VRM values. Interesting but
we don't use it in our i2c_vid code so far. We use numerical values. I
see no benefit in using symbolic values first and having to convert
these to our numbers right after. I'd suggest you use the numerical
values directly (they are rather explicit anyway). Alternatively I think
you can force values to match in your enum directly.
Thanks,
Jean Delvare
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (8 preceding siblings ...)
2005-05-19 6:25 ` Rudolf Marek
@ 2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Jean Delvare
` (12 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Rudolf Marek @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
On Fri, 2 Jul 2004, Jean Delvare wrote:
>
> >> What is 0xFF is ever a valid value for eff_model?
> >
> >No, model is 4 bit :)
>
> That's not what your code below suggests:
>
> m = ((eax & 0x000000F0)>>4);
> m+=((eax & 0x000F0000)>>16)<<4;
>
> That's 8-bit to me.
Oh yes. FF is very last model, there can ever be... (4 bits model, 4bits
extended model)
> Do Intel agree with that?
Intel says that extened family is used when family is 0xF, and extened
model is used when model is 0xF. AMD says that extended model AND family
is used when family is 0xf. Havent seen any CPU with model F, starting
from P4 all have family F anyway.
>
> I don't think it's safe to follow AMD here. It means that we cannot
> differenciate between, say, (m=0xf, xm=0) and (m=0xe, xm=1).
Because extended family is used iff ( read as if and only if) family is
fixed to 0xF. So I think it is safe.
> That's fine with me. Just do some defines for these so as to make the
> code more readable (but I don't expect the values to change, ever).
I will do.
>
> Oh, BTW, maybe you could start implementing the architecture dispatcher?
> Your code is valid only for X86, isn't it? So you'd need to detect
> that and provide a default callback function for other architectures.
I will try.
> Another remark: you've defined an enum for VRM values. Interesting but
> we don't use it in our i2c_vid code so far. We use numerical values. I
> see no benefit in using symbolic values first and having to convert
> these to our numbers right after. I'd suggest you use the numerical
> values directly (they are rather explicit anyway). Alternatively I think
> you can force values to match in your enum directly.
>
I can use numbers later. Only tell me VRM_INTEL_8x should be which ?
Also we dont have any number for itanums for example...
Thank you for the comments. I will try to implement them today, before I
leave to offline world :)
Regards
Rudolf
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (2 preceding siblings ...)
2005-05-19 6:25 ` Jean Delvare
@ 2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Rudolf Marek
` (18 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Jean Delvare @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
>Because extended family is used iff ( read as if and only if) family is
>fixed to 0xF. So I think it is safe.
OK... They are stupid, they are wasting their numbering space by doing
that.
>I can use numbers later. Only tell me VRM_INTEL_8x should be which ?
82.
(our code does the same for 8.1, 8.2 and 8.3 if I remember correctly, and
8,4 is compatible)
>Also we dont have any number for itanums for example...
We will have to find one. If none we have to pick an arbitrary number,
much like was done for AMD. If possible, pick one which makes some sense
and is not likely to be needed later (i.e. < 80).
Thanks,
Jean Delvare
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (11 preceding siblings ...)
2005-05-19 6:25 ` Mark M. Hoffman
@ 2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Rudolf Marek
` (9 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Rudolf Marek @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
On Fri, 2 Jul 2004, Jean Delvare wrote:
> We will have to find one. If none we have to pick an arbitrary number,
> much like was done for AMD. If possible, pick one which makes some sense
> and is not likely to be needed later (i.e. < 80).
And what about INTEL_VRM_10x I assigned 10 which is not good Idea it is
lower than 80. Should I do 100 ?
One more question about the architecture dispatcher. I think I cannot do
any runtime manager. Because I'm using struct cpuinfo_x86 *c = cpu_data;
And if the module insterted on PPC the symbol wont be there..
Defined as a preprocessor macro in:
* include/asm-sh/processor.h, line 73
* include/asm-um/processor-generic.h, line 140
* include/asm-x86_64/processor.h, line 86
* include/asm-sparc/cpudata.h, line 24
* include/asm-i386/processor.h, line 93
* include/asm-ia64/processor.h, line 194
* include/asm-sparc64/cpudata.h, line 28
In attachment is what I have now. There is one stupid #ifdef.
Two hours left before I leave :)
Regards
Rudolf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cpuidvrm2.c
Type: text/x-csrc
Size: 2495 bytes
Desc: here
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040702/aecca7d3/cpuidvrm2.bin
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Jean Delvare
@ 2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Jean Delvare
` (19 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Jean Delvare @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
>And what about INTEL_VRM_10x I assigned 10 which is not good Idea it is
>lower than 80. Should I do 100 ?
Yes, use 100. That's already what MDS did if I'm not mistaking.
>One more question about the architecture dispatcher. I think I cannot do
>any runtime manager. Because I'm using struct cpuinfo_x86 *c = cpu_data;
>And if the module insterted on PPC the symbol wont be there..
>
>Defined as a preprocessor macro in:
>
> * include/asm-sh/processor.h, line 73
> * include/asm-um/processor-generic.h, line 140
> * include/asm-x86_64/processor.h, line 86
> * include/asm-sparc/cpudata.h, line 24
> * include/asm-i386/processor.h, line 93
> * include/asm-ia64/processor.h, line 194
> * include/asm-sparc64/cpudata.h, line 28
>
>In attachment is what I have now. There is one stupid #ifdef.
Yes, it's definitely compile-time stuff. You compile for a given
architecture anyway! So what you did is fine.
Thanks,
Jean Delvare
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (7 preceding siblings ...)
2005-05-19 6:25 ` Greg KH
@ 2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Rudolf Marek
` (13 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Rudolf Marek @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
> Yes, use 100. That's already what MDS did if I'm not mistaking.
done
> Yes, it's definitely compile-time stuff. You compile for a given
> architecture anyway! So what you did is fine.
Ok in attach, version that can be used for testing. It is using the
numerical VRM, "while" instead of "for" in lookup func and other changes
proposed by you. I think this is the end of email storm :)
Regards
Rudolf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cpuidvrm2.c
Type: text/x-csrc
Size: 2232 bytes
Desc: all your base are belong to us :)
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040702/866c3cf6/cpuidvrm2.bin
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (4 preceding siblings ...)
2005-05-19 6:25 ` Rudolf Marek
@ 2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Rudolf Marek
` (16 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Jean Delvare @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
> Ok in attach, version that can be used for testing. It is using the
> numerical VRM, "while" instead of "for" in lookup func and other
> changes proposed by you. I think this is the end of email storm :)
Tested.
On my laptop computer it says 85, CPU is an Intel P3-M Tualatin.
On my desktop computer and my girlfriend's computer it says 90, CPU is
AMD Athlon for each.
On my server it says 0, CPU is an Intel Pentium.
So it's working fine for me, isn't it? :)
--
Jean Delvare
http://khali.linux-fr.org/
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (12 preceding siblings ...)
2005-05-19 6:25 ` Rudolf Marek
@ 2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Jean Delvare
` (8 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Rudolf Marek @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
> Tested.
Thanks
>
> So it's working fine for me, isn't it? :)
seems so :)
Any ideas how to implement the which_vrm function to lm_sensors ?
21:06 < Khali> hmm I don't know exactly
21:06 < Khali> there are several options
21:07 < Khali> inline function in sensor_vid
21:07 < Khali> or regular function in i2c-proc/i2c_sensor
21:07 < ruik> which is better ?
21:07 < Khali> or new module sensor_vid, replacing the header file
21:08 < ruik> its too small to be in module?
21:08 < Khali> yes it's a bit small
21:08 < Khali> sounds a bit overkill
21:08 < Khali> but I'm not sure
21:08 < Khali> maybe we should ask other people what they think
21:08 < Khali> especially Greg
21:09 < Khali> and mds maybe
21:09 < ruik> will you :) ?
21:09 < Khali> no :p
So I'm asking :)
What are your ideas ?
Thanks
Regards
Rudolf
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (6 preceding siblings ...)
2005-05-19 6:25 ` Rudolf Marek
@ 2005-05-19 6:25 ` Greg KH
2005-05-19 6:25 ` Rudolf Marek
` (14 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Greg KH @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
On Sun, Jul 04, 2004 at 09:28:47PM +0200, Rudolf Marek wrote:
> > Tested.
>
> Thanks
> >
> > So it's working fine for me, isn't it? :)
> seems so :)
>
> Any ideas how to implement the which_vrm function to lm_sensors ?
>
> 21:06 < Khali> hmm I don't know exactly
> 21:06 < Khali> there are several options
> 21:07 < Khali> inline function in sensor_vid
> 21:07 < Khali> or regular function in i2c-proc/i2c_sensor
> 21:07 < ruik> which is better ?
> 21:07 < Khali> or new module sensor_vid, replacing the header file
> 21:08 < ruik> its too small to be in module?
> 21:08 < Khali> yes it's a bit small
> 21:08 < Khali> sounds a bit overkill
> 21:08 < Khali> but I'm not sure
> 21:08 < Khali> maybe we should ask other people what they think
> 21:08 < Khali> especially Greg
> 21:09 < Khali> and mds maybe
> 21:09 < ruik> will you :) ?
> 21:09 < Khali> no :p
>
> So I'm asking :)
>
> What are your ideas ?
What is your proposal for how to do it? :)
greg k-h
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (15 preceding siblings ...)
2005-05-19 6:25 ` Jean Delvare
@ 2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Rudolf Marek
` (5 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Jean Delvare @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
Hi Greg,
>What is your proposal for how to do it? :)
Summary of the previous episode:
We recently found that VRM version could be deduced from CPUID info,
instead of being arbitrarily or manually set. Ruik as been working on
this and has working code, which he would like to integrate into our
chip drivers framework.
Summary of amother previous episode:
The only VID/VRM-related function so far is a (VRM, VID) -> VCore
converter in i2c-vid.h, in the form of an inline function (vid_from_reg).
The point is that the new CPUID -> VRM converter and vid_from_reg belong
to the same place, or at least one would naturally look for them in the
same place. But the new function is a bit too big to be inlined IMHO,
and I wonder if it is legitimate that vid_from_reg is since it's not
slim either.
My three proposals:
1* New function placed in i2c-vid.h, inlined. Nothing else needs being
changed. Each function will only used once in each driver, so we may
consider that the function size doesn't matter.
2* New function placed in i2c-sensor.c, not inlined, with header in
i2c-sensor.h. vid_from_reg may (2a) or may not (2b) be moved in here
too. If it is, then i2c-vid.h is gone and inclusions of it need to be
deleted.
3* New function goes in new i2c-vid.c module, with vid_from_reg
(un-inlined). New header file and inclusion need to be reworked.
All options sound feasable (which is why I propose them ;)) with little
to no additional work. I don't much like inlining stuff, especially
when there are no performance issues, so my preference would go to 2a.
But I can certainly change my mind if someone comes in with good
arguments and evidences I missed a point.
Thanks,
Jean Delvare
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (9 preceding siblings ...)
2005-05-19 6:25 ` Rudolf Marek
@ 2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Mark M. Hoffman
` (11 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Jean Delvare @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
Quoting myself...
>3* New function goes in new i2c-vid.c module, with vid_from_reg
>(un-inlined). New header file and inclusion need to be reworked.
Hm, no new header and no inclusion rework actually, since there already
is i2c-vid.h.
Jean Delvare
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (18 preceding siblings ...)
2005-05-19 6:25 ` Rudolf Marek
@ 2005-05-19 6:25 ` Mark Studebaker
2005-05-19 6:25 ` Jean Delvare
` (2 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Mark Studebaker @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
First of all great job Rudolf for the research and the code.
I vote option #1 for 2.4.
Option #2 would force sensors users to upgrade to latest i2c.
Option #3 isn't worth the trouble, unless that's what we do for 2.6, then maybe.
I vote option #1 for 2.6, unless we get objections, then we do #3.
I don't see much in common with the code in i2c-sensor (#2).
Small comments on the code:
comment spelling familly -> family
return values 00 -> 0
coding style fixes (tabs)
Also, by returning 0, we require each module to pick its own
default: if(! vrm = which_vrm()) vrm = DEFAULT_VRM;
this is what we want, right, since different drivers may have different
ideas about what is the best default?
Jean Delvare wrote:
> Hi Greg,
>
>
>>What is your proposal for how to do it? :)
>
>
> Summary of the previous episode:
> We recently found that VRM version could be deduced from CPUID info,
> instead of being arbitrarily or manually set. Ruik as been working on
> this and has working code, which he would like to integrate into our
> chip drivers framework.
>
> Summary of amother previous episode:
> The only VID/VRM-related function so far is a (VRM, VID) -> VCore
> converter in i2c-vid.h, in the form of an inline function (vid_from_reg).
>
> The point is that the new CPUID -> VRM converter and vid_from_reg belong
> to the same place, or at least one would naturally look for them in the
> same place. But the new function is a bit too big to be inlined IMHO,
> and I wonder if it is legitimate that vid_from_reg is since it's not
> slim either.
>
> My three proposals:
>
> 1* New function placed in i2c-vid.h, inlined. Nothing else needs being
> changed. Each function will only used once in each driver, so we may
> consider that the function size doesn't matter.
>
> 2* New function placed in i2c-sensor.c, not inlined, with header in
> i2c-sensor.h. vid_from_reg may (2a) or may not (2b) be moved in here
> too. If it is, then i2c-vid.h is gone and inclusions of it need to be
> deleted.
>
> 3* New function goes in new i2c-vid.c module, with vid_from_reg
> (un-inlined). New header file and inclusion need to be reworked.
>
> All options sound feasable (which is why I propose them ;)) with little
> to no additional work. I don't much like inlining stuff, especially
> when there are no performance issues, so my preference would go to 2a.
> But I can certainly change my mind if someone comes in with good
> arguments and evidences I missed a point.
>
> Thanks,
> Jean Delvare
>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (20 preceding siblings ...)
2005-05-19 6:25 ` Jean Delvare
@ 2005-05-19 6:25 ` Mark Studebaker
2005-05-19 6:25 ` Mark M. Hoffman
22 siblings, 0 replies; 24+ messages in thread
From: Mark Studebaker @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
what's the easiest way to build this to test on 2.6?
Rudolf Marek wrote:
>>Yes, use 100. That's already what MDS did if I'm not mistaking.
>
>
> done
>
>
>>Yes, it's definitely compile-time stuff. You compile for a given
>>architecture anyway! So what you did is fine.
>
>
> Ok in attach, version that can be used for testing. It is using the
> numerical VRM, "while" instead of "for" in lookup func and other changes
> proposed by you. I think this is the end of email storm :)
>
>
> Regards
>
> Rudolf
>
>
> ------------------------------------------------------------------------
>
> #include <linux/init.h>
> #include <linux/module.h>
> #include <linux/kernel.h>
>
> typedef struct {
> u8 vendor;
> u8 eff_family;
> u8 eff_model;
> int vrm_type;
> } vrm_models_t;
> #define ANY 0xFF
>
> #ifdef CONFIG_X86
>
> vrm_models_t vrm_models[] = {
> {X86_VENDOR_AMD,0x6,ANY,90}, /*athlon duron etc*/
> {X86_VENDOR_AMD,0xF,0x4,90}, /*Athlon 64*/
> {X86_VENDOR_AMD,0xF,0x5,24}, /* Opteron*/
> {X86_VENDOR_INTEL,0x6,0x9,85}, /* 0.13um too */
> {X86_VENDOR_INTEL,0x6,0xB,85}, /* 0xB Tualatin */
> {X86_VENDOR_INTEL,0x6,ANY,82}, /* any P6 */
> {X86_VENDOR_INTEL,0x7,ANY,00}, /* Itanium */
> {X86_VENDOR_INTEL,0xF,0x3,100}, /* P4 Prescott */
> {X86_VENDOR_INTEL,0xF,ANY,90}, /* P4 before Prescott */
> {X86_VENDOR_INTEL,0x10,ANY,00}, /*Itanium 2*/
> {X86_VENDOR_UNKNOWN,ANY,ANY,00} /* stop here */
> };
>
> static int find_vrm(u8 eff_family,u8 eff_model,u8 vendor) {
> int i=0;
>
> while (vrm_models[i].vendor!=X86_VENDOR_UNKNOWN) {
> if (vrm_models[i].vendor=vendor)
> if ((vrm_models[i].eff_family=eff_family)&& \
> ((vrm_models[i].eff_model=eff_model)|| \
> (vrm_models[i].eff_model=ANY))) return vrm_models[i].vrm_type;
> i++;
> }
>
> return 00;
> }
>
>
> int which_vrm(void) {
> struct cpuinfo_x86 *c = cpu_data;
> u32 eax;
> u8 eff_family,eff_model;
>
> if (c->x86 < 6) return 00; /* any CPU with familly lower than 6
> dont have VID and/or CPUID*/
>
> eax = cpuid_eax(1);
> eff_family = ((eax & 0x00000F00)>>8);
> eff_model = ((eax & 0x000000F0)>>4);
> if (eff_family = 0xF) { /* use extended model & familly */
> eff_family+=((eax & 0x00F00000)>>20); /*compute effective family */
> eff_model+= ((eax & 0x000F0000)>>16)<<4; /*compute effective model */
> }
> return find_vrm(eff_family,eff_model,c->x86_vendor);
>
> }
> /* and now something completely different for Non-x86 world*/
> #else
> int which_vrm(void) {
> return 00;
> }
> #endif
>
> static int hello_init(void)
> {
> printk(KERN_ALERT "Hello, world %d\n",which_vrm());
> return 0;
> }
>
> static void hello_exit(void)
> {
> printk(KERN_ALERT "Goodbye, cruel world\n");
> }
>
> module_init(hello_init);
> module_exit(hello_exit);
> MODULE_LICENSE("GPL");
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (17 preceding siblings ...)
2005-05-19 6:25 ` Rudolf Marek
@ 2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Mark Studebaker
` (3 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: Rudolf Marek @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
On Mon, 5 Jul 2004, Mark Studebaker wrote:
> what's the easiest way to build this to test on 2.6?
wget http://ssh.cz/~ruik/cpuidvrm2.c
wget http://ssh.cz/~ruik/Makefile
make -C /usr/src/linux-2.6.6 SUBDIRS=$PWD modules
just replace /usr/src/linux-2.6.6 with your path to kernel sources
Hope this helps
Regards
Rudolf
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (19 preceding siblings ...)
2005-05-19 6:25 ` Mark Studebaker
@ 2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Mark Studebaker
2005-05-19 6:25 ` Mark M. Hoffman
22 siblings, 0 replies; 24+ messages in thread
From: Jean Delvare @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
> I vote option #1 for 2.4.
> Option #2 would force sensors users to upgrade to latest i2c.
> Option #3 isn't worth the trouble, unless that's what we do for 2.6,
> then maybe.
Ah, interesting remark about #2, I had missed that point. That's
especially important since we would like to bring more compatibility
back.
> I vote option #1 for 2.6, unless we get objections, then we do #3.
> I don't see much in common with the code in i2c-sensor (#2).
i2c-sensor contains the code common to sensor chips. I see no better
place for the new function. I agree that having a separate module (#3)
is theoretically nicer, but all in all what's the point in having two
drivers which will be loaded together like 90% of the time?
> Also, by returning 0, we require each module to pick its own
> default: if(! vrm = which_vrm()) vrm = DEFAULT_VRM;
> this is what we want, right, since different drivers may have
> different ideas about what is the best default?
This is how things are now, so doing so preserve compatibility. We had a
theoretical default VRM but some drivers (asb100) don't follow it, and I
wouldn't blame MMH for that (the ASB100 is a recent chip not used with
VRM 8.x CPUs, so it would be silly to default to that).
However things are different now. The default will be for chips we don't
know about, at all. This means they are likely to be recent and to use
more and more recent versions of VRM. We could want to have a default
and keep it up-to-date with the latest known common VRM version.
Another thing to consider is that this case is just not supposed to
happen, so the thing to do would be to make sure people will report to
us, so that we can update our detection code. One way to do so would be
*not* to report any value, ie VRM = 0 -> nominal Vcore = 0 whatever the
VID values (+ message in the logs). This latest method looks cleaner
than an arbitrary VRM which is likely not to be correct anyway.
--
Jean Delvare
http://khali.linux-fr.org/
^ permalink raw reply [flat|nested] 24+ messages in thread
* VRM(VRD) detection versus CPUID
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
` (21 preceding siblings ...)
2005-05-19 6:25 ` Mark Studebaker
@ 2005-05-19 6:25 ` Mark M. Hoffman
22 siblings, 0 replies; 24+ messages in thread
From: Mark M. Hoffman @ 2005-05-19 6:25 UTC (permalink / raw)
To: lm-sensors
* Jean Delvare <khali@linux-fr.org> [2004-07-05 20:05:11 +0200]:
> > I vote option #1 for 2.4.
> > Option #2 would force sensors users to upgrade to latest i2c.
> > Option #3 isn't worth the trouble, unless that's what we do for 2.6,
> > then maybe.
>
> Ah, interesting remark about #2, I had missed that point. That's
> especially important since we would like to bring more compatibility
> back.
Agreed.
> > I vote option #1 for 2.6, unless we get objections, then we do #3.
> > I don't see much in common with the code in i2c-sensor (#2).
>
> i2c-sensor contains the code common to sensor chips. I see no better
> place for the new function. I agree that having a separate module (#3)
> is theoretically nicer, but all in all what's the point in having two
> drivers which will be loaded together like 90% of the time?
Somewhere between #2 & #3...
We could make i2c-sensor a composite module, composed of e.g.
i2c-sensor-detect.c (i2c-sensor.c renamed) and i2c-sensor-vid.c.
Using drivers/net/e1000 as an example, the makefile would look
something like this:
obj-$(CONFIG_I2C_SENSOR) += i2c-sensor.o
obj-y += busses/ chips/ algos/
+i2c-sensor-objs := i2c-sensor-detect.o i2c-sensor-vid.o
+
ifeq ($(CONFIG_I2C_DEBUG_CORE),y)
EXTRA_CFLAGS += -DDEBUG
endif
We could still keep a separate include/linux/i2c-vid.h. Then just
put which_vrm() into i2c-sensor-vid.o. The vid_from_reg() func
then becomes a candidate to move to i2c-sensor-vid.c as well.
BTW: which_vrm() should be renamed i2c_which_vrm()
> > Also, by returning 0, we require each module to pick its own
> > default: if(! vrm = which_vrm()) vrm = DEFAULT_VRM;
> > this is what we want, right, since different drivers may have
> > different ideas about what is the best default?
>
> This is how things are now, so doing so preserve compatibility. We had a
> theoretical default VRM but some drivers (asb100) don't follow it, and I
> wouldn't blame MMH for that (the ASB100 is a recent chip not used with
> VRM 8.x CPUs, so it would be silly to default to that).
>
> However things are different now. The default will be for chips we don't
> know about, at all. This means they are likely to be recent and to use
> more and more recent versions of VRM. We could want to have a default
> and keep it up-to-date with the latest known common VRM version.
>
> Another thing to consider is that this case is just not supposed to
> happen, so the thing to do would be to make sure people will report to
> us, so that we can update our detection code. One way to do so would be
> *not* to report any value, ie VRM = 0 -> nominal Vcore = 0 whatever the
> VID values (+ message in the logs). This latest method looks cleaner
> than an arbitrary VRM which is likely not to be correct anyway.
Yeah, I like this last idea. Put a printk in the CONFIG_X86 version of
which_vrm() if the cpu is unknown. Other arch's will have to manually
config their VRM (if it even makes sense not to just ignore it).
Regards,
--
Mark M. Hoffman
mhoffman@lightlink.com
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2005-05-19 6:25 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-19 6:25 VRM(VRD) detection versus CPUID Rudolf Marek
2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Greg KH
2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Mark M. Hoffman
2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Rudolf Marek
2005-05-19 6:25 ` Mark Studebaker
2005-05-19 6:25 ` Jean Delvare
2005-05-19 6:25 ` Mark Studebaker
2005-05-19 6:25 ` Mark M. Hoffman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.