Skip to content

Commit 7af541c

Browse files
KAGA-KOKObp3tk0v
authored andcommitted
x86/topology: Don't evaluate logical IDs during early boot
The local APICs have not yet been enumerated so the logical ID evaluation from the topology bitmaps does not work and would return an error code. Skip the evaluation during the early boot CPUID evaluation and only apply it on the final run. Fixes: 380414b ("x86/cpu/topology: Use topology logical mapping mechanism") Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Tested-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c90399f commit 7af541c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

arch/x86/kernel/cpu/topology_common.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,18 @@ static void parse_topology(struct topo_scan *tscan, bool early)
140140
}
141141
}
142142

143-
static void topo_set_ids(struct topo_scan *tscan)
143+
static void topo_set_ids(struct topo_scan *tscan, bool early)
144144
{
145145
struct cpuinfo_x86 *c = tscan->c;
146146
u32 apicid = c->topo.apicid;
147147

148148
c->topo.pkg_id = topo_shift_apicid(apicid, TOPO_PKG_DOMAIN);
149149
c->topo.die_id = topo_shift_apicid(apicid, TOPO_DIE_DOMAIN);
150150

151-
c->topo.logical_pkg_id = topology_get_logical_id(apicid, TOPO_PKG_DOMAIN);
152-
c->topo.logical_die_id = topology_get_logical_id(apicid, TOPO_DIE_DOMAIN);
151+
if (!early) {
152+
c->topo.logical_pkg_id = topology_get_logical_id(apicid, TOPO_PKG_DOMAIN);
153+
c->topo.logical_die_id = topology_get_logical_id(apicid, TOPO_DIE_DOMAIN);
154+
}
153155

154156
/* Package relative core ID */
155157
c->topo.core_id = (apicid & topo_domain_mask(TOPO_PKG_DOMAIN)) >>
@@ -187,7 +189,7 @@ void cpu_parse_topology(struct cpuinfo_x86 *c)
187189
tscan.dom_shifts[dom], x86_topo_system.dom_shifts[dom]);
188190
}
189191

190-
topo_set_ids(&tscan);
192+
topo_set_ids(&tscan, false);
191193
}
192194

193195
void __init cpu_init_topology(struct cpuinfo_x86 *c)
@@ -208,7 +210,7 @@ void __init cpu_init_topology(struct cpuinfo_x86 *c)
208210
x86_topo_system.dom_size[dom] = 1U << sft;
209211
}
210212

211-
topo_set_ids(&tscan);
213+
topo_set_ids(&tscan, true);
212214

213215
/*
214216
* AMD systems have Nodes per package which cannot be mapped to

0 commit comments

Comments
 (0)