diff --git a/arch/x86/kernel/cpu/topology_amd.c b/arch/x86/kernel/cpu/topology_amd.c
index fec849fff82f..2ff6988e020a 100644
--- a/arch/x86/kernel/cpu/topology_amd.c
+++ b/arch/x86/kernel/cpu/topology_amd.c
@@ -80,7 +80,13 @@ static bool parse_8000_001e(struct topo_scan *tscan, bool has_topoext)
cpuid_leaf(0x8000001e, &leaf);
- tscan->c->topo.initial_apicid = leaf.ext_apic_id;
+ /*
+ * Prefer initial_apicid parsed from CPUID leaf 0x8000026 or 0xb
+ * if available. Otherwise prefer the one from leaf 0x8000001e
+ * over 0x1.
+ */
+ if (!has_topoext)
+ tscan->c->topo.initial_apicid = leaf.ext_apic_id;
My understanding is that the rest of this function continues to work
properly with an all-zero return value from CPUID leaf 0x8000001e - data
from topoext is preferred where available, and other sources are used
for llc_id.
And, this fixes the firmware bug warning seen during a guest boot in
qemu for me, so for this patch:
Tested-by: Naveen N Rao (AMD) <naveen@xxxxxxxxxx>