Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d67953f authored by Venki Pallipadi's avatar Venki Pallipadi Committed by Linus Torvalds
Browse files

Use a new CPU feature word to cover features that are spread around



Some Intel features 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.

Thanks to hpa (H Peter Anvin) for the making the actual code detecting the
scattered features data-driven.

Signed-off-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e087db51
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ obj-y += amd.o
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 addon_cpuid_features.o
obj-y	+=	rise.o
obj-y	+=	nexgen.o
obj-y	+=	umc.o
+50 −0
Original line number Diff line number Diff line

/*
 *	Routines to indentify additional cpu features that are scattered in
 *	cpuid space.
 */

#include <linux/cpu.h>

#include <asm/processor.h>

struct cpuid_bit {
	u16 feature;
	u8 reg;
	u8 bit;
	u32 level;
};

enum cpuid_regs {
	CR_EAX = 0,
	CR_ECX,
	CR_EDX,
	CR_EBX
};

void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
{
	u32 max_level;
	u32 regs[4];
	const struct cpuid_bit *cb;

	static const struct cpuid_bit cpuid_bits[] = {
		{ X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 },
		{ 0, 0, 0, 0 }
	};

	for (cb = cpuid_bits; cb->feature; cb++) {

		/* Verify that the level is valid */
		max_level = cpuid_eax(cb->level & 0xffff0000);
		if (max_level < cb->level ||
		    max_level > (cb->level | 0xffff))
			continue;

		cpuid(cb->level, &regs[CR_EAX], &regs[CR_EBX],
			&regs[CR_ECX], &regs[CR_EDX]);

		if (regs[cb->reg] & (1 << cb->bit))
			set_bit(cb->feature, c->x86_capability);
	}
}
+2 −0
Original line number Diff line number Diff line
@@ -353,6 +353,8 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 * c)
			if ( xlvl >= 0x80000004 )
				get_model_name(c); /* Default name */
		}

		init_scattered_cpuid_features(c);
	}

	early_intel_workaround(c);
+6 −0
Original line number Diff line number Diff line
@@ -65,6 +65,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
		"osvw", "ibs", NULL, NULL, NULL, NULL,
		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

		/* Auxiliary (Linux-defined) */
		"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 */
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ obj-$(CONFIG_PCI) += early-quirks.o

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

CFLAGS_vsyscall.o		:= $(PROFILING) -g0
@@ -55,6 +56,7 @@ cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o
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
addon_cpuid_features-y		+= ../../i386/kernel/cpu/addon_cpuid_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
Loading