diff options
Diffstat (limited to 'arch/mips/kernel/smp.c')
| -rw-r--r-- | arch/mips/kernel/smp.c | 26 | 
1 files changed, 25 insertions, 1 deletions
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 9bad52ede903..c94c4e92e17d 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c @@ -59,9 +59,16 @@ EXPORT_SYMBOL(smp_num_siblings);  cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly;  EXPORT_SYMBOL(cpu_sibling_map); +/* representing the core map of multi-core chips of each logical CPU */ +cpumask_t cpu_core_map[NR_CPUS] __read_mostly; +EXPORT_SYMBOL(cpu_core_map); +  /* representing cpus for which sibling maps can be computed */  static cpumask_t cpu_sibling_setup_map; +/* representing cpus for which core maps can be computed */ +static cpumask_t cpu_core_setup_map; +  cpumask_t cpu_coherent_mask;  static inline void set_cpu_sibling_map(int cpu) @@ -72,7 +79,8 @@ static inline void set_cpu_sibling_map(int cpu)  	if (smp_num_siblings > 1) {  		for_each_cpu_mask(i, cpu_sibling_setup_map) { -			if (cpu_data[cpu].core == cpu_data[i].core) { +			if (cpu_data[cpu].package == cpu_data[i].package && +				    cpu_data[cpu].core == cpu_data[i].core) {  				cpu_set(i, cpu_sibling_map[cpu]);  				cpu_set(cpu, cpu_sibling_map[i]);  			} @@ -81,6 +89,20 @@ static inline void set_cpu_sibling_map(int cpu)  		cpu_set(cpu, cpu_sibling_map[cpu]);  } +static inline void set_cpu_core_map(int cpu) +{ +	int i; + +	cpu_set(cpu, cpu_core_setup_map); + +	for_each_cpu_mask(i, cpu_core_setup_map) { +		if (cpu_data[cpu].package == cpu_data[i].package) { +			cpu_set(i, cpu_core_map[cpu]); +			cpu_set(cpu, cpu_core_map[i]); +		} +	} +} +  struct plat_smp_ops *mp_ops;  EXPORT_SYMBOL(mp_ops); @@ -122,6 +144,7 @@ asmlinkage void start_secondary(void)  	set_cpu_online(cpu, true);  	set_cpu_sibling_map(cpu); +	set_cpu_core_map(cpu);  	cpu_set(cpu, cpu_callin_map); @@ -175,6 +198,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)  	current_thread_info()->cpu = 0;  	mp_ops->prepare_cpus(max_cpus);  	set_cpu_sibling_map(0); +	set_cpu_core_map(0);  #ifndef CONFIG_HOTPLUG_CPU  	init_cpu_present(cpu_possible_mask);  #endif  |