Lines Matching refs:c

70 static void default_init(struct cpuinfo_x86 *c)  in default_init()  argument
73 cpu_detect_cache_sizes(c); in default_init()
77 if (c->cpuid_level == -1) { in default_init()
79 if (c->x86 == 4) in default_init()
80 strcpy(c->x86_model_id, "486"); in default_init()
81 else if (c->x86 == 3) in default_init()
82 strcpy(c->x86_model_id, "386"); in default_init()
218 static void squash_the_stupid_serial_number(struct cpuinfo_x86 *c) in squash_the_stupid_serial_number() argument
222 if (!cpu_has(c, X86_FEATURE_PN) || !disable_x86_serial_nr) in squash_the_stupid_serial_number()
232 clear_cpu_cap(c, X86_FEATURE_PN); in squash_the_stupid_serial_number()
235 c->cpuid_level = cpuid_eax(0); in squash_the_stupid_serial_number()
249 static inline void squash_the_stupid_serial_number(struct cpuinfo_x86 *c) in squash_the_stupid_serial_number() argument
261 static __always_inline void setup_smep(struct cpuinfo_x86 *c) in setup_smep() argument
263 if (cpu_has(c, X86_FEATURE_SMEP)) in setup_smep()
274 static __always_inline void setup_smap(struct cpuinfo_x86 *c) in setup_smap() argument
281 if (cpu_has(c, X86_FEATURE_SMAP)) { in setup_smap()
308 static void filter_cpuid_features(struct cpuinfo_x86 *c, bool warn) in filter_cpuid_features() argument
314 if (!cpu_has(c, df->feature)) in filter_cpuid_features()
324 (u32)df->level > (u32)c->extended_cpuid_level : in filter_cpuid_features()
325 (s32)df->level > (s32)c->cpuid_level)) in filter_cpuid_features()
328 clear_cpu_cap(c, df->feature); in filter_cpuid_features()
346 static const char *table_lookup_model(struct cpuinfo_x86 *c) in table_lookup_model() argument
351 if (c->x86_model >= 16) in table_lookup_model()
360 if (info->family == c->x86) in table_lookup_model()
361 return info->model_names[c->x86_model]; in table_lookup_model()
400 static void get_model_name(struct cpuinfo_x86 *c) in get_model_name() argument
405 if (c->extended_cpuid_level < 0x80000004) in get_model_name()
408 v = (unsigned int *)c->x86_model_id; in get_model_name()
412 c->x86_model_id[48] = 0; in get_model_name()
415 p = q = s = &c->x86_model_id[0]; in get_model_name()
431 void cpu_detect_cache_sizes(struct cpuinfo_x86 *c) in cpu_detect_cache_sizes() argument
435 n = c->extended_cpuid_level; in cpu_detect_cache_sizes()
439 c->x86_cache_size = (ecx>>24) + (edx>>24); in cpu_detect_cache_sizes()
442 c->x86_tlbsize = 0; in cpu_detect_cache_sizes()
453 c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff); in cpu_detect_cache_sizes()
457 l2size = this_cpu->legacy_cache_size(c, l2size); in cpu_detect_cache_sizes()
467 c->x86_cache_size = l2size; in cpu_detect_cache_sizes()
478 static void cpu_detect_tlb(struct cpuinfo_x86 *c) in cpu_detect_tlb() argument
481 this_cpu->c_detect_tlb(c); in cpu_detect_tlb()
492 void detect_ht(struct cpuinfo_x86 *c) in detect_ht() argument
499 if (!cpu_has(c, X86_FEATURE_HT)) in detect_ht()
502 if (cpu_has(c, X86_FEATURE_CMP_LEGACY)) in detect_ht()
505 if (cpu_has(c, X86_FEATURE_XTOPOLOGY)) in detect_ht()
521 c->phys_proc_id = apic->phys_pkg_id(c->initial_apicid, index_msb); in detect_ht()
523 smp_num_siblings = smp_num_siblings / c->x86_max_cores; in detect_ht()
527 core_bits = get_count_order(c->x86_max_cores); in detect_ht()
529 c->cpu_core_id = apic->phys_pkg_id(c->initial_apicid, index_msb) & in detect_ht()
533 if (!printed && (c->x86_max_cores * smp_num_siblings) > 1) { in detect_ht()
535 c->phys_proc_id); in detect_ht()
537 c->cpu_core_id); in detect_ht()
543 static void get_cpu_vendor(struct cpuinfo_x86 *c) in get_cpu_vendor() argument
545 char *v = c->x86_vendor_id; in get_cpu_vendor()
557 c->x86_vendor = this_cpu->c_x86_vendor; in get_cpu_vendor()
566 c->x86_vendor = X86_VENDOR_UNKNOWN; in get_cpu_vendor()
570 void cpu_detect(struct cpuinfo_x86 *c) in cpu_detect() argument
573 cpuid(0x00000000, (unsigned int *)&c->cpuid_level, in cpu_detect()
574 (unsigned int *)&c->x86_vendor_id[0], in cpu_detect()
575 (unsigned int *)&c->x86_vendor_id[8], in cpu_detect()
576 (unsigned int *)&c->x86_vendor_id[4]); in cpu_detect()
578 c->x86 = 4; in cpu_detect()
580 if (c->cpuid_level >= 0x00000001) { in cpu_detect()
584 c->x86 = (tfms >> 8) & 0xf; in cpu_detect()
585 c->x86_model = (tfms >> 4) & 0xf; in cpu_detect()
586 c->x86_mask = tfms & 0xf; in cpu_detect()
588 if (c->x86 == 0xf) in cpu_detect()
589 c->x86 += (tfms >> 20) & 0xff; in cpu_detect()
590 if (c->x86 >= 0x6) in cpu_detect()
591 c->x86_model += ((tfms >> 16) & 0xf) << 4; in cpu_detect()
594 c->x86_clflush_size = ((misc >> 8) & 0xff) * 8; in cpu_detect()
595 c->x86_cache_alignment = c->x86_clflush_size; in cpu_detect()
600 void get_cpu_cap(struct cpuinfo_x86 *c) in get_cpu_cap() argument
606 if (c->cpuid_level >= 0x00000001) { in get_cpu_cap()
610 c->x86_capability[0] = capability; in get_cpu_cap()
611 c->x86_capability[4] = excap; in get_cpu_cap()
615 if (c->cpuid_level >= 0x00000007) { in get_cpu_cap()
620 c->x86_capability[9] = ebx; in get_cpu_cap()
624 if (c->cpuid_level >= 0x0000000d) { in get_cpu_cap()
629 c->x86_capability[10] = eax; in get_cpu_cap()
633 if (c->cpuid_level >= 0x0000000F) { in get_cpu_cap()
638 c->x86_capability[11] = edx; in get_cpu_cap()
639 if (cpu_has(c, X86_FEATURE_CQM_LLC)) { in get_cpu_cap()
641 c->x86_cache_max_rmid = ebx; in get_cpu_cap()
645 c->x86_capability[12] = edx; in get_cpu_cap()
646 if (cpu_has(c, X86_FEATURE_CQM_OCCUP_LLC)) { in get_cpu_cap()
647 c->x86_cache_max_rmid = ecx; in get_cpu_cap()
648 c->x86_cache_occ_scale = ebx; in get_cpu_cap()
651 c->x86_cache_max_rmid = -1; in get_cpu_cap()
652 c->x86_cache_occ_scale = -1; in get_cpu_cap()
658 c->extended_cpuid_level = xlvl; in get_cpu_cap()
662 c->x86_capability[1] = cpuid_edx(0x80000001); in get_cpu_cap()
663 c->x86_capability[6] = cpuid_ecx(0x80000001); in get_cpu_cap()
667 if (c->extended_cpuid_level >= 0x80000008) { in get_cpu_cap()
670 c->x86_virt_bits = (eax >> 8) & 0xff; in get_cpu_cap()
671 c->x86_phys_bits = eax & 0xff; in get_cpu_cap()
672 c->x86_capability[13] = cpuid_ebx(0x80000008); in get_cpu_cap()
675 else if (cpu_has(c, X86_FEATURE_PAE) || cpu_has(c, X86_FEATURE_PSE36)) in get_cpu_cap()
676 c->x86_phys_bits = 36; in get_cpu_cap()
679 if (c->extended_cpuid_level >= 0x80000007) in get_cpu_cap()
680 c->x86_power = cpuid_edx(0x80000007); in get_cpu_cap()
682 init_scattered_cpuid_features(c); in get_cpu_cap()
685 static void identify_cpu_without_cpuid(struct cpuinfo_x86 *c) in identify_cpu_without_cpuid() argument
695 c->x86 = 4; in identify_cpu_without_cpuid()
697 c->x86 = 3; in identify_cpu_without_cpuid()
701 c->x86_vendor_id[0] = 0; in identify_cpu_without_cpuid()
702 cpu_devs[i]->c_identify(c); in identify_cpu_without_cpuid()
703 if (c->x86_vendor_id[0]) { in identify_cpu_without_cpuid()
704 get_cpu_vendor(c); in identify_cpu_without_cpuid()
720 static void __init early_identify_cpu(struct cpuinfo_x86 *c) in early_identify_cpu() argument
723 c->x86_clflush_size = 64; in early_identify_cpu()
724 c->x86_phys_bits = 36; in early_identify_cpu()
725 c->x86_virt_bits = 48; in early_identify_cpu()
727 c->x86_clflush_size = 32; in early_identify_cpu()
728 c->x86_phys_bits = 32; in early_identify_cpu()
729 c->x86_virt_bits = 32; in early_identify_cpu()
731 c->x86_cache_alignment = c->x86_clflush_size; in early_identify_cpu()
733 memset(&c->x86_capability, 0, sizeof c->x86_capability); in early_identify_cpu()
734 c->extended_cpuid_level = 0; in early_identify_cpu()
737 identify_cpu_without_cpuid(c); in early_identify_cpu()
743 cpu_detect(c); in early_identify_cpu()
744 get_cpu_vendor(c); in early_identify_cpu()
745 get_cpu_cap(c); in early_identify_cpu()
748 this_cpu->c_early_init(c); in early_identify_cpu()
750 c->cpu_index = 0; in early_identify_cpu()
751 filter_cpuid_features(c, false); in early_identify_cpu()
754 this_cpu->c_bsp_init(c); in early_identify_cpu()
757 fpu__init_system(c); in early_identify_cpu()
802 static void detect_nopl(struct cpuinfo_x86 *c) in detect_nopl() argument
805 clear_cpu_cap(c, X86_FEATURE_NOPL); in detect_nopl()
807 set_cpu_cap(c, X86_FEATURE_NOPL); in detect_nopl()
811 static void generic_identify(struct cpuinfo_x86 *c) in generic_identify() argument
813 c->extended_cpuid_level = 0; in generic_identify()
816 identify_cpu_without_cpuid(c); in generic_identify()
822 cpu_detect(c); in generic_identify()
824 get_cpu_vendor(c); in generic_identify()
826 get_cpu_cap(c); in generic_identify()
828 if (c->cpuid_level >= 0x00000001) { in generic_identify()
829 c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xFF; in generic_identify()
832 c->apicid = apic->phys_pkg_id(c->initial_apicid, 0); in generic_identify()
834 c->apicid = c->initial_apicid; in generic_identify()
837 c->phys_proc_id = c->initial_apicid; in generic_identify()
840 get_model_name(c); /* Default name */ in generic_identify()
842 detect_nopl(c); in generic_identify()
845 static void x86_init_cache_qos(struct cpuinfo_x86 *c) in x86_init_cache_qos() argument
852 if (c != &boot_cpu_data) { in x86_init_cache_qos()
855 c->x86_cache_max_rmid); in x86_init_cache_qos()
862 static void identify_cpu(struct cpuinfo_x86 *c) in identify_cpu() argument
866 c->loops_per_jiffy = loops_per_jiffy; in identify_cpu()
867 c->x86_cache_size = -1; in identify_cpu()
868 c->x86_vendor = X86_VENDOR_UNKNOWN; in identify_cpu()
869 c->x86_model = c->x86_mask = 0; /* So far unknown... */ in identify_cpu()
870 c->x86_vendor_id[0] = '\0'; /* Unset */ in identify_cpu()
871 c->x86_model_id[0] = '\0'; /* Unset */ in identify_cpu()
872 c->x86_max_cores = 1; in identify_cpu()
873 c->x86_coreid_bits = 0; in identify_cpu()
875 c->x86_clflush_size = 64; in identify_cpu()
876 c->x86_phys_bits = 36; in identify_cpu()
877 c->x86_virt_bits = 48; in identify_cpu()
879 c->cpuid_level = -1; /* CPUID not detected */ in identify_cpu()
880 c->x86_clflush_size = 32; in identify_cpu()
881 c->x86_phys_bits = 32; in identify_cpu()
882 c->x86_virt_bits = 32; in identify_cpu()
884 c->x86_cache_alignment = c->x86_clflush_size; in identify_cpu()
885 memset(&c->x86_capability, 0, sizeof c->x86_capability); in identify_cpu()
887 generic_identify(c); in identify_cpu()
890 this_cpu->c_identify(c); in identify_cpu()
894 c->x86_capability[i] &= ~cpu_caps_cleared[i]; in identify_cpu()
895 c->x86_capability[i] |= cpu_caps_set[i]; in identify_cpu()
899 c->apicid = apic->phys_pkg_id(c->initial_apicid, 0); in identify_cpu()
913 this_cpu->c_init(c); in identify_cpu()
916 squash_the_stupid_serial_number(c); in identify_cpu()
919 setup_smep(c); in identify_cpu()
920 setup_smap(c); in identify_cpu()
928 filter_cpuid_features(c, true); in identify_cpu()
931 if (!c->x86_model_id[0]) { in identify_cpu()
933 p = table_lookup_model(c); in identify_cpu()
935 strcpy(c->x86_model_id, p); in identify_cpu()
938 sprintf(c->x86_model_id, "%02x/%02x", in identify_cpu()
939 c->x86, c->x86_model); in identify_cpu()
943 detect_ht(c); in identify_cpu()
946 init_hypervisor(c); in identify_cpu()
947 x86_init_rdrand(c); in identify_cpu()
948 x86_init_cache_qos(c); in identify_cpu()
955 c->x86_capability[i] &= ~cpu_caps_cleared[i]; in identify_cpu()
956 c->x86_capability[i] |= cpu_caps_set[i]; in identify_cpu()
965 if (c != &boot_cpu_data) { in identify_cpu()
968 boot_cpu_data.x86_capability[i] &= c->x86_capability[i]; in identify_cpu()
972 c->x86_capability[i] |= boot_cpu_data.x86_capability[i]; in identify_cpu()
976 mcheck_cpu_init(c); in identify_cpu()
978 select_idle_routine(c); in identify_cpu()
1031 void identify_secondary_cpu(struct cpuinfo_x86 *c) in identify_secondary_cpu() argument
1033 BUG_ON(c == &boot_cpu_data); in identify_secondary_cpu()
1034 identify_cpu(c); in identify_secondary_cpu()
1094 void print_cpu_info(struct cpuinfo_x86 *c) in print_cpu_info() argument
1098 if (c->x86_vendor < X86_VENDOR_NUM) { in print_cpu_info()
1101 if (c->cpuid_level >= 0) in print_cpu_info()
1102 vendor = c->x86_vendor_id; in print_cpu_info()
1105 if (vendor && !strstr(c->x86_model_id, vendor)) in print_cpu_info()
1108 if (c->x86_model_id[0]) in print_cpu_info()
1109 printk(KERN_CONT "%s", c->x86_model_id); in print_cpu_info()
1111 printk(KERN_CONT "%d86", c->x86); in print_cpu_info()
1113 printk(KERN_CONT " (family: 0x%x, model: 0x%x", c->x86, c->x86_model); in print_cpu_info()
1115 if (c->x86_mask || c->cpuid_level >= 0) in print_cpu_info()
1116 printk(KERN_CONT ", stepping: 0x%x)\n", c->x86_mask); in print_cpu_info()
1120 print_cpu_msr(c); in print_cpu_info()
1123 void print_cpu_msr(struct cpuinfo_x86 *c) in print_cpu_msr() argument
1125 if (c->cpu_index < show_msr) in print_cpu_msr()