* [Patch] x86, x86_64: fix cpu model for family 0x6
@ 2005-09-30 2:04 Siddha, Suresh B
2005-09-30 8:11 ` Andi Kleen
2005-09-30 13:09 ` Petr Vandrovec
0 siblings, 2 replies; 10+ messages in thread
From: Siddha, Suresh B @ 2005-09-30 2:04 UTC (permalink / raw)
To: linux-kernel; +Cc: ak, akpm
Andi, please pickup this patch and push to Andrew/Linus.
thanks,
suresh
--
According to cpuid instruction in IA32 SDM-Vol2, when computing cpu model,
we need to consider extended model ID for family 0x6 also.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
--- linux-2.6.14-rc2-git7/arch/i386/kernel/cpu/common.c~ 2005-09-29 17:44:12.030688920 -0700
+++ linux-2.6.14-rc2-git7/arch/i386/kernel/cpu/common.c 2005-09-29 17:44:30.967810040 -0700
@@ -233,10 +233,10 @@ static void __init early_cpu_detect(void
cpuid(0x00000001, &tfms, &misc, &junk, &cap0);
c->x86 = (tfms >> 8) & 15;
c->x86_model = (tfms >> 4) & 15;
- if (c->x86 == 0xf) {
+ if (c->x86 == 0xf)
c->x86 += (tfms >> 20) & 0xff;
+ if (c->x86 == 0x6 || c->x86 == 0xf)
c->x86_model += ((tfms >> 16) & 0xF) << 4;
- }
c->x86_mask = tfms & 15;
if (cap0 & (1<<19))
c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8;
--- linux-2.6.14-rc2-git7/arch/x86_64/kernel/setup.c~ 2005-09-29 18:05:26.503939536 -0700
+++ linux-2.6.14-rc2-git7/arch/x86_64/kernel/setup.c 2005-09-29 18:06:42.318413984 -0700
@@ -1059,10 +1059,10 @@ void __cpuinit early_identify_cpu(struct
c->x86 = (tfms >> 8) & 0xf;
c->x86_model = (tfms >> 4) & 0xf;
c->x86_mask = tfms & 0xf;
- if (c->x86 == 0xf) {
+ if (c->x86 == 0xf)
c->x86 += (tfms >> 20) & 0xff;
+ if (c->x86 == 0x6 || c->x86 == 0xf)
c->x86_model += ((tfms >> 16) & 0xF) << 4;
- }
if (c->x86_capability[0] & (1<<19))
c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
} else {
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Patch] x86, x86_64: fix cpu model for family 0x6
2005-09-30 2:04 [Patch] x86, x86_64: fix cpu model for family 0x6 Siddha, Suresh B
@ 2005-09-30 8:11 ` Andi Kleen
2005-09-30 13:09 ` Petr Vandrovec
1 sibling, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2005-09-30 8:11 UTC (permalink / raw)
To: Siddha, Suresh B; +Cc: linux-kernel, akpm
On Friday 30 September 2005 04:04, Siddha, Suresh B wrote:
> According to cpuid instruction in IA32 SDM-Vol2, when computing cpu model,
> we need to consider extended model ID for family 0x6 also.
I'm confused. Is there any 64bit capable CPU with family == 6?
-Andi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] x86, x86_64: fix cpu model for family 0x6
2005-09-30 2:04 [Patch] x86, x86_64: fix cpu model for family 0x6 Siddha, Suresh B
2005-09-30 8:11 ` Andi Kleen
@ 2005-09-30 13:09 ` Petr Vandrovec
2005-09-30 18:23 ` Siddha, Suresh B
1 sibling, 1 reply; 10+ messages in thread
From: Petr Vandrovec @ 2005-09-30 13:09 UTC (permalink / raw)
To: Siddha, Suresh B; +Cc: linux-kernel, ak, akpm
Siddha, Suresh B wrote:
> Andi, please pickup this patch and push to Andrew/Linus.
>
> thanks,
> suresh
>
> --
> According to cpuid instruction in IA32 SDM-Vol2, when computing cpu model,
> we need to consider extended model ID for family 0x6 also.
>
> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
>
> --- linux-2.6.14-rc2-git7/arch/i386/kernel/cpu/common.c~ 2005-09-29 17:44:12.030688920 -0700
> +++ linux-2.6.14-rc2-git7/arch/i386/kernel/cpu/common.c 2005-09-29 17:44:30.967810040 -0700
> @@ -233,10 +233,10 @@ static void __init early_cpu_detect(void
> cpuid(0x00000001, &tfms, &misc, &junk, &cap0);
> c->x86 = (tfms >> 8) & 15;
> c->x86_model = (tfms >> 4) & 15;
> - if (c->x86 == 0xf) {
> + if (c->x86 == 0xf)
> c->x86 += (tfms >> 20) & 0xff;
> + if (c->x86 == 0x6 || c->x86 == 0xf)
Are you sure this is correct? You just incremented c->x86 by extended
family, so I believe test should be
if (c->x86 == 0x6 || c->x86 >= 0xf)
or maybe just
if (c->x86 >= 0x6)
as chips with family 7..14 will either never appear, or they'll follow
existing rules (I believe all chips ever built return upper bits of tfms
zeroed, so maybe we could get rid of all these 'if' completely).
Petr Vandrovec
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Patch] x86, x86_64: fix cpu model for family 0x6
2005-09-30 13:09 ` Petr Vandrovec
@ 2005-09-30 18:23 ` Siddha, Suresh B
2005-09-30 22:02 ` Andi Kleen
0 siblings, 1 reply; 10+ messages in thread
From: Siddha, Suresh B @ 2005-09-30 18:23 UTC (permalink / raw)
To: Petr Vandrovec; +Cc: Siddha, Suresh B, linux-kernel, ak, akpm
On Fri, Sep 30, 2005 at 03:09:46PM +0200, Petr Vandrovec wrote:
> Siddha, Suresh B wrote:
> > - if (c->x86 == 0xf) {
> > + if (c->x86 == 0xf)
> > c->x86 += (tfms >> 20) & 0xff;
> > + if (c->x86 == 0x6 || c->x86 == 0xf)
>
> Are you sure this is correct? You just incremented c->x86 by extended
> family, so I believe test should be
>
> if (c->x86 == 0x6 || c->x86 >= 0xf)
My bad. Your suggestion might work. But let me just follow what SDM Vol-2a
says here. New patch appended.
Andi, please apply.
thanks,
suresh
--
According to cpuid instruction in IA32 SDM-Vol2, when computing cpu model,
we need to consider extended model ID for family 0x6 also.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
--- linux-2.6.14-rc2-git7/arch/x86_64/kernel/setup.c~ 2005-09-29 18:05:26.503939536 -0700
+++ linux-2.6.14-rc2-git7/arch/x86_64/kernel/setup.c 2005-09-30 10:17:37.964209680 -0700
@@ -1059,10 +1059,10 @@ void __cpuinit early_identify_cpu(struct
c->x86 = (tfms >> 8) & 0xf;
c->x86_model = (tfms >> 4) & 0xf;
c->x86_mask = tfms & 0xf;
- if (c->x86 == 0xf) {
- c->x86 += (tfms >> 20) & 0xff;
+ if (c->x86 == 0x6 || c->x86 == 0xf)
c->x86_model += ((tfms >> 16) & 0xF) << 4;
- }
+ if (c->x86 == 0xf)
+ c->x86 += (tfms >> 20) & 0xff;
if (c->x86_capability[0] & (1<<19))
c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
} else {
--- linux-2.6.14-rc2-git7/arch/x86_64/kernel/setup.c~ 2005-09-29 18:05:26.503939536 -0700
+++ linux-2.6.14-rc2-git7/arch/x86_64/kernel/setup.c 2005-09-30 10:17:37.964209680 -0700
@@ -1059,10 +1059,10 @@ void __cpuinit early_identify_cpu(struct
c->x86 = (tfms >> 8) & 0xf;
c->x86_model = (tfms >> 4) & 0xf;
c->x86_mask = tfms & 0xf;
- if (c->x86 == 0xf) {
- c->x86 += (tfms >> 20) & 0xff;
+ if (c->x86 == 0x6 || c->x86 == 0xf)
c->x86_model += ((tfms >> 16) & 0xF) << 4;
- }
+ if (c->x86 == 0xf)
+ c->x86 += (tfms >> 20) & 0xff;
if (c->x86_capability[0] & (1<<19))
c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
} else {
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Patch] x86, x86_64: fix cpu model for family 0x6
2005-09-30 18:23 ` Siddha, Suresh B
@ 2005-09-30 22:02 ` Andi Kleen
2005-09-30 22:23 ` Siddha, Suresh B
0 siblings, 1 reply; 10+ messages in thread
From: Andi Kleen @ 2005-09-30 22:02 UTC (permalink / raw)
To: Siddha, Suresh B; +Cc: Petr Vandrovec, linux-kernel, akpm
On Friday 30 September 2005 20:23, Siddha, Suresh B wrote:
> On Fri, Sep 30, 2005 at 03:09:46PM +0200, Petr Vandrovec wrote:
> > Siddha, Suresh B wrote:
> > > - if (c->x86 == 0xf) {
> > > + if (c->x86 == 0xf)
> > > c->x86 += (tfms >> 20) & 0xff;
> > > + if (c->x86 == 0x6 || c->x86 == 0xf)
> >
> > Are you sure this is correct? You just incremented c->x86 by extended
> > family, so I believe test should be
> >
> > if (c->x86 == 0x6 || c->x86 >= 0xf)
>
> My bad. Your suggestion might work. But let me just follow what SDM Vol-2a
> says here. New patch appended.
>
> Andi, please apply.
I applied an earlier mix of your original one and Petr's suggestions. Hope
it's ok.
x86-64/i386: Fix CPU model for family 6
From: Suresh Siddha <suresh.b.siddha@intel.com>
According to cpuid instruction in IA32 SDM-Vol2, when computing cpu model,
we need to consider extended model ID for family 0x6 also.
AK: Also added fixes/simplifcation from Petr Vandrovec
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Index: linux/arch/i386/kernel/cpu/common.c
===================================================================
--- linux.orig/arch/i386/kernel/cpu/common.c
+++ linux/arch/i386/kernel/cpu/common.c
@@ -233,10 +233,10 @@ static void __init early_cpu_detect(void
cpuid(0x00000001, &tfms, &misc, &junk, &cap0);
c->x86 = (tfms >> 8) & 15;
c->x86_model = (tfms >> 4) & 15;
- if (c->x86 == 0xf) {
+ if (c->x86 == 0xf)
c->x86 += (tfms >> 20) & 0xff;
+ if (c->x86 >= 0x6)
c->x86_model += ((tfms >> 16) & 0xF) << 4;
- }
c->x86_mask = tfms & 15;
if (cap0 & (1<<19))
c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8;
Index: linux/arch/x86_64/kernel/setup.c
===================================================================
--- linux.orig/arch/x86_64/kernel/setup.c
+++ linux/arch/x86_64/kernel/setup.c
@@ -1059,10 +1059,10 @@ void __cpuinit early_identify_cpu(struct
c->x86 = (tfms >> 8) & 0xf;
c->x86_model = (tfms >> 4) & 0xf;
c->x86_mask = tfms & 0xf;
- if (c->x86 == 0xf) {
+ if (c->x86 == 0xf)
c->x86 += (tfms >> 20) & 0xff;
+ if (c->x86 >= 0xf)
c->x86_model += ((tfms >> 16) & 0xF) << 4;
- }
if (c->x86_capability[0] & (1<<19))
c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
} else {
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Patch] x86, x86_64: fix cpu model for family 0x6
2005-09-30 22:02 ` Andi Kleen
@ 2005-09-30 22:23 ` Siddha, Suresh B
2005-09-30 22:37 ` Petr Vandrovec
2005-09-30 22:46 ` Andi Kleen
0 siblings, 2 replies; 10+ messages in thread
From: Siddha, Suresh B @ 2005-09-30 22:23 UTC (permalink / raw)
To: Andi Kleen; +Cc: Siddha, Suresh B, Petr Vandrovec, linux-kernel, akpm
On Sat, Oct 01, 2005 at 12:02:16AM +0200, Andi Kleen wrote:
> I applied an earlier mix of your original one and Petr's suggestions. Hope
> it's ok.
Andi I prefer to follow the SDM guidelines. Who knows if future families
comeup with a different rule or use/initialize these extended model/family
bits differently. I am just being paranoid.
> + if (c->x86 >= 0xf)
And also you have a typo. It should be 0x6.
Anyhow, I prefer my second patch.
thanks,
suresh
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] x86, x86_64: fix cpu model for family 0x6
2005-09-30 22:23 ` Siddha, Suresh B
@ 2005-09-30 22:37 ` Petr Vandrovec
2005-09-30 22:56 ` Dave Jones
2005-09-30 22:46 ` Andi Kleen
1 sibling, 1 reply; 10+ messages in thread
From: Petr Vandrovec @ 2005-09-30 22:37 UTC (permalink / raw)
To: Siddha, Suresh B; +Cc: Andi Kleen, linux-kernel, akpm
Siddha, Suresh B wrote:
> On Sat, Oct 01, 2005 at 12:02:16AM +0200, Andi Kleen wrote:
>
>>I applied an earlier mix of your original one and Petr's suggestions. Hope
>>it's ok.
>
>
> Andi I prefer to follow the SDM guidelines. Who knows if future families
> comeup with a different rule or use/initialize these extended model/family
> bits differently. I am just being paranoid.
And which chance is bigger - that such hypothetical processor will use
extended model, and your code will get incorrect answer everywhere, or
that such hypothetical processor will not use extended model, and your
code will be right?
>>+ if (c->x86 >= 0xf)
>
>
> And also you have a typo. It should be 0x6.
It is intentional. Maybe it could do BUG_ON(c->x86 < 0xf).
Petr
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] x86, x86_64: fix cpu model for family 0x6
2005-09-30 22:37 ` Petr Vandrovec
@ 2005-09-30 22:56 ` Dave Jones
0 siblings, 0 replies; 10+ messages in thread
From: Dave Jones @ 2005-09-30 22:56 UTC (permalink / raw)
To: Petr Vandrovec; +Cc: Siddha, Suresh B, Andi Kleen, linux-kernel, akpm
On Sat, Oct 01, 2005 at 12:37:39AM +0200, Petr Vandrovec wrote:
> Siddha, Suresh B wrote:
> >On Sat, Oct 01, 2005 at 12:02:16AM +0200, Andi Kleen wrote:
> >
> >>I applied an earlier mix of your original one and Petr's suggestions.
> >>Hope it's ok.
> >
> >
> >Andi I prefer to follow the SDM guidelines. Who knows if future families
> >comeup with a different rule or use/initialize these extended model/family
> >bits differently. I am just being paranoid.
>
> And which chance is bigger - that such hypothetical processor will use
> extended model, and your code will get incorrect answer everywhere, or
> that such hypothetical processor will not use extended model, and your
> code will be right?
>
> >>+ if (c->x86 >= 0xf)
> >
> >
> >And also you have a typo. It should be 0x6.
>
> It is intentional. Maybe it could do BUG_ON(c->x86 < 0xf).
<complete speculation> Pentium M is family 6, so maybe this is
an indication we'll see em64t capable P-M's soon ? :)
Dave
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] x86, x86_64: fix cpu model for family 0x6
2005-09-30 22:23 ` Siddha, Suresh B
2005-09-30 22:37 ` Petr Vandrovec
@ 2005-09-30 22:46 ` Andi Kleen
2005-10-01 1:37 ` Siddha, Suresh B
1 sibling, 1 reply; 10+ messages in thread
From: Andi Kleen @ 2005-09-30 22:46 UTC (permalink / raw)
To: Siddha, Suresh B; +Cc: Petr Vandrovec, linux-kernel, akpm
On Saturday 01 October 2005 00:23, Siddha, Suresh B wrote:
> And also you have a typo. It should be 0x6.
Fixed.
> Anyhow, I prefer my second patch.
It doesn't even apply - you patched x86_64/kernel/setup.c twice.
-Andi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Patch] x86, x86_64: fix cpu model for family 0x6
2005-09-30 22:46 ` Andi Kleen
@ 2005-10-01 1:37 ` Siddha, Suresh B
0 siblings, 0 replies; 10+ messages in thread
From: Siddha, Suresh B @ 2005-10-01 1:37 UTC (permalink / raw)
To: Andi Kleen; +Cc: Siddha, Suresh B, Petr Vandrovec, linux-kernel, akpm
On Sat, Oct 01, 2005 at 12:46:48AM +0200, Andi Kleen wrote:
> On Saturday 01 October 2005 00:23, Siddha, Suresh B wrote:
>
> > And also you have a typo. It should be 0x6.
>
> Fixed.
Thanks. Lets go ahead with Petrs suggestion then.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-10-01 1:37 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-30 2:04 [Patch] x86, x86_64: fix cpu model for family 0x6 Siddha, Suresh B
2005-09-30 8:11 ` Andi Kleen
2005-09-30 13:09 ` Petr Vandrovec
2005-09-30 18:23 ` Siddha, Suresh B
2005-09-30 22:02 ` Andi Kleen
2005-09-30 22:23 ` Siddha, Suresh B
2005-09-30 22:37 ` Petr Vandrovec
2005-09-30 22:56 ` Dave Jones
2005-09-30 22:46 ` Andi Kleen
2005-10-01 1:37 ` Siddha, Suresh B
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox