2007-05-23 22:49:52

by Pallipadi, Venkatesh

[permalink] [raw]
Subject: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo


Display Intel Dynamic Acceleration feature in /proc/cpuinfo. This feature
will be enabled automatically by current acpi-cpufreq driver and cpufreq.

Refer to Intel Software Developer's Manual for more details about the feature.

Signed-off-by: Venkatesh Pallipadi <[email protected]>

Index: linux-2.6.22-rc-mm/arch/i386/kernel/cpu/proc.c
===================================================================
--- linux-2.6.22-rc-mm.orig/arch/i386/kernel/cpu/proc.c
+++ linux-2.6.22-rc-mm/arch/i386/kernel/cpu/proc.c
@@ -41,7 +41,7 @@ static int show_cpuinfo(struct seq_file
"cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
NULL, NULL, NULL, NULL,
"constant_tsc", "up", NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

/* Intel-defined (#2) */
Index: linux-2.6.22-rc-mm/arch/x86_64/kernel/setup.c
===================================================================
--- linux-2.6.22-rc-mm.orig/arch/x86_64/kernel/setup.c
+++ linux-2.6.22-rc-mm/arch/x86_64/kernel/setup.c
@@ -949,7 +949,7 @@ static int show_cpuinfo(struct seq_file
/* Other (Linux-defined) */
"cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
"constant_tsc", NULL, NULL,
- "up", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ "up", NULL, NULL, NULL, "ida", NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

Index: linux-2.6.22-rc-mm/include/asm-i386/cpufeature.h
===================================================================
--- linux-2.6.22-rc-mm.orig/include/asm-i386/cpufeature.h
+++ linux-2.6.22-rc-mm/include/asm-i386/cpufeature.h
@@ -81,6 +81,7 @@
#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
#define X86_FEATURE_LAPIC_TIMER_BROKEN (3*32+ 14) /* lapic timer broken in C1 */
#define X86_FEATURE_SYNC_RDTSC (3*32+15) /* RDTSC synchronizes the CPU */
+#define X86_FEATURE_IDA (3*32+16) /* Intel Dynamic Acceleration */

/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
Index: linux-2.6.22-rc-mm/include/asm-x86_64/cpufeature.h
===================================================================
--- linux-2.6.22-rc-mm.orig/include/asm-x86_64/cpufeature.h
+++ linux-2.6.22-rc-mm/include/asm-x86_64/cpufeature.h
@@ -70,6 +70,7 @@
#define X86_FEATURE_ARCH_PERFMON (3*32+9) /* Intel Architectural PerfMon */
#define X86_FEATURE_PEBS (3*32+10) /* Precise-Event Based Sampling */
#define X86_FEATURE_BTS (3*32+11) /* Branch Trace Store */
+#define X86_FEATURE_IDA (3*32+12) /* Intel Dynamic Acceleration */

/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
Index: linux-2.6.22-rc-mm/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
===================================================================
--- linux-2.6.22-rc-mm.orig/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ linux-2.6.22-rc-mm/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -58,6 +58,7 @@ enum {

#define INTEL_MSR_RANGE (0xffff)
#define CPUID_6_ECX_APERFMPERF_CAPABILITY (0x1)
+#define CPUID_6_EAX_IDA_CAPABILITY (0x2)

struct acpi_cpufreq_data {
struct acpi_processor_performance *acpi_data;
@@ -699,10 +700,20 @@ static int acpi_cpufreq_cpu_init(struct

/* Check for APERF/MPERF support in hardware */
if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) {
- unsigned int ecx;
+ unsigned int eax, ecx;
ecx = cpuid_ecx(6);
if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY)
acpi_cpufreq_driver.getavg = get_measured_perf;
+
+ eax = cpuid_eax(6);
+ if (eax & CPUID_6_EAX_IDA_CAPABILITY) {
+ unsigned int i;
+
+ for_each_cpu_mask(i, policy->cpus) {
+ struct cpuinfo_x86 *c = &cpu_data[i];
+ set_bit(X86_FEATURE_IDA, c->x86_capability);
+ }
+ }
}

dprintk("CPU%u - ACPI performance management activated.\n", cpu);


2007-05-24 20:55:38

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Wed, 23 May 2007 15:46:37 -0700
Venki Pallipadi <[email protected]> wrote:

> Display Intel Dynamic Acceleration feature in /proc/cpuinfo. This feature
> will be enabled automatically by current acpi-cpufreq driver and cpufreq.

So you're saying that the cpufreq code in Linus's tree aleady supports IDA?
If so, this is a 2.6.22 patch, isn't it?

2007-05-24 21:01:52

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Thu, May 24, 2007 at 01:55:13PM -0700, Andrew Morton wrote:
> On Wed, 23 May 2007 15:46:37 -0700
> Venki Pallipadi <[email protected]> wrote:
>
> > Display Intel Dynamic Acceleration feature in /proc/cpuinfo. This feature
> > will be enabled automatically by current acpi-cpufreq driver and cpufreq.
>
> So you're saying that the cpufreq code in Linus's tree aleady supports IDA?
> If so, this is a 2.6.22 patch, isn't it?

>From my limited understanding[*], ida is the "We're single threaded,
disable the 2nd core, and clock the first core faster" magic.
It doesn't need code-changes, as its all done in hardware afaik.

identifying & exporting the flags on earlier kernels should be harmless,
but not really 'mustfix'.

Dave

[*] As in I've read about this more on the inquirer etc than
I have on Intel docs so far. ;-)

--
http://www.codemonkey.org.uk

2007-05-24 21:08:51

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Thursday 24 May 2007 23:01:04 Dave Jones wrote:
> On Thu, May 24, 2007 at 01:55:13PM -0700, Andrew Morton wrote:
> > On Wed, 23 May 2007 15:46:37 -0700
> > Venki Pallipadi <[email protected]> wrote:
> >
> > > Display Intel Dynamic Acceleration feature in /proc/cpuinfo. This feature
> > > will be enabled automatically by current acpi-cpufreq driver and cpufreq.
> >
> > So you're saying that the cpufreq code in Linus's tree aleady supports IDA?
> > If so, this is a 2.6.22 patch, isn't it?
>
> From my limited understanding[*], ida is the "We're single threaded,
> disable the 2nd core, and clock the first core faster" magic.
> It doesn't need code-changes, as its all done in hardware afaik.

P0 is somewhat visible to software, but it should be pretty transparent

>
> identifying & exporting the flags on earlier kernels should be harmless,
> but not really 'mustfix'.

I think it's generally a good idea to push cpuinfo flags in earliest
as possible; just make sure we actually use the final name (so that we don't get
into a pni->sse3 mess again)

-Andi

2007-05-24 21:13:57

by Pallipadi, Venkatesh

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Thu, May 24, 2007 at 05:01:04PM -0400, Dave Jones wrote:
> On Thu, May 24, 2007 at 01:55:13PM -0700, Andrew Morton wrote:
> > On Wed, 23 May 2007 15:46:37 -0700
> > Venki Pallipadi <[email protected]> wrote:
> >
> > > Display Intel Dynamic Acceleration feature in /proc/cpuinfo. This feature
> > > will be enabled automatically by current acpi-cpufreq driver and cpufreq.
> >
> > So you're saying that the cpufreq code in Linus's tree aleady supports IDA?
> > If so, this is a 2.6.22 patch, isn't it?
>
> From my limited understanding[*], ida is the "We're single threaded,
> disable the 2nd core, and clock the first core faster" magic.
> It doesn't need code-changes, as its all done in hardware afaik.

IDA state will appear as a new highest freq P-state (P0) and when software
requests that frequency, hardware can provide a higher frequency than that
oppurtunistically and transparently.

The current cpufreq code will detect this new state and enter that state
when CPU is busy.

>
> identifying & exporting the flags on earlier kernels should be harmless,
> but not really 'mustfix'.
>

Agree with Dave that it is not a mustfix. As the patch is pretty harmless
would be nice to have in 2.6.22.

Thanks,
Venki

2007-05-24 21:16:53

by Pallipadi, Venkatesh

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Thu, May 24, 2007 at 11:08:38PM +0200, Andi Kleen wrote:
>
> I think it's generally a good idea to push cpuinfo flags in earliest
> as possible; just make sure we actually use the final name (so that we don't get
> into a pni->sse3 mess again)
>

ida is official name as in the Software Developer's Manual now. So, should
not be a issue unless marketing folks change their mind in future :-)

Thanks,
Venki

2007-05-24 21:25:54

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Thursday 24 May 2007 23:13:37 Venki Pallipadi wrote:
> On Thu, May 24, 2007 at 11:08:38PM +0200, Andi Kleen wrote:
> >
> > I think it's generally a good idea to push cpuinfo flags in earliest
> > as possible; just make sure we actually use the final name (so that we don't get
> > into a pni->sse3 mess again)
> >
>
> ida is official name as in the Software Developer's Manual now. So, should
> not be a issue unless marketing folks change their mind in future :-)

Well they did sometimes in the past.

But actually reading the patch: it seems weird to detect the flag
in acpi-cpufreq and essentially change /proc/cpuinfo when a
module is loaded. Why not in the intel setup function? And why is it
not in the standard CPUID 1 features mask anyways?

-Andi

2007-05-24 21:31:24

by Pallipadi, Venkatesh

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Thu, May 24, 2007 at 11:25:27PM +0200, Andi Kleen wrote:
> On Thursday 24 May 2007 23:13:37 Venki Pallipadi wrote:
> > On Thu, May 24, 2007 at 11:08:38PM +0200, Andi Kleen wrote:
> > >
> > > I think it's generally a good idea to push cpuinfo flags in earliest
> > > as possible; just make sure we actually use the final name (so that we don't get
> > > into a pni->sse3 mess again)
> > >
> >
> > ida is official name as in the Software Developer's Manual now. So, should
> > not be a issue unless marketing folks change their mind in future :-)
>
> Well they did sometimes in the past.
>
> But actually reading the patch: it seems weird to detect the flag
> in acpi-cpufreq and essentially change /proc/cpuinfo when a
> module is loaded. Why not in the intel setup function? And why is it
> not in the standard CPUID 1 features mask anyways?
>

I can do it in intel setup function. But, the feature may not be activated
unless the driver is loaded. Going by the hardware capability point
of view, we can do it in setup function.

The feature appears in CPUID 6 (called Power Management Leaf) instead of
regular CPUID 1 features.

Thanks,
Venki

2007-05-24 21:38:55

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Thu, May 24, 2007 at 02:28:06PM -0700, Venki Pallipadi wrote:

> > But actually reading the patch: it seems weird to detect the flag
> > in acpi-cpufreq and essentially change /proc/cpuinfo when a
> > module is loaded. Why not in the intel setup function? And why is it
> > not in the standard CPUID 1 features mask anyways?
>
> I can do it in intel setup function. But, the feature may not be activated
> unless the driver is loaded.

The same could be said about est, vmx, and probably some others ;-)

Dave

--
http://www.codemonkey.org.uk

2007-05-24 21:57:00

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo


> I can do it in intel setup function. But, the feature may not be activated
> unless the driver is loaded.

That would put users in a chicken and egg situation: they cannot know they
need to load a driver to go faster. It's better to display it always.

-Andi

2007-05-24 22:03:21

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Wed, 23 May 2007 15:46:37 -0700
Venki Pallipadi <[email protected]> wrote:

> Display Intel Dynamic Acceleration feature in /proc/cpuinfo. This feature
> will be enabled automatically by current acpi-cpufreq driver and cpufreq.
>
> Refer to Intel Software Developer's Manual for more details about the feature.
>
> Signed-off-by: Venkatesh Pallipadi <[email protected]>
>
> Index: linux-2.6.22-rc-mm/arch/i386/kernel/cpu/proc.c
> ===================================================================
> --- linux-2.6.22-rc-mm.orig/arch/i386/kernel/cpu/proc.c
> +++ linux-2.6.22-rc-mm/arch/i386/kernel/cpu/proc.c
> @@ -41,7 +41,7 @@ static int show_cpuinfo(struct seq_file
> "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
> NULL, NULL, NULL, NULL,
> "constant_tsc", "up", NULL, NULL, NULL, NULL, NULL, NULL,
> - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> + "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
>
> /* Intel-defined (#2) */
> Index: linux-2.6.22-rc-mm/arch/x86_64/kernel/setup.c
> ===================================================================
> --- linux-2.6.22-rc-mm.orig/arch/x86_64/kernel/setup.c
> +++ linux-2.6.22-rc-mm/arch/x86_64/kernel/setup.c
> @@ -949,7 +949,7 @@ static int show_cpuinfo(struct seq_file
> /* Other (Linux-defined) */
> "cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
> "constant_tsc", NULL, NULL,
> - "up", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> + "up", NULL, NULL, NULL, "ida", NULL, NULL, NULL,
> NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

Ho hum. This clashes with hpa's git-newsetup tree, which goes for a great
tromp through the cpuinfo implementation.

Hunk #1 FAILED at 41.
1 out of 1 hunk FAILED -- saving rejects to file arch/i386/kernel/cpu/proc.c.rej
patching file arch/x86_64/kernel/setup.c
Hunk #1 FAILED at 951.
1 out of 1 hunk FAILED -- saving rejects to file arch/x86_64/kernel/setup.c.rej
patching file include/asm-i386/cpufeature.h
Hunk #1 FAILED at 81.
1 out of 1 hunk FAILED -- saving rejects to file include/asm-i386/cpufeature.h.rej
patching file include/asm-x86_64/cpufeature.h
Hunk #1 FAILED at 70.
1 out of 1 hunk FAILED -- saving rejects to file include/asm-x86_64/cpufeature.h.rej

I'm not sure I can be bothered repairing all that at present. I think I'll
go and hide until it becomes somebody else's problem.

<looks at hpa's tree>

@@ -23,13 +23,14 @@ static int show_cpuinfo(struct seq_file
"fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
"cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
"pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
- "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe",
+ "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL,

<wonders where pbe went to>


2007-05-24 22:11:42

by Pallipadi, Venkatesh

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Thu, May 24, 2007 at 03:02:23PM -0700, Andrew Morton wrote:
> On Wed, 23 May 2007 15:46:37 -0700
> Venki Pallipadi <[email protected]> wrote:
>
> > Display Intel Dynamic Acceleration feature in /proc/cpuinfo. This feature
> > will be enabled automatically by current acpi-cpufreq driver and cpufreq.
> >
> > Refer to Intel Software Developer's Manual for more details about the feature.
> >
> > Signed-off-by: Venkatesh Pallipadi <[email protected]>
> >
> > Index: linux-2.6.22-rc-mm/arch/i386/kernel/cpu/proc.c
> > ===================================================================
> > --- linux-2.6.22-rc-mm.orig/arch/i386/kernel/cpu/proc.c
> > +++ linux-2.6.22-rc-mm/arch/i386/kernel/cpu/proc.c
> > @@ -41,7 +41,7 @@ static int show_cpuinfo(struct seq_file
> > "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
> > NULL, NULL, NULL, NULL,
> > "constant_tsc", "up", NULL, NULL, NULL, NULL, NULL, NULL,
> > - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> > + "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> > NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> >
> > /* Intel-defined (#2) */
> > Index: linux-2.6.22-rc-mm/arch/x86_64/kernel/setup.c
> > ===================================================================
> > --- linux-2.6.22-rc-mm.orig/arch/x86_64/kernel/setup.c
> > +++ linux-2.6.22-rc-mm/arch/x86_64/kernel/setup.c
> > @@ -949,7 +949,7 @@ static int show_cpuinfo(struct seq_file
> > /* Other (Linux-defined) */
> > "cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
> > "constant_tsc", NULL, NULL,
> > - "up", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> > + "up", NULL, NULL, NULL, "ida", NULL, NULL, NULL,
> > NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> > NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
>
> Ho hum. This clashes with hpa's git-newsetup tree, which goes for a great
> tromp through the cpuinfo implementation.
>

Hmm.. Will move feature detection to setup routines and will also
refresh the patch against latest mm and resend it

Thanks,
Venki

2007-05-24 22:15:10

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

Andrew Morton wrote:
>
> I'm not sure I can be bothered repairing all that at present. I think I'll
> go and hide until it becomes somebody else's problem.
>

I'll fix it.

> <looks at hpa's tree>
>
> @@ -23,13 +23,14 @@ static int show_cpuinfo(struct seq_file
> "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
> "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
> "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
> - "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe",
> + "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL,
>
> <wonders where pbe went to>

pbe collides with abuse by at least two vendors (AMD and
Cyrix/Centaur/VIA) of this bit for 3DNow. I don't know if that applies
only to the chips that don't support extended CPUID levels, but I'm
fairly sure that we don't handle that correctly in the vendor-specific
handlers.

I guess for now we can just unconditionally disable that bit in those
vendor routines, with a note saying that if there are such chips
supporting PBE then more sophisticated logic needs to be implemented.

-hpa

2007-05-24 22:16:22

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

Venki Pallipadi wrote:
>
> Hmm.. Will move feature detection to setup routines and will also
> refresh the patch against latest mm and resend it
>

If you could send a patch against my git.newsetup instead, I'll merge
into that tree.

http://git.kernel.org/?p=linux/kernel/git/hpa/linux-2.6-newsetup.git;a=summary

-hpa

2007-05-24 22:28:24

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

Andrew Morton wrote:
>
> @@ -23,13 +23,14 @@ static int show_cpuinfo(struct seq_file
> "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
> "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
> "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
> - "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe",
> + "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL,
>
> <wonders where pbe went to>
>

I just went through all the codepaths, and we filter this bit in all the
appropriate places, so it's safe to display. I've added it to both i386
and x86-64 in the git.newsetup tree (the two were inconsistent.)

-hpa

2007-05-24 22:42:32

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Thu, May 24, 2007 at 03:14:39PM -0700, H. Peter Anvin wrote:

> pbe collides with abuse by at least two vendors (AMD and
> Cyrix/Centaur/VIA) of this bit for 3DNow.

Unless I'm mistaken,

pbe comes from cpuid level 1

3dnow comes from cpuid level 0x80000001
though I did notice that amd have it in edx, whilst via have it in ecx
curiously.

Dave

--
http://www.codemonkey.org.uk

2007-05-24 22:52:10

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

Dave Jones wrote:
> On Thu, May 24, 2007 at 03:14:39PM -0700, H. Peter Anvin wrote:
>
> > pbe collides with abuse by at least two vendors (AMD and
> > Cyrix/Centaur/VIA) of this bit for 3DNow.
>
> Unless I'm mistaken,
>
> pbe comes from cpuid level 1
>
> 3dnow comes from cpuid level 0x80000001
> though I did notice that amd have it in edx, whilst via have it in ecx
> curiously.

edx is correct.

What you're describing is correct for later-level AMD/Cyrix chips,
however, when 3DNow! was first introduced they foolishly squatted on the
Intel-assigned CPUID flags.

However, I have audited all the vendor initialization paths, and we kill
off that CPUID bit in all the places that matter.

-hpa

2007-05-24 23:04:13

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

Venki Pallipadi wrote:
>
> I can do it in intel setup function. But, the feature may not be activated
> unless the driver is loaded. Going by the hardware capability point
> of view, we can do it in setup function.
>
> The feature appears in CPUID 6 (called Power Management Leaf) instead of
> regular CPUID 1 features.
>

This sounds like it should be a new CPUID word?

-hpa

2007-05-24 23:06:51

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Thu, May 24, 2007 at 03:51:31PM -0700, H. Peter Anvin wrote:
> What you're describing is correct for later-level AMD/Cyrix chips,
> however, when 3DNow! was first introduced they foolishly squatted on the
> Intel-assigned CPUID flags.

Hmm, the 3dnow spec (doc 21928e) has it in the right place, and I don't see
anything in the errata docs I have.

Do you have more info on this? If its true, I'd like to make x86info
aware of it.

Dave

--
http://www.codemonkey.org.uk

2007-05-24 23:12:20

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

Dave Jones wrote:
> On Thu, May 24, 2007 at 03:51:31PM -0700, H. Peter Anvin wrote:
> > What you're describing is correct for later-level AMD/Cyrix chips,
> > however, when 3DNow! was first introduced they foolishly squatted on the
> > Intel-assigned CPUID flags.
>
> Hmm, the 3dnow spec (doc 21928e) has it in the right place, and I don't see
> anything in the errata docs I have.
>
> Do you have more info on this? If its true, I'd like to make x86info
> aware of it.

I don't have exact details, but I have sent off a query to someone I
know that probably *does* know the exact details.

Linux does the right thing, as it will turn off bit 31 if it seems AMD,
Cyrix or Centaur as the vendor ID (VIA still uses the Centaur VID
apparently.)

-hpa

2007-05-24 23:13:21

by Pallipadi, Venkatesh

[permalink] [raw]
Subject: RE: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo



>-----Original Message-----
>From: H. Peter Anvin [mailto:[email protected]]
>Sent: Thursday, May 24, 2007 4:04 PM
>To: Pallipadi, Venkatesh
>Cc: Andi Kleen; Dave Jones; Andrew Morton; Brown, Len; linux-kernel
>Subject: Re: [PATCH] Display Intel Dynamic Acceleration
>feature in /proc/cpuinfo
>
>Venki Pallipadi wrote:
>>
>> I can do it in intel setup function. But, the feature may
>not be activated
>> unless the driver is loaded. Going by the hardware capability point
>> of view, we can do it in setup function.
>>
>> The feature appears in CPUID 6 (called Power Management
>Leaf) instead of
>> regular CPUID 1 features.
>>
>
>This sounds like it should be a new CPUID word?
>

Yes. But it only has 3 features defined right now. 2 in EAX and one in
ECX. Should I use 2 new words for these bits or just use the software
defined bits as in my earlier patch?

Thanks,
Venki

2007-05-24 23:23:22

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

Pallipadi, Venkatesh wrote:
>
> Yes. But it only has 3 features defined right now. 2 in EAX and one in
> ECX. Should I use 2 new words for these bits or just use the software
> defined bits as in my earlier patch?
>

Oh for heaven's sake. Could you please do the world a favour and shoot
your CPUID architect?

The real answer depends on how you expect it to grow in the future.
Intel has a piss-poor record at being consistent in this matter, which
speaks for a more ad hoc approach, but if there really is a sane growth
path going forward, then go ahead and define two new words.

-hpa

2007-05-24 23:46:32

by Alan

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Thu, 24 May 2007 18:41:54 -0400
Dave Jones <[email protected]> wrote:

> On Thu, May 24, 2007 at 03:14:39PM -0700, H. Peter Anvin wrote:
>
> > pbe collides with abuse by at least two vendors (AMD and
> > Cyrix/Centaur/VIA) of this bit for 3DNow.
>
> Unless I'm mistaken,
>
> pbe comes from cpuid level 1
>
> 3dnow comes from cpuid level 0x80000001
> though I did notice that amd have it in edx, whilst via have it in ecx
> curiously.

The older AMD docs (CPU rev guide) list bit 31 of both 0x80000001 and
0x00000001 as 3dnow

All their example code/docs say to use 0x80000001

2007-05-24 23:53:55

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

Alan Cox wrote:
>
> The older AMD docs (CPU rev guide) list bit 31 of both 0x80000001 and
> 0x00000001 as 3dnow
>
> All their example code/docs say to use 0x80000001
>

I don't have access to any AM2 systems, but the bit is definitely set on
socket 939 Athlon X2 ("model 43").

-hpa

2007-05-25 00:00:44

by Pallipadi, Venkatesh

[permalink] [raw]
Subject: RE: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo



>-----Original Message-----
>From: H. Peter Anvin [mailto:[email protected]]
>Sent: Thursday, May 24, 2007 4:23 PM
>To: Pallipadi, Venkatesh
>Cc: Andi Kleen; Dave Jones; Andrew Morton; Brown, Len; linux-kernel
>Subject: Re: [PATCH] Display Intel Dynamic Acceleration
>feature in /proc/cpuinfo
>
>Pallipadi, Venkatesh wrote:
>>
>> Yes. But it only has 3 features defined right now. 2 in EAX
>and one in
>> ECX. Should I use 2 new words for these bits or just use the software
>> defined bits as in my earlier patch?
>>
>
>Oh for heaven's sake. Could you please do the world a favour and shoot
>your CPUID architect?
>
>The real answer depends on how you expect it to grow in the future.
>Intel has a piss-poor record at being consistent in this matter, which
>speaks for a more ad hoc approach, but if there really is a sane growth
>path going forward, then go ahead and define two new words.
>

The way new Intel features are being exposed in CPUID is kind of
changing.
Now we have different CPUID leafs for different kind of features with
each of them growing much slowly.
I mean, there is
monitor-mwait related features in CPUID 5
powermanagement features in CPUID 6 EAX, ECX
Perfmon features in CPUID 10

This does not fit well with the way we use the feature words in Linux.
Probably
it is better to have one new word for new Intel features and add bits
from all
CPUIDs as they come. I will take a look at all the other fields and try
for
a better solution than adding new words for different CPUIDs like above.

Thanks,
Venki

2007-05-25 00:04:28

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

Pallipadi, Venkatesh wrote:
> The way new Intel features are being exposed in CPUID is kind of
> changing.

Changing is a VERY BAD THING when it comes to something like CPUID.

> Now we have different CPUID leafs for different kind of features with
> each of them growing much slowly.
> I mean, there is
> monitor-mwait related features in CPUID 5
> powermanagement features in CPUID 6 EAX, ECX
> Perfmon features in CPUID 10

Again, this is bad.

> This does not fit well with the way we use the feature words in Linux.

No, it doesn't... nor for anyone else who wants a compact representation
of this kind of information.

If they grow slowly from the bottom, I guess we could simply allocate
space in the vector byte by byte instead. Either way, it means more
work whenever anything has to change.

-hpa

2007-05-30 00:56:27

by Pallipadi, Venkatesh

[permalink] [raw]
Subject: Re: [PATCH] Display Intel Dynamic Acceleration feature in /proc/cpuinfo

On Thu, May 24, 2007 at 05:04:13PM -0700, H. Peter Anvin wrote:
>
> If they grow slowly from the bottom, I guess we could simply allocate
> space in the vector byte by byte instead. Either way, it means more
> work whenever anything has to change.
>

hpa,

Below patch adds a new word for feature bits that willb eused for all Intel
features that may be spread around in CPUID leafs like 0x6, 0xA, etc.
I added "ida" bit first into this word. I will send an incremental patch
to move ARCH_PERFMON bit and any other feature bits in these leaf subsequently.
The patch is against newsetup git tree.

Please apply.

Thanks,
Venki



Use a new CPU feature word to cover all Intel features that are spread around
in different CPUID leafs like 0x5, 0x6 and 0xA. Make this
feature detection code common across i386 and x86_64.

Display Intel Dynamic Acceleration feature in /proc/cpuinfo. This feature
will be enabled automatically by current acpi-cpufreq driver.

Refer to Intel Software Developer's Manual for more details about the feature.

Signed-off-by: Venkatesh Pallipadi <[email protected]>

Index: linux-2.6/include/asm-i386/cpufeature.h
===================================================================
--- linux-2.6.orig/include/asm-i386/cpufeature.h 2007-05-29 07:30:28.000000000 -0700
+++ linux-2.6/include/asm-i386/cpufeature.h 2007-05-29 10:21:17.000000000 -0700
@@ -12,7 +12,7 @@
#endif
#include <asm/required-features.h>

-#define NCAPINTS 7 /* N 32-bit words worth of info */
+#define NCAPINTS 8 /* N 32-bit words worth of info */

/* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */
#define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */
@@ -109,6 +109,9 @@
#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */
#define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */

+/* More extended Intel flags: From various new CPUID levels like 0x6, 0xA etc */
+#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */
+
#define cpu_has(c, bit) \
(__builtin_constant_p(bit) && \
( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \
@@ -117,7 +120,8 @@
(((bit)>>5)==3 && (1UL<<((bit)&31) & REQUIRED_MASK3)) || \
(((bit)>>5)==4 && (1UL<<((bit)&31) & REQUIRED_MASK4)) || \
(((bit)>>5)==5 && (1UL<<((bit)&31) & REQUIRED_MASK5)) || \
- (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) ) \
+ (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \
+ (((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) ) \
? 1 : \
test_bit(bit, (c)->x86_capability))
#define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit)
Index: linux-2.6/arch/i386/kernel/cpu/proc.c
===================================================================
--- linux-2.6.orig/arch/i386/kernel/cpu/proc.c 2007-05-29 07:30:20.000000000 -0700
+++ linux-2.6/arch/i386/kernel/cpu/proc.c 2007-05-29 08:20:51.000000000 -0700
@@ -65,6 +65,12 @@
"osvw", "ibs", NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+ /* Intel-defined (#3) */
+ "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
};
static const char * const x86_power_flags[] = {
"ts", /* temperature sensor */
Index: linux-2.6/arch/x86_64/kernel/setup.c
===================================================================
--- linux-2.6.orig/arch/x86_64/kernel/setup.c 2007-05-29 07:30:21.000000000 -0700
+++ linux-2.6/arch/x86_64/kernel/setup.c 2007-05-29 09:20:01.000000000 -0700
@@ -699,6 +699,7 @@
/* Cache sizes */
unsigned n;

+ init_additional_intel_features(c);
init_intel_cacheinfo(c);
if (c->cpuid_level > 9 ) {
unsigned eax = cpuid_eax(10);
@@ -973,6 +974,12 @@
"osvw", "ibs", NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+ /* Intel-defined (#3) */
+ "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
};
static char *x86_power_flags[] = {
"ts", /* temperature sensor */
Index: linux-2.6/include/asm-i386/required-features.h
===================================================================
--- linux-2.6.orig/include/asm-i386/required-features.h 2007-05-29 07:30:28.000000000 -0700
+++ linux-2.6/include/asm-i386/required-features.h 2007-05-29 08:11:13.000000000 -0700
@@ -56,5 +56,6 @@
#define REQUIRED_MASK4 0
#define REQUIRED_MASK5 0
#define REQUIRED_MASK6 0
+#define REQUIRED_MASK7 0

#endif
Index: linux-2.6/include/asm-x86_64/required-features.h
===================================================================
--- linux-2.6.orig/include/asm-x86_64/required-features.h 2007-05-29 07:30:29.000000000 -0700
+++ linux-2.6/include/asm-x86_64/required-features.h 2007-05-29 08:12:30.000000000 -0700
@@ -42,5 +42,6 @@
#define REQUIRED_MASK4 0
#define REQUIRED_MASK5 0
#define REQUIRED_MASK6 0
+#define REQUIRED_MASK7 0

#endif
Index: linux-2.6/arch/i386/kernel/cpu/intel.c
===================================================================
--- linux-2.6.orig/arch/i386/kernel/cpu/intel.c 2007-05-29 09:14:31.000000000 -0700
+++ linux-2.6/arch/i386/kernel/cpu/intel.c 2007-05-29 09:15:52.000000000 -0700
@@ -120,6 +120,7 @@
#endif

select_idle_routine(c);
+ init_additional_intel_features(c);
l2 = init_intel_cacheinfo(c);
if (c->cpuid_level > 9 ) {
unsigned eax = cpuid_eax(10);
Index: linux-2.6/arch/i386/kernel/cpu/intel_features.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6/arch/i386/kernel/cpu/intel_features.c 2007-05-29 10:38:25.000000000 -0700
@@ -0,0 +1,22 @@
+
+/*
+ * Routines to indentify additional Intel cpu features
+ * Features in word 7
+ */
+
+#include <linux/cpu.h>
+
+#include <asm/processor.h>
+
+#define CPUID_6_EAX_IDA 0x2
+
+void __cpuinit init_additional_intel_features(struct cpuinfo_x86 *c)
+{
+ unsigned int eax;
+
+ if (c->cpuid_level >= 6) {
+ eax = cpuid_eax(6);
+ if (eax & CPUID_6_EAX_IDA)
+ set_bit(X86_FEATURE_IDA, c->x86_capability);
+ }
+}
Index: linux-2.6/arch/i386/kernel/cpu/Makefile
===================================================================
--- linux-2.6.orig/arch/i386/kernel/cpu/Makefile 2007-05-29 07:30:20.000000000 -0700
+++ linux-2.6/arch/i386/kernel/cpu/Makefile 2007-05-29 10:01:03.000000000 -0700
@@ -8,7 +8,7 @@
obj-y += cyrix.o
obj-y += centaur.o
obj-y += transmeta.o
-obj-y += intel.o intel_cacheinfo.o
+obj-y += intel.o intel_cacheinfo.o intel_features.o
obj-y += rise.o
obj-y += nexgen.o
obj-y += umc.o
Index: linux-2.6/arch/x86_64/kernel/Makefile
===================================================================
--- linux-2.6.orig/arch/x86_64/kernel/Makefile 2007-05-29 07:30:21.000000000 -0700
+++ linux-2.6/arch/x86_64/kernel/Makefile 2007-05-29 10:01:41.000000000 -0700
@@ -44,6 +44,7 @@

obj-y += topology.o
obj-y += intel_cacheinfo.o
+obj-y += intel_features.o
obj-y += pcspeaker.o

CFLAGS_vsyscall.o := $(PROFILING) -g0
@@ -55,6 +56,7 @@
topology-y += ../../i386/kernel/topology.o
microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o
intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o
+intel_features-y += ../../i386/kernel/cpu/intel_features.o
quirks-y += ../../i386/kernel/quirks.o
i8237-y += ../../i386/kernel/i8237.o
msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o
Index: linux-2.6/include/asm-i386/processor.h
===================================================================
--- linux-2.6.orig/include/asm-i386/processor.h 2007-05-29 07:30:28.000000000 -0700
+++ linux-2.6/include/asm-i386/processor.h 2007-05-29 10:13:41.000000000 -0700
@@ -119,6 +119,7 @@
extern void identify_boot_cpu(void);
extern void identify_secondary_cpu(struct cpuinfo_x86 *);
extern void print_cpu_info(struct cpuinfo_x86 *);
+extern void init_additional_intel_features(struct cpuinfo_x86 *c);
extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
extern unsigned short num_cache_leaves;

Index: linux-2.6/include/asm-x86_64/processor.h
===================================================================
--- linux-2.6.orig/include/asm-x86_64/processor.h 2007-05-29 07:30:29.000000000 -0700
+++ linux-2.6/include/asm-x86_64/processor.h 2007-05-29 10:14:11.000000000 -0700
@@ -100,6 +100,7 @@

extern void identify_cpu(struct cpuinfo_x86 *);
extern void print_cpu_info(struct cpuinfo_x86 *);
+extern void init_additional_intel_features(struct cpuinfo_x86 *c);
extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
extern unsigned short num_cache_leaves;