ia64/kvm: compilation fix. export account_system_vtime.
[pv_ops_mirror.git] / arch / x86 / kernel / cpu / addon_cpuid_features.c
blobc2e1ce33c7cb0e9a9bdab5d16c204c9a83447f7a
2 /*
3 * Routines to indentify additional cpu features that are scattered in
4 * cpuid space.
5 */
7 #include <linux/cpu.h>
9 #include <asm/pat.h>
10 #include <asm/processor.h>
12 struct cpuid_bit {
13 u16 feature;
14 u8 reg;
15 u8 bit;
16 u32 level;
19 enum cpuid_regs {
20 CR_EAX = 0,
21 CR_ECX,
22 CR_EDX,
23 CR_EBX
26 void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
28 u32 max_level;
29 u32 regs[4];
30 const struct cpuid_bit *cb;
32 static const struct cpuid_bit cpuid_bits[] = {
33 { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 },
34 { 0, 0, 0, 0 }
37 for (cb = cpuid_bits; cb->feature; cb++) {
39 /* Verify that the level is valid */
40 max_level = cpuid_eax(cb->level & 0xffff0000);
41 if (max_level < cb->level ||
42 max_level > (cb->level | 0xffff))
43 continue;
45 cpuid(cb->level, &regs[CR_EAX], &regs[CR_EBX],
46 &regs[CR_ECX], &regs[CR_EDX]);
48 if (regs[cb->reg] & (1 << cb->bit))
49 set_cpu_cap(c, cb->feature);
53 #ifdef CONFIG_X86_PAT
54 void __cpuinit validate_pat_support(struct cpuinfo_x86 *c)
56 switch (c->x86_vendor) {
57 case X86_VENDOR_AMD:
58 if (c->x86 >= 0xf && c->x86 <= 0x11)
59 return;
60 break;
61 case X86_VENDOR_INTEL:
62 if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15))
63 return;
64 break;
67 pat_disable(cpu_has_pat ?
68 "PAT disabled. Not yet verified on this CPU type." :
69 "PAT not supported by CPU.");
71 #endif