Lines Matching refs:c
48 void check_mpx_erratum(struct cpuinfo_x86 *c) in check_mpx_erratum() argument
63 if (cpu_has(c, X86_FEATURE_MPX) && !cpu_has(c, X86_FEATURE_SMEP)) { in check_mpx_erratum()
76 static void check_memory_type_self_snoop_errata(struct cpuinfo_x86 *c) in check_memory_type_self_snoop_errata() argument
78 switch (c->x86_model) { in check_memory_type_self_snoop_errata()
104 static void probe_xeon_phi_r3mwait(struct cpuinfo_x86 *c) in probe_xeon_phi_r3mwait() argument
110 if (c->x86 != 6) in probe_xeon_phi_r3mwait()
112 switch (c->x86_model) { in probe_xeon_phi_r3mwait()
123 set_cpu_cap(c, X86_FEATURE_RING3MWAIT); in probe_xeon_phi_r3mwait()
127 if (c == &boot_cpu_data) in probe_xeon_phi_r3mwait()
168 static bool bad_spectre_microcode(struct cpuinfo_x86 *c) in bad_spectre_microcode() argument
176 if (cpu_has(c, X86_FEATURE_HYPERVISOR)) in bad_spectre_microcode()
179 if (c->x86 != 6) in bad_spectre_microcode()
183 if (c->x86_model == spectre_bad_microcodes[i].model && in bad_spectre_microcode()
184 c->x86_stepping == spectre_bad_microcodes[i].stepping) in bad_spectre_microcode()
185 return (c->microcode <= spectre_bad_microcodes[i].microcode); in bad_spectre_microcode()
190 static void early_init_intel(struct cpuinfo_x86 *c) in early_init_intel() argument
195 if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) { in early_init_intel()
198 c->cpuid_level = cpuid_eax(0); in early_init_intel()
199 get_cpu_cap(c); in early_init_intel()
203 if ((c->x86 == 0xf && c->x86_model >= 0x03) || in early_init_intel()
204 (c->x86 == 0x6 && c->x86_model >= 0x0e)) in early_init_intel()
205 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); in early_init_intel()
207 if (c->x86 >= 6 && !cpu_has(c, X86_FEATURE_IA64)) in early_init_intel()
208 c->microcode = intel_get_microcode_revision(); in early_init_intel()
211 if ((cpu_has(c, X86_FEATURE_SPEC_CTRL) || in early_init_intel()
212 cpu_has(c, X86_FEATURE_INTEL_STIBP) || in early_init_intel()
213 cpu_has(c, X86_FEATURE_IBRS) || cpu_has(c, X86_FEATURE_IBPB) || in early_init_intel()
214 cpu_has(c, X86_FEATURE_STIBP)) && bad_spectre_microcode(c)) { in early_init_intel()
234 if (c->x86 == 6 && c->x86_model == 0x1c && c->x86_stepping <= 2 && in early_init_intel()
235 c->microcode < 0x20e) { in early_init_intel()
237 clear_cpu_cap(c, X86_FEATURE_PSE); in early_init_intel()
241 set_cpu_cap(c, X86_FEATURE_SYSENTER32); in early_init_intel()
244 if (c->x86 == 15 && c->x86_cache_alignment == 64) in early_init_intel()
245 c->x86_cache_alignment = 128; in early_init_intel()
249 if (c->x86 == 0xF && c->x86_model == 0x3 in early_init_intel()
250 && (c->x86_stepping == 0x3 || c->x86_stepping == 0x4)) in early_init_intel()
251 c->x86_phys_bits = 36; in early_init_intel()
260 if (c->x86_power & (1 << 8)) { in early_init_intel()
261 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); in early_init_intel()
262 set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); in early_init_intel()
266 if (c->x86 == 6) { in early_init_intel()
267 switch (c->x86_model) { in early_init_intel()
272 set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC_S3); in early_init_intel()
289 if (c->x86 == 6 && c->x86_model < 15) in early_init_intel()
290 clear_cpu_cap(c, X86_FEATURE_PAT); in early_init_intel()
296 if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) { in early_init_intel()
315 if (c->x86 == 5 && c->x86_model == 9) { in early_init_intel()
320 if (c->cpuid_level >= 0x00000001) { in early_init_intel()
330 c->x86_coreid_bits = get_count_order((ebx >> 16) & 0xff); in early_init_intel()
333 check_mpx_erratum(c); in early_init_intel()
334 check_memory_type_self_snoop_errata(c); in early_init_intel()
340 if (detect_extended_topology_early(c) < 0) in early_init_intel()
341 detect_ht_early(c); in early_init_intel()
364 static void intel_smp_check(struct cpuinfo_x86 *c) in intel_smp_check() argument
367 if (!c->cpu_index) in intel_smp_check()
373 if (c->x86 == 5 && in intel_smp_check()
374 c->x86_stepping >= 1 && c->x86_stepping <= 4 && in intel_smp_check()
375 c->x86_model <= 3) { in intel_smp_check()
392 static void intel_workarounds(struct cpuinfo_x86 *c) in intel_workarounds() argument
401 clear_cpu_bug(c, X86_BUG_F00F); in intel_workarounds()
402 if (c->x86 == 5 && c->x86_model < 9) { in intel_workarounds()
405 set_cpu_bug(c, X86_BUG_F00F); in intel_workarounds()
417 if ((c->x86<<8 | c->x86_model<<4 | c->x86_stepping) < 0x633) in intel_workarounds()
418 clear_cpu_cap(c, X86_FEATURE_SEP); in intel_workarounds()
427 set_cpu_cap(c, X86_FEATURE_PAE); in intel_workarounds()
435 if ((c->x86 == 15) && (c->x86_model == 1) && (c->x86_stepping == 1)) { in intel_workarounds()
449 if (boot_cpu_has(X86_FEATURE_APIC) && (c->x86<<8 | c->x86_model<<4) == 0x520 && in intel_workarounds()
450 (c->x86_stepping < 0x6 || c->x86_stepping == 0xb)) in intel_workarounds()
451 set_cpu_bug(c, X86_BUG_11AP); in intel_workarounds()
458 switch (c->x86) { in intel_workarounds()
472 intel_smp_check(c); in intel_workarounds()
475 static void intel_workarounds(struct cpuinfo_x86 *c) in intel_workarounds() argument
480 static void srat_detect_node(struct cpuinfo_x86 *c) in srat_detect_node() argument
497 static void detect_vmx_virtcap(struct cpuinfo_x86 *c) in detect_vmx_virtcap() argument
511 clear_cpu_cap(c, X86_FEATURE_TPR_SHADOW); in detect_vmx_virtcap()
512 clear_cpu_cap(c, X86_FEATURE_VNMI); in detect_vmx_virtcap()
513 clear_cpu_cap(c, X86_FEATURE_FLEXPRIORITY); in detect_vmx_virtcap()
514 clear_cpu_cap(c, X86_FEATURE_EPT); in detect_vmx_virtcap()
515 clear_cpu_cap(c, X86_FEATURE_VPID); in detect_vmx_virtcap()
516 clear_cpu_cap(c, X86_FEATURE_EPT_AD); in detect_vmx_virtcap()
521 set_cpu_cap(c, X86_FEATURE_TPR_SHADOW); in detect_vmx_virtcap()
523 set_cpu_cap(c, X86_FEATURE_VNMI); in detect_vmx_virtcap()
530 set_cpu_cap(c, X86_FEATURE_FLEXPRIORITY); in detect_vmx_virtcap()
532 set_cpu_cap(c, X86_FEATURE_EPT); in detect_vmx_virtcap()
536 set_cpu_cap(c, X86_FEATURE_EPT_AD); in detect_vmx_virtcap()
539 set_cpu_cap(c, X86_FEATURE_VPID); in detect_vmx_virtcap()
563 static void detect_tme(struct cpuinfo_x86 *c) in detect_tme() argument
624 c->x86_phys_bits -= keyid_bits; in detect_tme()
627 static void init_cpuid_fault(struct cpuinfo_x86 *c) in init_cpuid_fault() argument
633 set_cpu_cap(c, X86_FEATURE_CPUID_FAULT); in init_cpuid_fault()
637 static void init_intel_misc_features(struct cpuinfo_x86 *c) in init_intel_misc_features() argument
648 init_cpuid_fault(c); in init_intel_misc_features()
649 probe_xeon_phi_r3mwait(c); in init_intel_misc_features()
655 static void init_intel(struct cpuinfo_x86 *c) in init_intel() argument
657 early_init_intel(c); in init_intel()
659 intel_workarounds(c); in init_intel()
666 detect_extended_topology(c); in init_intel()
668 if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) { in init_intel()
673 detect_num_cpu_cores(c); in init_intel()
675 detect_ht(c); in init_intel()
679 init_intel_cacheinfo(c); in init_intel()
681 if (c->cpuid_level > 9) { in init_intel()
685 set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON); in init_intel()
688 if (cpu_has(c, X86_FEATURE_XMM2)) in init_intel()
689 set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); in init_intel()
696 set_cpu_cap(c, X86_FEATURE_BTS); in init_intel()
698 set_cpu_cap(c, X86_FEATURE_PEBS); in init_intel()
701 if (c->x86 == 6 && boot_cpu_has(X86_FEATURE_CLFLUSH) && in init_intel()
702 (c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47)) in init_intel()
703 set_cpu_bug(c, X86_BUG_CLFLUSH_MONITOR); in init_intel()
705 if (c->x86 == 6 && boot_cpu_has(X86_FEATURE_MWAIT) && in init_intel()
706 ((c->x86_model == INTEL_FAM6_ATOM_GOLDMONT))) in init_intel()
707 set_cpu_bug(c, X86_BUG_MONITOR); in init_intel()
710 if (c->x86 == 15) in init_intel()
711 c->x86_cache_alignment = c->x86_clflush_size * 2; in init_intel()
712 if (c->x86 == 6) in init_intel()
713 set_cpu_cap(c, X86_FEATURE_REP_GOOD); in init_intel()
720 if (c->x86 == 6) { in init_intel()
721 unsigned int l2 = c->x86_cache_size; in init_intel()
724 switch (c->x86_model) { in init_intel()
735 else if (c->x86_stepping == 0 || c->x86_stepping == 5) in init_intel()
746 strcpy(c->x86_model_id, p); in init_intel()
749 if (c->x86 == 15) in init_intel()
750 set_cpu_cap(c, X86_FEATURE_P4); in init_intel()
751 if (c->x86 == 6) in init_intel()
752 set_cpu_cap(c, X86_FEATURE_P3); in init_intel()
756 srat_detect_node(c); in init_intel()
758 if (cpu_has(c, X86_FEATURE_VMX)) in init_intel()
759 detect_vmx_virtcap(c); in init_intel()
761 if (cpu_has(c, X86_FEATURE_TME)) in init_intel()
762 detect_tme(c); in init_intel()
764 init_intel_misc_features(c); in init_intel()
773 static unsigned int intel_size_cache(struct cpuinfo_x86 *c, unsigned int size) in intel_size_cache() argument
781 if ((c->x86 == 6) && (c->x86_model == 11) && (size == 0)) in intel_size_cache()
788 if ((c->x86 == 5) && (c->x86_model == 9)) in intel_size_cache()
942 static void intel_detect_tlb(struct cpuinfo_x86 *c) in intel_detect_tlb() argument
948 if (c->cpuid_level < 2) in intel_detect_tlb()