Lines Matching refs:c
175 static void init_amd_k5(struct cpuinfo_x86 *c) in init_amd_k5() argument
187 if (c->x86_model == 9 || c->x86_model == 10) { in init_amd_k5()
194 static void init_amd_k6(struct cpuinfo_x86 *c) in init_amd_k6() argument
200 if (c->x86_model < 6) { in init_amd_k6()
202 if (c->x86_model == 0) { in init_amd_k6()
203 clear_cpu_cap(c, X86_FEATURE_APIC); in init_amd_k6()
204 set_cpu_cap(c, X86_FEATURE_PGE); in init_amd_k6()
209 if (c->x86_model == 6 && c->x86_stepping == 1) { in init_amd_k6()
238 if (c->x86_model < 8 || in init_amd_k6()
239 (c->x86_model == 8 && c->x86_stepping < 8)) { in init_amd_k6()
258 if ((c->x86_model == 8 && c->x86_stepping > 7) || in init_amd_k6()
259 c->x86_model == 9 || c->x86_model == 13) { in init_amd_k6()
280 if (c->x86_model == 10) { in init_amd_k6()
288 static void init_amd_k7(struct cpuinfo_x86 *c) in init_amd_k7() argument
298 if (c->x86_model >= 6 && c->x86_model <= 10) { in init_amd_k7()
299 if (!cpu_has(c, X86_FEATURE_XMM)) { in init_amd_k7()
302 set_cpu_cap(c, X86_FEATURE_XMM); in init_amd_k7()
311 if ((c->x86_model == 8 && c->x86_stepping >= 1) || (c->x86_model > 8)) { in init_amd_k7()
321 if (!c->cpu_index) in init_amd_k7()
329 if ((c->x86_model == 6) && ((c->x86_stepping == 0) || in init_amd_k7()
330 (c->x86_stepping == 1))) in init_amd_k7()
334 if ((c->x86_model == 7) && (c->x86_stepping == 0)) in init_amd_k7()
344 if (((c->x86_model == 6) && (c->x86_stepping >= 2)) || in init_amd_k7()
345 ((c->x86_model == 7) && (c->x86_stepping >= 1)) || in init_amd_k7()
346 (c->x86_model > 7)) in init_amd_k7()
347 if (cpu_has(c, X86_FEATURE_MP)) in init_amd_k7()
390 static void legacy_fixup_core_id(struct cpuinfo_x86 *c) in legacy_fixup_core_id() argument
394 if (c->x86 >= 0x17) in legacy_fixup_core_id()
397 cus_per_node = c->x86_max_cores / nodes_per_socket; in legacy_fixup_core_id()
398 c->cpu_core_id %= cus_per_node; in legacy_fixup_core_id()
407 static void amd_get_topology(struct cpuinfo_x86 *c) in amd_get_topology() argument
418 c->cpu_die_id = ecx & 0xff; in amd_get_topology()
420 if (c->x86 == 0x15) in amd_get_topology()
421 c->cu_id = ebx & 0xff; in amd_get_topology()
423 if (c->x86 >= 0x17) { in amd_get_topology()
424 c->cpu_core_id = ebx & 0xff; in amd_get_topology()
427 c->x86_max_cores /= smp_num_siblings; in amd_get_topology()
434 err = detect_extended_topology(c); in amd_get_topology()
436 c->x86_coreid_bits = get_count_order(c->x86_max_cores); in amd_get_topology()
438 cacheinfo_amd_init_llc_id(c, cpu); in amd_get_topology()
440 } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { in amd_get_topology()
444 c->cpu_die_id = value & 7; in amd_get_topology()
446 per_cpu(cpu_llc_id, cpu) = c->cpu_die_id; in amd_get_topology()
451 set_cpu_cap(c, X86_FEATURE_AMD_DCM); in amd_get_topology()
452 legacy_fixup_core_id(c); in amd_get_topology()
460 static void amd_detect_cmp(struct cpuinfo_x86 *c) in amd_detect_cmp() argument
465 bits = c->x86_coreid_bits; in amd_detect_cmp()
467 c->cpu_core_id = c->initial_apicid & ((1 << bits)-1); in amd_detect_cmp()
469 c->phys_proc_id = c->initial_apicid >> bits; in amd_detect_cmp()
471 per_cpu(cpu_llc_id, cpu) = c->cpu_die_id = c->phys_proc_id; in amd_detect_cmp()
474 static void amd_detect_ppin(struct cpuinfo_x86 *c) in amd_detect_ppin() argument
478 if (!cpu_has(c, X86_FEATURE_AMD_PPIN)) in amd_detect_ppin()
500 clear_cpu_cap(c, X86_FEATURE_AMD_PPIN); in amd_detect_ppin()
515 static void srat_detect_node(struct cpuinfo_x86 *c) in srat_detect_node() argument
520 unsigned apicid = c->apicid; in srat_detect_node()
532 x86_cpuinit.fixup_cpu_id(c, node); in srat_detect_node()
554 int ht_nodeid = c->initial_apicid; in srat_detect_node()
566 static void early_init_amd_mc(struct cpuinfo_x86 *c) in early_init_amd_mc() argument
572 if (c->extended_cpuid_level < 0x80000008) in early_init_amd_mc()
577 c->x86_max_cores = (ecx & 0xff) + 1; in early_init_amd_mc()
584 while ((1 << bits) < c->x86_max_cores) in early_init_amd_mc()
588 c->x86_coreid_bits = bits; in early_init_amd_mc()
592 static void bsp_init_amd(struct cpuinfo_x86 *c) in bsp_init_amd() argument
596 if (c->x86 >= 0xf) { in bsp_init_amd()
614 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { in bsp_init_amd()
616 if (c->x86 > 0x10 || in bsp_init_amd()
617 (c->x86 == 0x10 && c->x86_model >= 0x2)) { in bsp_init_amd()
626 if (c->x86 == 0x15) { in bsp_init_amd()
641 if (cpu_has(c, X86_FEATURE_MWAITX)) in bsp_init_amd()
658 c->x86 >= 0x15 && c->x86 <= 0x17) { in bsp_init_amd()
661 switch (c->x86) { in bsp_init_amd()
678 resctrl_cpu_detect(c); in bsp_init_amd()
681 static void early_detect_mem_encrypt(struct cpuinfo_x86 *c) in early_detect_mem_encrypt() argument
697 if (cpu_has(c, X86_FEATURE_SME) || cpu_has(c, X86_FEATURE_SEV)) { in early_detect_mem_encrypt()
708 c->x86_phys_bits -= (cpuid_ebx(0x8000001f) >> 6) & 0x3f; in early_detect_mem_encrypt()
727 static void early_init_amd(struct cpuinfo_x86 *c) in early_init_amd() argument
732 early_init_amd_mc(c); in early_init_amd()
735 if (c->x86 == 6) in early_init_amd()
736 set_cpu_cap(c, X86_FEATURE_K7); in early_init_amd()
739 if (c->x86 >= 0xf) in early_init_amd()
740 set_cpu_cap(c, X86_FEATURE_K8); in early_init_amd()
742 rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy); in early_init_amd()
748 if (c->x86_power & (1 << 8)) { in early_init_amd()
749 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); in early_init_amd()
750 set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); in early_init_amd()
754 if (c->x86_power & BIT(12)) in early_init_amd()
755 set_cpu_cap(c, X86_FEATURE_ACC_POWER); in early_init_amd()
758 set_cpu_cap(c, X86_FEATURE_SYSCALL32); in early_init_amd()
761 if (c->x86 == 5) in early_init_amd()
762 if (c->x86_model == 13 || c->x86_model == 9 || in early_init_amd()
763 (c->x86_model == 8 && c->x86_stepping >= 8)) in early_init_amd()
764 set_cpu_cap(c, X86_FEATURE_K6_MTRR); in early_init_amd()
774 if (c->x86 > 0x16) in early_init_amd()
775 set_cpu_cap(c, X86_FEATURE_EXTD_APICID); in early_init_amd()
776 else if (c->x86 >= 0xf) { in early_init_amd()
782 set_cpu_cap(c, X86_FEATURE_EXTD_APICID); in early_init_amd()
792 set_cpu_cap(c, X86_FEATURE_VMMCALL); in early_init_amd()
795 if (c->x86 == 0x16 && c->x86_model <= 0xf) in early_init_amd()
804 if (cpu_has_amd_erratum(c, amd_erratum_400)) in early_init_amd()
805 set_cpu_bug(c, X86_BUG_AMD_E400); in early_init_amd()
807 early_detect_mem_encrypt(c); in early_init_amd()
810 if (c->x86 == 0x15 && in early_init_amd()
811 (c->x86_model >= 0x10 && c->x86_model <= 0x6f) && in early_init_amd()
812 !cpu_has(c, X86_FEATURE_TOPOEXT)) { in early_init_amd()
817 set_cpu_cap(c, X86_FEATURE_TOPOEXT); in early_init_amd()
823 if (cpu_has(c, X86_FEATURE_TOPOEXT)) in early_init_amd()
827 static void init_amd_k8(struct cpuinfo_x86 *c) in init_amd_k8() argument
835 set_cpu_cap(c, X86_FEATURE_REP_GOOD); in init_amd_k8()
842 if (c->x86_model < 0x14 && cpu_has(c, X86_FEATURE_LAHF_LM)) { in init_amd_k8()
843 clear_cpu_cap(c, X86_FEATURE_LAHF_LM); in init_amd_k8()
850 if (!c->x86_model_id[0]) in init_amd_k8()
851 strcpy(c->x86_model_id, "Hammer"); in init_amd_k8()
863 set_cpu_bug(c, X86_BUG_SWAPGS_FENCE); in init_amd_k8()
866 static void init_amd_gh(struct cpuinfo_x86 *c) in init_amd_gh() argument
870 if (c == &boot_cpu_data) in init_amd_gh()
897 if (cpu_has_amd_erratum(c, amd_erratum_383)) in init_amd_gh()
898 set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH); in init_amd_gh()
901 static void init_amd_ln(struct cpuinfo_x86 *c) in init_amd_ln() argument
926 static void clear_rdrand_cpuid_bit(struct cpuinfo_x86 *c) in clear_rdrand_cpuid_bit() argument
954 clear_cpu_cap(c, X86_FEATURE_RDRAND); in clear_rdrand_cpuid_bit()
958 static void init_amd_jg(struct cpuinfo_x86 *c) in init_amd_jg() argument
965 clear_rdrand_cpuid_bit(c); in init_amd_jg()
968 static void init_amd_bd(struct cpuinfo_x86 *c) in init_amd_bd() argument
976 if ((c->x86_model >= 0x02) && (c->x86_model < 0x20)) { in init_amd_bd()
988 clear_rdrand_cpuid_bit(c); in init_amd_bd()
991 void init_spectral_chicken(struct cpuinfo_x86 *c) in init_spectral_chicken() argument
1004 if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && cpu_has(c, X86_FEATURE_AMD_STIBP)) { in init_spectral_chicken()
1019 clear_cpu_cap(c, X86_FEATURE_XSAVES); in init_spectral_chicken()
1022 static void init_amd_zn(struct cpuinfo_x86 *c) in init_amd_zn() argument
1024 set_cpu_cap(c, X86_FEATURE_ZEN); in init_amd_zn()
1031 if (!cpu_has(c, X86_FEATURE_HYPERVISOR)) { in init_amd_zn()
1034 if (!cpu_has(c, X86_FEATURE_CPB)) in init_amd_zn()
1035 set_cpu_cap(c, X86_FEATURE_CPB); in init_amd_zn()
1042 if (c->x86 == 0x19 && !cpu_has(c, X86_FEATURE_BTC_NO)) in init_amd_zn()
1043 set_cpu_cap(c, X86_FEATURE_BTC_NO); in init_amd_zn()
1069 static void zenbleed_check(struct cpuinfo_x86 *c) in zenbleed_check() argument
1071 if (!cpu_has_amd_erratum(c, amd_zenbleed)) in zenbleed_check()
1074 if (cpu_has(c, X86_FEATURE_HYPERVISOR)) in zenbleed_check()
1077 if (!cpu_has(c, X86_FEATURE_AVX)) in zenbleed_check()
1088 static void init_amd(struct cpuinfo_x86 *c) in init_amd() argument
1090 early_init_amd(c); in init_amd()
1096 clear_cpu_cap(c, 0*32+31); in init_amd()
1098 if (c->x86 >= 0x10) in init_amd()
1099 set_cpu_cap(c, X86_FEATURE_REP_GOOD); in init_amd()
1102 c->apicid = hard_smp_processor_id(); in init_amd()
1105 if (c->x86 < 6) in init_amd()
1106 clear_cpu_cap(c, X86_FEATURE_MCE); in init_amd()
1108 switch (c->x86) { in init_amd()
1109 case 4: init_amd_k5(c); break; in init_amd()
1110 case 5: init_amd_k6(c); break; in init_amd()
1111 case 6: init_amd_k7(c); break; in init_amd()
1112 case 0xf: init_amd_k8(c); break; in init_amd()
1113 case 0x10: init_amd_gh(c); break; in init_amd()
1114 case 0x12: init_amd_ln(c); break; in init_amd()
1115 case 0x15: init_amd_bd(c); break; in init_amd()
1116 case 0x16: init_amd_jg(c); break; in init_amd()
1117 case 0x17: init_spectral_chicken(c); in init_amd()
1119 case 0x19: init_amd_zn(c); break; in init_amd()
1126 if ((c->x86 >= 6) && (!cpu_has(c, X86_FEATURE_XSAVEERPTR))) in init_amd()
1127 set_cpu_bug(c, X86_BUG_FXSAVE_LEAK); in init_amd()
1129 cpu_detect_cache_sizes(c); in init_amd()
1131 amd_detect_cmp(c); in init_amd()
1132 amd_get_topology(c); in init_amd()
1133 srat_detect_node(c); in init_amd()
1134 amd_detect_ppin(c); in init_amd()
1136 init_amd_cacheinfo(c); in init_amd()
1138 if (cpu_has(c, X86_FEATURE_XMM2)) { in init_amd()
1149 set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); in init_amd()
1156 if (c->x86 > 0x11) in init_amd()
1157 set_cpu_cap(c, X86_FEATURE_ARAT); in init_amd()
1160 if (!cpu_has(c, X86_FEATURE_3DNOWPREFETCH)) in init_amd()
1161 if (cpu_has(c, X86_FEATURE_3DNOW) || cpu_has(c, X86_FEATURE_LM)) in init_amd()
1162 set_cpu_cap(c, X86_FEATURE_3DNOWPREFETCH); in init_amd()
1165 if (!cpu_has(c, X86_FEATURE_XENPV)) in init_amd()
1166 set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS); in init_amd()
1173 if (cpu_has(c, X86_FEATURE_IRPERF) && in init_amd()
1174 !cpu_has_amd_erratum(c, amd_erratum_1054)) in init_amd()
1177 check_null_seg_clears_base(c); in init_amd()
1179 zenbleed_check(c); in init_amd()
1181 if (cpu_has_amd_erratum(c, amd_div0)) { in init_amd()
1186 if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && in init_amd()
1187 cpu_has_amd_erratum(c, amd_erratum_1485)) in init_amd()
1192 static unsigned int amd_size_cache(struct cpuinfo_x86 *c, unsigned int size) in amd_size_cache() argument
1195 if (c->x86 == 6) { in amd_size_cache()
1197 if (c->x86_model == 3 && c->x86_stepping == 0) in amd_size_cache()
1200 if (c->x86_model == 4 && in amd_size_cache()
1201 (c->x86_stepping == 0 || c->x86_stepping == 1)) in amd_size_cache()
1208 static void cpu_detect_tlb_amd(struct cpuinfo_x86 *c) in cpu_detect_tlb_amd() argument
1213 if (c->x86 < 0xf) in cpu_detect_tlb_amd()
1216 if (c->extended_cpuid_level < 0x80000006) in cpu_detect_tlb_amd()
1228 if (c->x86 == 0xf) { in cpu_detect_tlb_amd()
1245 if (c->x86 == 0x15 && c->x86_model <= 0x1f) { in cpu_detect_tlb_amd()
1324 struct cpuinfo_x86 *c = &cpu_data(smp_processor_id()); in zenbleed_check_cpu() local
1326 zenbleed_check(c); in zenbleed_check_cpu()