2 #include <linux/kernel.h>
4 #include <linux/string.h>
5 #include <linux/bitops.h>
7 #include <linux/sched.h>
9 #include <linux/module.h>
12 #include <asm/processor.h>
13 #include <asm/pgtable.h>
25 #ifdef CONFIG_X86_LOCAL_APIC
39 misc_enable &= ~MSR_IA32_MISC_ENABLE_LIMIT_CPUID;
97 sched_clock_stable = 1;
113 #ifdef CONFIG_KMEMCHECK
128 misc_enable &= ~MSR_IA32_MISC_ENABLE_FAST_STRING;
162 printk(
KERN_INFO "Pentium Pro with Errata#50 detected. Taking evasive action.\n");
168 #ifdef CONFIG_X86_F00F_BUG
169 static void __cpuinit trap_init_f00f_bug(
void)
177 idt_descr.address = fix_to_virt(FIX_F00F_IDT);
197 WARN_ONCE(1,
"WARNING: SMP operation may be unreliable"
198 "with B stepping processors.\n");
204 unsigned long lo,
hi;
206 #ifdef CONFIG_X86_F00F_BUG
215 static int f00f_workaround_enabled;
218 if (!f00f_workaround_enabled) {
219 trap_init_f00f_bug();
221 f00f_workaround_enabled = 1;
241 printk (
KERN_INFO "CPU: Disabling hardware prefetching (Errata 037)\n");
253 if (cpu_has_apic && (c->
x86<<8 | c->
x86_model<<4) == 0x520 &&
258 #ifdef CONFIG_X86_INTEL_USERCOPY
276 #ifdef CONFIG_X86_NUMAQ
310 unsigned int eax,
ebx,
ecx, edx;
316 cpuid_count(4, 0, &eax, &ebx, &ecx, &edx);
318 return (eax >> 26) + 1;
326 #define X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW 0x00200000
327 #define X86_VMX_FEATURE_PROC_CTLS_VNMI 0x00400000
328 #define X86_VMX_FEATURE_PROC_CTLS_2ND_CTLS 0x80000000
329 #define X86_VMX_FEATURE_PROC_CTLS2_VIRT_APIC 0x00000001
330 #define X86_VMX_FEATURE_PROC_CTLS2_EPT 0x00000002
331 #define X86_VMX_FEATURE_PROC_CTLS2_VPID 0x00000020
333 u32 vmx_msr_low, vmx_msr_high, msr_ctl, msr_ctl2;
342 msr_ctl = vmx_msr_high | vmx_msr_low;
343 if (msr_ctl & X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW)
345 if (msr_ctl & X86_VMX_FEATURE_PROC_CTLS_VNMI)
347 if (msr_ctl & X86_VMX_FEATURE_PROC_CTLS_2ND_CTLS) {
349 vmx_msr_low, vmx_msr_high);
350 msr_ctl2 = vmx_msr_high | vmx_msr_low;
351 if ((msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_VIRT_APIC) &&
352 (msr_ctl & X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW))
354 if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_EPT)
356 if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_VPID)
367 intel_workarounds(c);
378 unsigned eax = cpuid_eax(10);
380 if ((eax & 0xff) && (((eax>>8) & 0xff) > 1))
395 if (c->
x86 == 6 && c->
x86_model == 29 && cpu_has_clflush)
415 p =
"Celeron (Covington)";
417 p =
"Mobile Pentium II (Dixon)";
422 p =
"Celeron (Mendocino)";
429 p =
"Celeron (Coppermine)";
458 detect_vmx_virtcap(c);
470 " Set to 'normal', was 'performance'\n"
471 "ENERGY_PERF_BIAS: View and update with"
472 " x86_energy_perf_policy(8)\n");
488 if ((c->
x86 == 6) && (c->
x86_model == 11) && (size == 0))
494 #define TLB_INST_4K 0x01
495 #define TLB_INST_4M 0x02
496 #define TLB_INST_2M_4M 0x03
498 #define TLB_INST_ALL 0x05
499 #define TLB_INST_1G 0x06
501 #define TLB_DATA_4K 0x11
502 #define TLB_DATA_4M 0x12
503 #define TLB_DATA_2M_4M 0x13
504 #define TLB_DATA_4K_4M 0x14
506 #define TLB_DATA_1G 0x16
508 #define TLB_DATA0_4K 0x21
509 #define TLB_DATA0_4M 0x22
510 #define TLB_DATA0_2M_4M 0x23
515 { 0x01,
TLB_INST_4K, 32,
" TLB_INST 4 KByte pages, 4-way set associative" },
516 { 0x02,
TLB_INST_4M, 2,
" TLB_INST 4 MByte pages, full associative" },
517 { 0x03,
TLB_DATA_4K, 64,
" TLB_DATA 4 KByte pages, 4-way set associative" },
518 { 0x04,
TLB_DATA_4M, 8,
" TLB_DATA 4 MByte pages, 4-way set associative" },
519 { 0x05,
TLB_DATA_4M, 32,
" TLB_DATA 4 MByte pages, 4-way set associative" },
520 { 0x0b,
TLB_INST_4M, 4,
" TLB_INST 4 MByte pages, 4-way set associative" },
521 { 0x4f,
TLB_INST_4K, 32,
" TLB_INST 4 KByte pages */" },
522 { 0x50,
TLB_INST_ALL, 64,
" TLB_INST 4 KByte and 2-MByte or 4-MByte pages" },
523 { 0x51,
TLB_INST_ALL, 128,
" TLB_INST 4 KByte and 2-MByte or 4-MByte pages" },
524 { 0x52,
TLB_INST_ALL, 256,
" TLB_INST 4 KByte and 2-MByte or 4-MByte pages" },
525 { 0x55,
TLB_INST_2M_4M, 7,
" TLB_INST 2-MByte or 4-MByte pages, fully associative" },
526 { 0x56,
TLB_DATA0_4M, 16,
" TLB_DATA0 4 MByte pages, 4-way set associative" },
527 { 0x57,
TLB_DATA0_4K, 16,
" TLB_DATA0 4 KByte pages, 4-way associative" },
528 { 0x59,
TLB_DATA0_4K, 16,
" TLB_DATA0 4 KByte pages, fully associative" },
529 { 0x5a,
TLB_DATA0_2M_4M, 32,
" TLB_DATA0 2-MByte or 4 MByte pages, 4-way set associative" },
530 { 0x5b,
TLB_DATA_4K_4M, 64,
" TLB_DATA 4 KByte and 4 MByte pages" },
531 { 0x5c,
TLB_DATA_4K_4M, 128,
" TLB_DATA 4 KByte and 4 MByte pages" },
532 { 0x5d,
TLB_DATA_4K_4M, 256,
" TLB_DATA 4 KByte and 4 MByte pages" },
533 { 0xb0,
TLB_INST_4K, 128,
" TLB_INST 4 KByte pages, 4-way set associative" },
534 { 0xb1,
TLB_INST_2M_4M, 4,
" TLB_INST 2M pages, 4-way, 8 entries or 4M pages, 4-way entries" },
535 { 0xb2,
TLB_INST_4K, 64,
" TLB_INST 4KByte pages, 4-way set associative" },
536 { 0xb3,
TLB_DATA_4K, 128,
" TLB_DATA 4 KByte pages, 4-way set associative" },
537 { 0xb4,
TLB_DATA_4K, 256,
" TLB_DATA 4 KByte pages, 4-way associative" },
538 { 0xba,
TLB_DATA_4K, 64,
" TLB_DATA 4 KByte pages, 4-way associative" },
539 { 0xc0,
TLB_DATA_4K_4M, 8,
" TLB_DATA 4 KByte and 4 MByte pages, 4-way associative" },
540 { 0xca,
STLB_4K, 512,
" STLB 4 KByte pages, 4-way associative" },
544 static void __cpuinit intel_tlb_lookup(
const unsigned char desc)
551 for (k = 0; intel_tlb_table[
k].descriptor != desc && \
552 intel_tlb_table[
k].descriptor != 0; k++)
555 if (intel_tlb_table[k].
tlb_type == 0)
558 switch (intel_tlb_table[k].
tlb_type) {
615 if (!cpu_has_invlpg) {
649 unsigned int regs[4];
650 unsigned char *desc = (
unsigned char *)regs;
656 n = cpuid_eax(2) & 0xFF;
658 for (i = 0 ; i <
n ; i++) {
659 cpuid(2, ®s[0], ®s[1], ®s[2], ®s[3]);
662 for (j = 0 ; j < 3 ; j++)
663 if (regs[j] & (1 << 31))
667 for (j = 1 ; j < 16 ; j++)
668 intel_tlb_lookup(desc[j]);
670 intel_tlb_flushall_shift_set(c);
673 static const struct cpu_dev __cpuinitconst intel_cpu_dev = {
675 .c_ident = {
"GenuineIntel" },
680 [0] =
"486 DX-25/33",
693 [0] =
"Pentium 60/66 A-step",
694 [1] =
"Pentium 60/66",
695 [2] =
"Pentium 75 - 200",
696 [3] =
"OverDrive PODP5V83",
698 [7] =
"Mobile Pentium 75 - 200",
699 [8] =
"Mobile Pentium MMX"
704 [0] =
"Pentium Pro A-step",
706 [3] =
"Pentium II (Klamath)",
707 [4] =
"Pentium II (Deschutes)",
708 [5] =
"Pentium II (Deschutes)",
709 [6] =
"Mobile Pentium II",
710 [7] =
"Pentium III (Katmai)",
711 [8] =
"Pentium III (Coppermine)",
712 [10] =
"Pentium III (Cascades)",
713 [11] =
"Pentium III (Tualatin)",
718 [0] =
"Pentium 4 (Unknown)",
719 [1] =
"Pentium 4 (Willamette)",
720 [2] =
"Pentium 4 (Northwood)",
721 [4] =
"Pentium 4 (Foster)",
722 [5] =
"Pentium 4 (Foster)",
726 .c_size_cache = intel_size_cache,
728 .c_detect_tlb = intel_detect_tlb,
729 .c_early_init = early_init_intel,
730 .c_init = init_intel,