Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 cpuid updates from Ingo Molnar:
"AMD F17h related updates"

* 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/cpu/amd: Hide unused legacy_fixup_core_id() function
x86/cpu/amd: Derive L3 shared_cpu_map from cpu_llc_shared_mask
x86/cpu/amd: Limit cpu_core_id fixup to families older than F17h

+36 -22
+18 -8
arch/x86/kernel/cpu/amd.c
··· 297 297 } 298 298 #endif 299 299 300 + #ifdef CONFIG_SMP 301 + /* 302 + * Fix up cpu_core_id for pre-F17h systems to be in the 303 + * [0 .. cores_per_node - 1] range. Not really needed but 304 + * kept so as not to break existing setups. 305 + */ 306 + static void legacy_fixup_core_id(struct cpuinfo_x86 *c) 307 + { 308 + u32 cus_per_node; 309 + 310 + if (c->x86 >= 0x17) 311 + return; 312 + 313 + cus_per_node = c->x86_max_cores / nodes_per_socket; 314 + c->cpu_core_id %= cus_per_node; 315 + } 316 + 300 317 /* 301 318 * Fixup core topology information for 302 319 * (1) AMD multi-node processors 303 320 * Assumption: Number of cores in each internal node is the same. 304 321 * (2) AMD processors supporting compute units 305 322 */ 306 - #ifdef CONFIG_SMP 307 323 static void amd_get_topology(struct cpuinfo_x86 *c) 308 324 { 309 325 u8 node_id; ··· 370 354 } else 371 355 return; 372 356 373 - /* fixup multi-node processor information */ 374 357 if (nodes_per_socket > 1) { 375 - u32 cus_per_node; 376 - 377 358 set_cpu_cap(c, X86_FEATURE_AMD_DCM); 378 - cus_per_node = c->x86_max_cores / nodes_per_socket; 379 - 380 - /* core id has to be in the [0 .. cores_per_node - 1] range */ 381 - c->cpu_core_id %= cus_per_node; 359 + legacy_fixup_core_id(c); 382 360 } 383 361 } 384 362 #endif
+18 -14
arch/x86/kernel/cpu/intel_cacheinfo.c
··· 811 811 struct cacheinfo *this_leaf; 812 812 int i, sibling; 813 813 814 - if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { 814 + /* 815 + * For L3, always use the pre-calculated cpu_llc_shared_mask 816 + * to derive shared_cpu_map. 817 + */ 818 + if (index == 3) { 819 + for_each_cpu(i, cpu_llc_shared_mask(cpu)) { 820 + this_cpu_ci = get_cpu_cacheinfo(i); 821 + if (!this_cpu_ci->info_list) 822 + continue; 823 + this_leaf = this_cpu_ci->info_list + index; 824 + for_each_cpu(sibling, cpu_llc_shared_mask(cpu)) { 825 + if (!cpu_online(sibling)) 826 + continue; 827 + cpumask_set_cpu(sibling, 828 + &this_leaf->shared_cpu_map); 829 + } 830 + } 831 + } else if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { 815 832 unsigned int apicid, nshared, first, last; 816 833 817 834 this_leaf = this_cpu_ci->info_list + index; ··· 851 834 for_each_online_cpu(sibling) { 852 835 apicid = cpu_data(sibling).apicid; 853 836 if ((apicid < first) || (apicid > last)) 854 - continue; 855 - cpumask_set_cpu(sibling, 856 - &this_leaf->shared_cpu_map); 857 - } 858 - } 859 - } else if (index == 3) { 860 - for_each_cpu(i, cpu_llc_shared_mask(cpu)) { 861 - this_cpu_ci = get_cpu_cacheinfo(i); 862 - if (!this_cpu_ci->info_list) 863 - continue; 864 - this_leaf = this_cpu_ci->info_list + index; 865 - for_each_cpu(sibling, cpu_llc_shared_mask(cpu)) { 866 - if (!cpu_online(sibling)) 867 837 continue; 868 838 cpumask_set_cpu(sibling, 869 839 &this_leaf->shared_cpu_map);