Skip to content

Commit ee545b9

Browse files
Pu WenKAGA-KOKO
Pu Wen
authored andcommitted
x86/cpu/hygon: Fix the CPU topology evaluation for real
Hygon processors with a model ID > 3 have CPUID leaf 0xB correctly populated and don't need the fixed package ID shift workaround. The fixup is also incorrect when running in a guest. Fixes: e0ceeae ("x86/CPU/hygon: Fix phys_proc_id calculation logic for multi-die processors") Signed-off-by: Pu Wen <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 0bb80ec commit ee545b9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

arch/x86/kernel/cpu/hygon.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,12 @@ static void hygon_get_topology(struct cpuinfo_x86 *c)
8787
if (!err)
8888
c->x86_coreid_bits = get_count_order(c->x86_max_cores);
8989

90-
/* Socket ID is ApicId[6] for these processors. */
91-
c->phys_proc_id = c->apicid >> APICID_SOCKET_ID_BIT;
90+
/*
91+
* Socket ID is ApicId[6] for the processors with model <= 0x3
92+
* when running on host.
93+
*/
94+
if (!boot_cpu_has(X86_FEATURE_HYPERVISOR) && c->x86_model <= 0x3)
95+
c->phys_proc_id = c->apicid >> APICID_SOCKET_ID_BIT;
9296

9397
cacheinfo_hygon_init_llc_id(c, cpu);
9498
} else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) {

0 commit comments

Comments
 (0)