@@ -59,9 +59,16 @@ EXPORT_SYMBOL(smp_num_siblings);
5959cpumask_t cpu_sibling_map [NR_CPUS ] __read_mostly ;
6060EXPORT_SYMBOL (cpu_sibling_map );
6161
62+ /* representing the core map of multi-core chips of each logical CPU */
63+ cpumask_t cpu_core_map [NR_CPUS ] __read_mostly ;
64+ EXPORT_SYMBOL (cpu_core_map );
65+
6266/* representing cpus for which sibling maps can be computed */
6367static cpumask_t cpu_sibling_setup_map ;
6468
69+ /* representing cpus for which core maps can be computed */
70+ static cpumask_t cpu_core_setup_map ;
71+
6572cpumask_t cpu_coherent_mask ;
6673
6774static inline void set_cpu_sibling_map (int cpu )
@@ -72,7 +79,8 @@ static inline void set_cpu_sibling_map(int cpu)
7279
7380 if (smp_num_siblings > 1 ) {
7481 for_each_cpu_mask (i , cpu_sibling_setup_map ) {
75- if (cpu_data [cpu ].core == cpu_data [i ].core ) {
82+ if (cpu_data [cpu ].package == cpu_data [i ].package &&
83+ cpu_data [cpu ].core == cpu_data [i ].core ) {
7684 cpu_set (i , cpu_sibling_map [cpu ]);
7785 cpu_set (cpu , cpu_sibling_map [i ]);
7886 }
@@ -81,6 +89,20 @@ static inline void set_cpu_sibling_map(int cpu)
8189 cpu_set (cpu , cpu_sibling_map [cpu ]);
8290}
8391
92+ static inline void set_cpu_core_map (int cpu )
93+ {
94+ int i ;
95+
96+ cpu_set (cpu , cpu_core_setup_map );
97+
98+ for_each_cpu_mask (i , cpu_core_setup_map ) {
99+ if (cpu_data [cpu ].package == cpu_data [i ].package ) {
100+ cpu_set (i , cpu_core_map [cpu ]);
101+ cpu_set (cpu , cpu_core_map [i ]);
102+ }
103+ }
104+ }
105+
84106struct plat_smp_ops * mp_ops ;
85107EXPORT_SYMBOL (mp_ops );
86108
@@ -122,6 +144,7 @@ asmlinkage void start_secondary(void)
122144 set_cpu_online (cpu , true);
123145
124146 set_cpu_sibling_map (cpu );
147+ set_cpu_core_map (cpu );
125148
126149 cpu_set (cpu , cpu_callin_map );
127150
@@ -175,6 +198,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
175198 current_thread_info ()-> cpu = 0 ;
176199 mp_ops -> prepare_cpus (max_cpus );
177200 set_cpu_sibling_map (0 );
201+ set_cpu_core_map (0 );
178202#ifndef CONFIG_HOTPLUG_CPU
179203 init_cpu_present (cpu_possible_mask );
180204#endif
0 commit comments