x86/topology: Set cpu_die_id only if DIE_TYPE found
authorYazen Ghannam <yazen.ghannam@amd.com>
Mon, 9 Nov 2020 21:06:59 +0000 (21:06 +0000)
committerBorislav Petkov <bp@suse.de>
Thu, 19 Nov 2020 10:43:25 +0000 (11:43 +0100)
commitcb09a379724d299c603a7a79f444f52a9a75b8d2
treed903f08aab4578393d19abcc8eb14b02e844f288
parent8de0c9917cc1297bc5543b61992d5bdee4ce621a
x86/topology: Set cpu_die_id only if DIE_TYPE found

CPUID Leaf 0x1F defines a DIE_TYPE level (nb: ECX[8:15] level type == 0x5),
but CPUID Leaf 0xB does not. However, detect_extended_topology() will
set struct cpuinfo_x86.cpu_die_id regardless of whether a valid Die ID
was found.

Only set cpu_die_id if a DIE_TYPE level is found. CPU topology code may
use another value for cpu_die_id, e.g. the AMD NodeId on AMD-based
systems. Code ordering should be maintained so that the CPUID Leaf 0x1F
Die ID value will take precedence on systems that may use another value.

Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20201109210659.754018-5-Yazen.Ghannam@amd.com
arch/x86/kernel/cpu/topology.c