diff options
Diffstat (limited to 'arch/x86/kernel/cpu/common.c')
| -rw-r--r-- | arch/x86/kernel/cpu/common.c | 85 | 
1 files changed, 10 insertions, 75 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index cc9e980c68ec..1f6b50a449ab 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -979,29 +979,21 @@ static void x86_init_cache_qos(struct cpuinfo_x86 *c)  }  /* - * The physical to logical package id mapping is initialized from the - * acpi/mptables information. Make sure that CPUID actually agrees with - * that. + * Validate that ACPI/mptables have the same information about the + * effective APIC id and update the package map.   */ -static void sanitize_package_id(struct cpuinfo_x86 *c) +static void validate_apic_and_package_id(struct cpuinfo_x86 *c)  {  #ifdef CONFIG_SMP -	unsigned int pkg, apicid, cpu = smp_processor_id(); +	unsigned int apicid, cpu = smp_processor_id();  	apicid = apic->cpu_present_to_apicid(cpu); -	pkg = apicid >> boot_cpu_data.x86_coreid_bits; -	if (apicid != c->initial_apicid) { -		pr_err(FW_BUG "CPU%u: APIC id mismatch. Firmware: %x CPUID: %x\n", +	if (apicid != c->apicid) { +		pr_err(FW_BUG "CPU%u: APIC id mismatch. Firmware: %x APIC: %x\n",  		       cpu, apicid, c->initial_apicid); -		c->initial_apicid = apicid;  	} -	if (pkg != c->phys_proc_id) { -		pr_err(FW_BUG "CPU%u: Using firmware package id %u instead of %u\n", -		       cpu, pkg, c->phys_proc_id); -		c->phys_proc_id = pkg; -	} -	c->logical_proc_id = topology_phys_to_logical_pkg(pkg); +	BUG_ON(topology_update_package_map(c->phys_proc_id, cpu));  #else  	c->logical_proc_id = 0;  #endif @@ -1132,7 +1124,6 @@ static void identify_cpu(struct cpuinfo_x86 *c)  #ifdef CONFIG_NUMA  	numa_add_cpu(smp_processor_id());  #endif -	sanitize_package_id(c);  }  /* @@ -1172,7 +1163,6 @@ void enable_sep_cpu(void)  void __init identify_boot_cpu(void)  {  	identify_cpu(&boot_cpu_data); -	init_amd_e400_c1e_mask();  #ifdef CONFIG_X86_32  	sysenter_setup();  	enable_sep_cpu(); @@ -1188,53 +1178,9 @@ void identify_secondary_cpu(struct cpuinfo_x86 *c)  	enable_sep_cpu();  #endif  	mtrr_ap_init(); +	validate_apic_and_package_id(c);  } -struct msr_range { -	unsigned	min; -	unsigned	max; -}; - -static const struct msr_range msr_range_array[] = { -	{ 0x00000000, 0x00000418}, -	{ 0xc0000000, 0xc000040b}, -	{ 0xc0010000, 0xc0010142}, -	{ 0xc0011000, 0xc001103b}, -}; - -static void __print_cpu_msr(void) -{ -	unsigned index_min, index_max; -	unsigned index; -	u64 val; -	int i; - -	for (i = 0; i < ARRAY_SIZE(msr_range_array); i++) { -		index_min = msr_range_array[i].min; -		index_max = msr_range_array[i].max; - -		for (index = index_min; index < index_max; index++) { -			if (rdmsrl_safe(index, &val)) -				continue; -			pr_info(" MSR%08x: %016llx\n", index, val); -		} -	} -} - -static int show_msr; - -static __init int setup_show_msr(char *arg) -{ -	int num; - -	get_option(&arg, &num); - -	if (num > 0) -		show_msr = num; -	return 1; -} -__setup("show_msr=", setup_show_msr); -  static __init int setup_noclflush(char *arg)  {  	setup_clear_cpu_cap(X86_FEATURE_CLFLUSH); @@ -1268,14 +1214,6 @@ void print_cpu_info(struct cpuinfo_x86 *c)  		pr_cont(", stepping: 0x%x)\n", c->x86_mask);  	else  		pr_cont(")\n"); - -	print_cpu_msr(c); -} - -void print_cpu_msr(struct cpuinfo_x86 *c) -{ -	if (c->cpu_index < show_msr) -		__print_cpu_msr();  }  static __init int setup_disablecpuid(char *arg) @@ -1490,11 +1428,8 @@ void cpu_init(void)  	 */  	cr4_init_shadow(); -	/* -	 * Load microcode on this cpu if a valid microcode is available. -	 * This is early microcode loading procedure. -	 */ -	load_ucode_ap(); +	if (cpu) +		load_ucode_ap();  	t = &per_cpu(cpu_tss, cpu);  	oist = &per_cpu(orig_ist, cpu);  |