1 #include <linux/init.h>
3 #include <asm/processor.h>
4 #include <asm/ptrace.h>
5 #include <asm/topology.h>
6 #include <asm/numa_64.h>
8 void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
10 if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
11 (c->x86 == 0x6 && c->x86_model >= 0x0e))
12 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
16 * find out the number of processor cores on the die
18 static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
22 if (c->cpuid_level < 4)
25 cpuid_count(4, 0, &eax, &t, &t, &t);
28 return ((eax >> 26) + 1);
33 static void __cpuinit srat_detect_node(void)
37 int cpu = smp_processor_id();
38 int apicid = hard_smp_processor_id();
40 /* Don't do the funky fallback heuristics the AMD version employs
42 node = apicid_to_node[apicid];
43 if (node == NUMA_NO_NODE || !node_online(node))
44 node = first_node(node_online_map);
45 numa_set_node(cpu, node);
47 printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
51 void __cpuinit init_intel(struct cpuinfo_x86 *c)
56 init_intel_cacheinfo(c);
57 if (c->cpuid_level > 9) {
58 unsigned eax = cpuid_eax(10);
59 /* Check for version and the number of counters */
60 if ((eax & 0xff) && (((eax>>8) & 0xff) > 1))
61 set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON);
66 rdmsr(MSR_IA32_MISC_ENABLE, l1, l2);
68 set_cpu_cap(c, X86_FEATURE_BTS);
70 set_cpu_cap(c, X86_FEATURE_PEBS);
77 n = c->extended_cpuid_level;
78 if (n >= 0x80000008) {
79 unsigned eax = cpuid_eax(0x80000008);
80 c->x86_virt_bits = (eax >> 8) & 0xff;
81 c->x86_phys_bits = eax & 0xff;
82 /* CPUID workaround for Intel 0F34 CPU */
83 if (c->x86_vendor == X86_VENDOR_INTEL &&
84 c->x86 == 0xF && c->x86_model == 0x3 &&
86 c->x86_phys_bits = 36;
90 c->x86_cache_alignment = c->x86_clflush_size * 2;
92 set_cpu_cap(c, X86_FEATURE_REP_GOOD);
93 set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
94 c->x86_max_cores = intel_num_cpu_cores(c);