Skip to content

Commit 802600e

Browse files
committed
x86/xen: return a sane initial apic id when running as PV guest
With recent sanity checks for topology information added, there are now warnings issued for APs when running as a Xen PV guest: [Firmware Bug]: CPU 1: APIC ID mismatch. CPUID: 0x0000 APIC: 0x0001 This is due to the initial APIC ID obtained via CPUID for PV guests is always 0. Avoid the warnings by synthesizing the CPUID data to contain the same initial APIC ID as xen_pv_smp_config() is using for registering the APIC IDs of all CPUs. Fixes: 52128a7 ("86/cpu/topology: Make the APIC mismatch warnings complete") Signed-off-by: Juergen Gross <[email protected]>
1 parent 8a95db3 commit 802600e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

arch/x86/xen/enlighten_pv.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,21 @@ static __read_mostly unsigned int cpuid_leaf5_edx_val;
219219
static void xen_cpuid(unsigned int *ax, unsigned int *bx,
220220
unsigned int *cx, unsigned int *dx)
221221
{
222-
unsigned maskebx = ~0;
222+
unsigned int maskebx = ~0;
223+
unsigned int or_ebx = 0;
223224

224225
/*
225226
* Mask out inconvenient features, to try and disable as many
226227
* unsupported kernel subsystems as possible.
227228
*/
228229
switch (*ax) {
230+
case 0x1:
231+
/* Replace initial APIC ID in bits 24-31 of EBX. */
232+
/* See xen_pv_smp_config() for related topology preparations. */
233+
maskebx = 0x00ffffff;
234+
or_ebx = smp_processor_id() << 24;
235+
break;
236+
229237
case CPUID_MWAIT_LEAF:
230238
/* Synthesize the values.. */
231239
*ax = 0;
@@ -248,6 +256,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
248256
: "0" (*ax), "2" (*cx));
249257

250258
*bx &= maskebx;
259+
*bx |= or_ebx;
251260
}
252261

253262
static bool __init xen_check_mwait(void)

0 commit comments

Comments
 (0)