x86/cpu/hygon: Modify the CPU topology deriving method for Hygon
Hygon processors before model 4h have not use the CPUID leaf 0xB, so use
commit e0ceeae708
("x86/CPU/hygon: Fix phys_proc_id calculation logic
for multi-die processors") to derive the socket ID when running on host.
If kernel running on guest, use the hypervisor's default.
For model 4h, Hygon processors use CPUID leaf 0xB to identify SMT and
CORE level types, so use function detect_extended_topology() to derive
the core ID, socket ID and APIC ID. But it still set __max_die_per_package
to nodes_per_socket because it lacks the DIE level type.
Signed-off-by: Pu Wen <puwen@hygon.cn>
Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
Reviewed-by: Bin Lai <robinlai@tencent.com>
Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
Reviewed-by: caelli <caelli@tencent.com>
Signed-off-by: Jianping Liu <frankjpliu@tencent.com>
This commit is contained in:
parent
c6a94a3c1e
commit
602852c638
|
@ -80,16 +80,27 @@ static void hygon_get_topology(struct cpuinfo_x86 *c)
|
|||
if (smp_num_siblings > 1)
|
||||
c->x86_max_cores /= smp_num_siblings;
|
||||
|
||||
/*
|
||||
* In case leaf B is available, use it to derive
|
||||
* topology information.
|
||||
*/
|
||||
err = detect_extended_topology(c);
|
||||
if (!err)
|
||||
c->x86_coreid_bits = get_count_order(c->x86_max_cores);
|
||||
|
||||
/* Socket ID is ApicId[6] for these processors. */
|
||||
c->phys_proc_id = c->apicid >> APICID_SOCKET_ID_BIT;
|
||||
switch (c->x86_model) {
|
||||
case 0x0 ... 0x3:
|
||||
if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
|
||||
break;
|
||||
/* Socket ID is ApicId[6] for these processors. */
|
||||
c->phys_proc_id = c->apicid >> APICID_SOCKET_ID_BIT;
|
||||
break;
|
||||
case 0x4:
|
||||
/*
|
||||
* In case leaf 0xB is available, use it to derive
|
||||
* topology information.
|
||||
*/
|
||||
err = detect_extended_topology(c);
|
||||
if (!err)
|
||||
c->x86_coreid_bits =
|
||||
get_count_order(c->x86_max_cores);
|
||||
__max_die_per_package = nodes_per_socket;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
cacheinfo_hygon_init_llc_id(c, cpu);
|
||||
} else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) {
|
||||
|
|
Loading…
Reference in New Issue