Lines Matching refs:c

69 static void default_init(struct cpuinfo_x86 *c)  in default_init()  argument
72 cpu_detect_cache_sizes(c); in default_init()
76 if (c->cpuid_level == -1) { in default_init()
78 if (c->x86 == 4) in default_init()
79 strcpy(c->x86_model_id, "486"); in default_init()
80 else if (c->x86 == 3) in default_init()
81 strcpy(c->x86_model_id, "386"); in default_init()
236 static void squash_the_stupid_serial_number(struct cpuinfo_x86 *c) in squash_the_stupid_serial_number() argument
240 if (!cpu_has(c, X86_FEATURE_PN) || !disable_x86_serial_nr) in squash_the_stupid_serial_number()
250 clear_cpu_cap(c, X86_FEATURE_PN); in squash_the_stupid_serial_number()
253 c->cpuid_level = cpuid_eax(0); in squash_the_stupid_serial_number()
267 static inline void squash_the_stupid_serial_number(struct cpuinfo_x86 *c) in squash_the_stupid_serial_number() argument
279 static __always_inline void setup_smep(struct cpuinfo_x86 *c) in setup_smep() argument
281 if (cpu_has(c, X86_FEATURE_SMEP)) in setup_smep()
292 static __always_inline void setup_smap(struct cpuinfo_x86 *c) in setup_smap() argument
299 if (cpu_has(c, X86_FEATURE_SMAP)) { in setup_smap()
326 static void filter_cpuid_features(struct cpuinfo_x86 *c, bool warn) in filter_cpuid_features() argument
332 if (!cpu_has(c, df->feature)) in filter_cpuid_features()
342 (u32)df->level > (u32)c->extended_cpuid_level : in filter_cpuid_features()
343 (s32)df->level > (s32)c->cpuid_level)) in filter_cpuid_features()
346 clear_cpu_cap(c, df->feature); in filter_cpuid_features()
364 static const char *table_lookup_model(struct cpuinfo_x86 *c) in table_lookup_model() argument
369 if (c->x86_model >= 16) in table_lookup_model()
378 if (info->family == c->x86) in table_lookup_model()
379 return info->model_names[c->x86_model]; in table_lookup_model()
418 static void get_model_name(struct cpuinfo_x86 *c) in get_model_name() argument
423 if (c->extended_cpuid_level < 0x80000004) in get_model_name()
426 v = (unsigned int *)c->x86_model_id; in get_model_name()
430 c->x86_model_id[48] = 0; in get_model_name()
436 p = q = &c->x86_model_id[0]; in get_model_name()
442 while (q <= &c->x86_model_id[48]) in get_model_name()
447 void cpu_detect_cache_sizes(struct cpuinfo_x86 *c) in cpu_detect_cache_sizes() argument
451 n = c->extended_cpuid_level; in cpu_detect_cache_sizes()
455 c->x86_cache_size = (ecx>>24) + (edx>>24); in cpu_detect_cache_sizes()
458 c->x86_tlbsize = 0; in cpu_detect_cache_sizes()
469 c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff); in cpu_detect_cache_sizes()
473 l2size = this_cpu->legacy_cache_size(c, l2size); in cpu_detect_cache_sizes()
483 c->x86_cache_size = l2size; in cpu_detect_cache_sizes()
494 static void cpu_detect_tlb(struct cpuinfo_x86 *c) in cpu_detect_tlb() argument
497 this_cpu->c_detect_tlb(c); in cpu_detect_tlb()
508 void detect_ht(struct cpuinfo_x86 *c) in detect_ht() argument
515 if (!cpu_has(c, X86_FEATURE_HT)) in detect_ht()
518 if (cpu_has(c, X86_FEATURE_CMP_LEGACY)) in detect_ht()
521 if (cpu_has(c, X86_FEATURE_XTOPOLOGY)) in detect_ht()
537 c->phys_proc_id = apic->phys_pkg_id(c->initial_apicid, index_msb); in detect_ht()
539 smp_num_siblings = smp_num_siblings / c->x86_max_cores; in detect_ht()
543 core_bits = get_count_order(c->x86_max_cores); in detect_ht()
545 c->cpu_core_id = apic->phys_pkg_id(c->initial_apicid, index_msb) & in detect_ht()
549 if (!printed && (c->x86_max_cores * smp_num_siblings) > 1) { in detect_ht()
551 c->phys_proc_id); in detect_ht()
553 c->cpu_core_id); in detect_ht()
559 static void get_cpu_vendor(struct cpuinfo_x86 *c) in get_cpu_vendor() argument
561 char *v = c->x86_vendor_id; in get_cpu_vendor()
573 c->x86_vendor = this_cpu->c_x86_vendor; in get_cpu_vendor()
582 c->x86_vendor = X86_VENDOR_UNKNOWN; in get_cpu_vendor()
586 void cpu_detect(struct cpuinfo_x86 *c) in cpu_detect() argument
589 cpuid(0x00000000, (unsigned int *)&c->cpuid_level, in cpu_detect()
590 (unsigned int *)&c->x86_vendor_id[0], in cpu_detect()
591 (unsigned int *)&c->x86_vendor_id[8], in cpu_detect()
592 (unsigned int *)&c->x86_vendor_id[4]); in cpu_detect()
594 c->x86 = 4; in cpu_detect()
596 if (c->cpuid_level >= 0x00000001) { in cpu_detect()
600 c->x86 = (tfms >> 8) & 0xf; in cpu_detect()
601 c->x86_model = (tfms >> 4) & 0xf; in cpu_detect()
602 c->x86_mask = tfms & 0xf; in cpu_detect()
604 if (c->x86 == 0xf) in cpu_detect()
605 c->x86 += (tfms >> 20) & 0xff; in cpu_detect()
606 if (c->x86 >= 0x6) in cpu_detect()
607 c->x86_model += ((tfms >> 16) & 0xf) << 4; in cpu_detect()
610 c->x86_clflush_size = ((misc >> 8) & 0xff) * 8; in cpu_detect()
611 c->x86_cache_alignment = c->x86_clflush_size; in cpu_detect()
616 void get_cpu_cap(struct cpuinfo_x86 *c) in get_cpu_cap() argument
622 if (c->cpuid_level >= 0x00000001) { in get_cpu_cap()
626 c->x86_capability[0] = capability; in get_cpu_cap()
627 c->x86_capability[4] = excap; in get_cpu_cap()
631 if (c->cpuid_level >= 0x00000007) { in get_cpu_cap()
636 c->x86_capability[9] = ebx; in get_cpu_cap()
640 if (c->cpuid_level >= 0x0000000d) { in get_cpu_cap()
645 c->x86_capability[10] = eax; in get_cpu_cap()
649 if (c->cpuid_level >= 0x0000000F) { in get_cpu_cap()
654 c->x86_capability[11] = edx; in get_cpu_cap()
655 if (cpu_has(c, X86_FEATURE_CQM_LLC)) { in get_cpu_cap()
657 c->x86_cache_max_rmid = ebx; in get_cpu_cap()
661 c->x86_capability[12] = edx; in get_cpu_cap()
662 if (cpu_has(c, X86_FEATURE_CQM_OCCUP_LLC)) { in get_cpu_cap()
663 c->x86_cache_max_rmid = ecx; in get_cpu_cap()
664 c->x86_cache_occ_scale = ebx; in get_cpu_cap()
667 c->x86_cache_max_rmid = -1; in get_cpu_cap()
668 c->x86_cache_occ_scale = -1; in get_cpu_cap()
674 c->extended_cpuid_level = xlvl; in get_cpu_cap()
678 c->x86_capability[1] = cpuid_edx(0x80000001); in get_cpu_cap()
679 c->x86_capability[6] = cpuid_ecx(0x80000001); in get_cpu_cap()
683 if (c->extended_cpuid_level >= 0x80000008) { in get_cpu_cap()
686 c->x86_virt_bits = (eax >> 8) & 0xff; in get_cpu_cap()
687 c->x86_phys_bits = eax & 0xff; in get_cpu_cap()
690 else if (cpu_has(c, X86_FEATURE_PAE) || cpu_has(c, X86_FEATURE_PSE36)) in get_cpu_cap()
691 c->x86_phys_bits = 36; in get_cpu_cap()
694 if (c->extended_cpuid_level >= 0x80000007) in get_cpu_cap()
695 c->x86_power = cpuid_edx(0x80000007); in get_cpu_cap()
697 init_scattered_cpuid_features(c); in get_cpu_cap()
700 static void identify_cpu_without_cpuid(struct cpuinfo_x86 *c) in identify_cpu_without_cpuid() argument
710 c->x86 = 4; in identify_cpu_without_cpuid()
712 c->x86 = 3; in identify_cpu_without_cpuid()
716 c->x86_vendor_id[0] = 0; in identify_cpu_without_cpuid()
717 cpu_devs[i]->c_identify(c); in identify_cpu_without_cpuid()
718 if (c->x86_vendor_id[0]) { in identify_cpu_without_cpuid()
719 get_cpu_vendor(c); in identify_cpu_without_cpuid()
735 static void __init early_identify_cpu(struct cpuinfo_x86 *c) in early_identify_cpu() argument
738 c->x86_clflush_size = 64; in early_identify_cpu()
739 c->x86_phys_bits = 36; in early_identify_cpu()
740 c->x86_virt_bits = 48; in early_identify_cpu()
742 c->x86_clflush_size = 32; in early_identify_cpu()
743 c->x86_phys_bits = 32; in early_identify_cpu()
744 c->x86_virt_bits = 32; in early_identify_cpu()
746 c->x86_cache_alignment = c->x86_clflush_size; in early_identify_cpu()
748 memset(&c->x86_capability, 0, sizeof c->x86_capability); in early_identify_cpu()
749 c->extended_cpuid_level = 0; in early_identify_cpu()
752 identify_cpu_without_cpuid(c); in early_identify_cpu()
758 cpu_detect(c); in early_identify_cpu()
759 get_cpu_vendor(c); in early_identify_cpu()
760 get_cpu_cap(c); in early_identify_cpu()
761 fpu_detect(c); in early_identify_cpu()
764 this_cpu->c_early_init(c); in early_identify_cpu()
766 c->cpu_index = 0; in early_identify_cpu()
767 filter_cpuid_features(c, false); in early_identify_cpu()
770 this_cpu->c_bsp_init(c); in early_identify_cpu()
817 static void detect_nopl(struct cpuinfo_x86 *c) in detect_nopl() argument
820 clear_cpu_cap(c, X86_FEATURE_NOPL); in detect_nopl()
822 set_cpu_cap(c, X86_FEATURE_NOPL); in detect_nopl()
826 static void generic_identify(struct cpuinfo_x86 *c) in generic_identify() argument
828 c->extended_cpuid_level = 0; in generic_identify()
831 identify_cpu_without_cpuid(c); in generic_identify()
837 cpu_detect(c); in generic_identify()
839 get_cpu_vendor(c); in generic_identify()
841 get_cpu_cap(c); in generic_identify()
843 if (c->cpuid_level >= 0x00000001) { in generic_identify()
844 c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xFF; in generic_identify()
847 c->apicid = apic->phys_pkg_id(c->initial_apicid, 0); in generic_identify()
849 c->apicid = c->initial_apicid; in generic_identify()
852 c->phys_proc_id = c->initial_apicid; in generic_identify()
855 get_model_name(c); /* Default name */ in generic_identify()
857 detect_nopl(c); in generic_identify()
860 static void x86_init_cache_qos(struct cpuinfo_x86 *c) in x86_init_cache_qos() argument
867 if (c != &boot_cpu_data) { in x86_init_cache_qos()
870 c->x86_cache_max_rmid); in x86_init_cache_qos()
877 static void identify_cpu(struct cpuinfo_x86 *c) in identify_cpu() argument
881 c->loops_per_jiffy = loops_per_jiffy; in identify_cpu()
882 c->x86_cache_size = -1; in identify_cpu()
883 c->x86_vendor = X86_VENDOR_UNKNOWN; in identify_cpu()
884 c->x86_model = c->x86_mask = 0; /* So far unknown... */ in identify_cpu()
885 c->x86_vendor_id[0] = '\0'; /* Unset */ in identify_cpu()
886 c->x86_model_id[0] = '\0'; /* Unset */ in identify_cpu()
887 c->x86_max_cores = 1; in identify_cpu()
888 c->x86_coreid_bits = 0; in identify_cpu()
890 c->x86_clflush_size = 64; in identify_cpu()
891 c->x86_phys_bits = 36; in identify_cpu()
892 c->x86_virt_bits = 48; in identify_cpu()
894 c->cpuid_level = -1; /* CPUID not detected */ in identify_cpu()
895 c->x86_clflush_size = 32; in identify_cpu()
896 c->x86_phys_bits = 32; in identify_cpu()
897 c->x86_virt_bits = 32; in identify_cpu()
899 c->x86_cache_alignment = c->x86_clflush_size; in identify_cpu()
900 memset(&c->x86_capability, 0, sizeof c->x86_capability); in identify_cpu()
902 generic_identify(c); in identify_cpu()
905 this_cpu->c_identify(c); in identify_cpu()
909 c->x86_capability[i] &= ~cpu_caps_cleared[i]; in identify_cpu()
910 c->x86_capability[i] |= cpu_caps_set[i]; in identify_cpu()
914 c->apicid = apic->phys_pkg_id(c->initial_apicid, 0); in identify_cpu()
928 this_cpu->c_init(c); in identify_cpu()
931 squash_the_stupid_serial_number(c); in identify_cpu()
934 setup_smep(c); in identify_cpu()
935 setup_smap(c); in identify_cpu()
943 filter_cpuid_features(c, true); in identify_cpu()
946 if (!c->x86_model_id[0]) { in identify_cpu()
948 p = table_lookup_model(c); in identify_cpu()
950 strcpy(c->x86_model_id, p); in identify_cpu()
953 sprintf(c->x86_model_id, "%02x/%02x", in identify_cpu()
954 c->x86, c->x86_model); in identify_cpu()
958 detect_ht(c); in identify_cpu()
961 init_hypervisor(c); in identify_cpu()
962 x86_init_rdrand(c); in identify_cpu()
963 x86_init_cache_qos(c); in identify_cpu()
970 c->x86_capability[i] &= ~cpu_caps_cleared[i]; in identify_cpu()
971 c->x86_capability[i] |= cpu_caps_set[i]; in identify_cpu()
980 if (c != &boot_cpu_data) { in identify_cpu()
983 boot_cpu_data.x86_capability[i] &= c->x86_capability[i]; in identify_cpu()
987 c->x86_capability[i] |= boot_cpu_data.x86_capability[i]; in identify_cpu()
991 mcheck_cpu_init(c); in identify_cpu()
993 select_idle_routine(c); in identify_cpu()
1046 void identify_secondary_cpu(struct cpuinfo_x86 *c) in identify_secondary_cpu() argument
1048 BUG_ON(c == &boot_cpu_data); in identify_secondary_cpu()
1049 identify_cpu(c); in identify_secondary_cpu()
1109 void print_cpu_info(struct cpuinfo_x86 *c) in print_cpu_info() argument
1113 if (c->x86_vendor < X86_VENDOR_NUM) { in print_cpu_info()
1116 if (c->cpuid_level >= 0) in print_cpu_info()
1117 vendor = c->x86_vendor_id; in print_cpu_info()
1120 if (vendor && !strstr(c->x86_model_id, vendor)) in print_cpu_info()
1123 if (c->x86_model_id[0]) in print_cpu_info()
1124 printk(KERN_CONT "%s", strim(c->x86_model_id)); in print_cpu_info()
1126 printk(KERN_CONT "%d86", c->x86); in print_cpu_info()
1128 printk(KERN_CONT " (fam: %02x, model: %02x", c->x86, c->x86_model); in print_cpu_info()
1130 if (c->x86_mask || c->cpuid_level >= 0) in print_cpu_info()
1131 printk(KERN_CONT ", stepping: %02x)\n", c->x86_mask); in print_cpu_info()
1135 print_cpu_msr(c); in print_cpu_info()
1138 void print_cpu_msr(struct cpuinfo_x86 *c) in print_cpu_msr() argument
1140 if (c->cpu_index < show_msr) in print_cpu_msr()