|
27 | 27 |
|
28 | 28 | #include "cpu.h" |
29 | 29 |
|
30 | | -/* |
31 | | - * nodes_per_socket: Stores the number of nodes per socket. |
32 | | - * Refer to Fam15h Models 00-0fh BKDG - CPUID Fn8000_001E_ECX |
33 | | - * Node Identifiers[10:8] |
34 | | - */ |
35 | | -static u32 nodes_per_socket = 1; |
36 | | - |
37 | 30 | static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) |
38 | 31 | { |
39 | 32 | u32 gprs[8] = { 0 }; |
@@ -300,97 +293,6 @@ static int nearby_node(int apicid) |
300 | 293 | } |
301 | 294 | #endif |
302 | 295 |
|
303 | | -/* |
304 | | - * Fix up topo::core_id for pre-F17h systems to be in the |
305 | | - * [0 .. cores_per_node - 1] range. Not really needed but |
306 | | - * kept so as not to break existing setups. |
307 | | - */ |
308 | | -static void legacy_fixup_core_id(struct cpuinfo_x86 *c) |
309 | | -{ |
310 | | - u32 cus_per_node; |
311 | | - |
312 | | - if (c->x86 >= 0x17) |
313 | | - return; |
314 | | - |
315 | | - cus_per_node = c->x86_max_cores / nodes_per_socket; |
316 | | - c->topo.core_id %= cus_per_node; |
317 | | -} |
318 | | - |
319 | | -/* |
320 | | - * Fixup core topology information for |
321 | | - * (1) AMD multi-node processors |
322 | | - * Assumption: Number of cores in each internal node is the same. |
323 | | - * (2) AMD processors supporting compute units |
324 | | - */ |
325 | | -static void amd_get_topology(struct cpuinfo_x86 *c) |
326 | | -{ |
327 | | - /* get information required for multi-node processors */ |
328 | | - if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { |
329 | | - int err; |
330 | | - u32 eax, ebx, ecx, edx; |
331 | | - |
332 | | - cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); |
333 | | - |
334 | | - c->topo.die_id = ecx & 0xff; |
335 | | - |
336 | | - if (c->x86 == 0x15) |
337 | | - c->topo.cu_id = ebx & 0xff; |
338 | | - |
339 | | - if (c->x86 >= 0x17) { |
340 | | - c->topo.core_id = ebx & 0xff; |
341 | | - |
342 | | - if (smp_num_siblings > 1) |
343 | | - c->x86_max_cores /= smp_num_siblings; |
344 | | - } |
345 | | - |
346 | | - /* |
347 | | - * In case leaf B is available, use it to derive |
348 | | - * topology information. |
349 | | - */ |
350 | | - err = detect_extended_topology(c); |
351 | | - if (!err) |
352 | | - c->x86_coreid_bits = get_count_order(c->x86_max_cores); |
353 | | - |
354 | | - cacheinfo_amd_init_llc_id(c, c->topo.die_id); |
355 | | - |
356 | | - } else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) { |
357 | | - u64 value; |
358 | | - |
359 | | - rdmsrl(MSR_FAM10H_NODE_ID, value); |
360 | | - c->topo.die_id = value & 7; |
361 | | - c->topo.llc_id = c->topo.die_id; |
362 | | - } else |
363 | | - return; |
364 | | - |
365 | | - if (nodes_per_socket > 1) { |
366 | | - set_cpu_cap(c, X86_FEATURE_AMD_DCM); |
367 | | - legacy_fixup_core_id(c); |
368 | | - } |
369 | | -} |
370 | | - |
371 | | -/* |
372 | | - * On a AMD dual core setup the lower bits of the APIC id distinguish the cores. |
373 | | - * Assumes number of cores is a power of two. |
374 | | - */ |
375 | | -static void amd_detect_cmp(struct cpuinfo_x86 *c) |
376 | | -{ |
377 | | - unsigned bits; |
378 | | - |
379 | | - bits = c->x86_coreid_bits; |
380 | | - /* Low order bits define the core id (index of core in socket) */ |
381 | | - c->topo.core_id = c->topo.initial_apicid & ((1 << bits)-1); |
382 | | - /* Convert the initial APIC ID into the socket ID */ |
383 | | - c->topo.pkg_id = c->topo.initial_apicid >> bits; |
384 | | - /* use socket ID also for last level cache */ |
385 | | - c->topo.llc_id = c->topo.die_id = c->topo.pkg_id; |
386 | | -} |
387 | | - |
388 | | -u32 amd_get_nodes_per_socket(void) |
389 | | -{ |
390 | | - return nodes_per_socket; |
391 | | -} |
392 | | -EXPORT_SYMBOL_GPL(amd_get_nodes_per_socket); |
393 | | - |
394 | 296 | static void srat_detect_node(struct cpuinfo_x86 *c) |
395 | 297 | { |
396 | 298 | #ifdef CONFIG_NUMA |
@@ -442,32 +344,6 @@ static void srat_detect_node(struct cpuinfo_x86 *c) |
442 | 344 | #endif |
443 | 345 | } |
444 | 346 |
|
445 | | -static void early_init_amd_mc(struct cpuinfo_x86 *c) |
446 | | -{ |
447 | | -#ifdef CONFIG_SMP |
448 | | - unsigned bits, ecx; |
449 | | - |
450 | | - /* Multi core CPU? */ |
451 | | - if (c->extended_cpuid_level < 0x80000008) |
452 | | - return; |
453 | | - |
454 | | - ecx = cpuid_ecx(0x80000008); |
455 | | - |
456 | | - c->x86_max_cores = (ecx & 0xff) + 1; |
457 | | - |
458 | | - /* CPU telling us the core id bits shift? */ |
459 | | - bits = (ecx >> 12) & 0xF; |
460 | | - |
461 | | - /* Otherwise recompute */ |
462 | | - if (bits == 0) { |
463 | | - while ((1 << bits) < c->x86_max_cores) |
464 | | - bits++; |
465 | | - } |
466 | | - |
467 | | - c->x86_coreid_bits = bits; |
468 | | -#endif |
469 | | -} |
470 | | - |
471 | 347 | static void bsp_init_amd(struct cpuinfo_x86 *c) |
472 | 348 | { |
473 | 349 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { |
@@ -500,18 +376,6 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) |
500 | 376 | if (cpu_has(c, X86_FEATURE_MWAITX)) |
501 | 377 | use_mwaitx_delay(); |
502 | 378 |
|
503 | | - if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { |
504 | | - u32 ecx; |
505 | | - |
506 | | - ecx = cpuid_ecx(0x8000001e); |
507 | | - __max_die_per_package = nodes_per_socket = ((ecx >> 8) & 7) + 1; |
508 | | - } else if (boot_cpu_has(X86_FEATURE_NODEID_MSR)) { |
509 | | - u64 value; |
510 | | - |
511 | | - rdmsrl(MSR_FAM10H_NODE_ID, value); |
512 | | - __max_die_per_package = nodes_per_socket = ((value >> 3) & 7) + 1; |
513 | | - } |
514 | | - |
515 | 379 | if (!boot_cpu_has(X86_FEATURE_AMD_SSBD) && |
516 | 380 | !boot_cpu_has(X86_FEATURE_VIRT_SSBD) && |
517 | 381 | c->x86 >= 0x15 && c->x86 <= 0x17) { |
@@ -649,8 +513,6 @@ static void early_init_amd(struct cpuinfo_x86 *c) |
649 | 513 | u64 value; |
650 | 514 | u32 dummy; |
651 | 515 |
|
652 | | - early_init_amd_mc(c); |
653 | | - |
654 | 516 | if (c->x86 >= 0xf) |
655 | 517 | set_cpu_cap(c, X86_FEATURE_K8); |
656 | 518 |
|
@@ -730,9 +592,6 @@ static void early_init_amd(struct cpuinfo_x86 *c) |
730 | 592 | } |
731 | 593 | } |
732 | 594 |
|
733 | | - if (cpu_has(c, X86_FEATURE_TOPOEXT)) |
734 | | - smp_num_siblings = ((cpuid_ebx(0x8000001e) >> 8) & 0xff) + 1; |
735 | | - |
736 | 595 | if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && !cpu_has(c, X86_FEATURE_IBPB_BRTYPE)) { |
737 | 596 | if (c->x86 == 0x17 && boot_cpu_has(X86_FEATURE_AMD_IBPB)) |
738 | 597 | setup_force_cpu_cap(X86_FEATURE_IBPB_BRTYPE); |
@@ -1076,9 +935,6 @@ static void init_amd(struct cpuinfo_x86 *c) |
1076 | 935 | if (cpu_has(c, X86_FEATURE_FSRM)) |
1077 | 936 | set_cpu_cap(c, X86_FEATURE_FSRS); |
1078 | 937 |
|
1079 | | - /* get apicid instead of initial apic id from cpuid */ |
1080 | | - c->topo.apicid = read_apic_id(); |
1081 | | - |
1082 | 938 | /* K6s reports MCEs but don't actually have all the MSRs */ |
1083 | 939 | if (c->x86 < 6) |
1084 | 940 | clear_cpu_cap(c, X86_FEATURE_MCE); |
@@ -1114,8 +970,6 @@ static void init_amd(struct cpuinfo_x86 *c) |
1114 | 970 |
|
1115 | 971 | cpu_detect_cache_sizes(c); |
1116 | 972 |
|
1117 | | - amd_detect_cmp(c); |
1118 | | - amd_get_topology(c); |
1119 | 973 | srat_detect_node(c); |
1120 | 974 |
|
1121 | 975 | init_amd_cacheinfo(c); |
|
0 commit comments