Skip to content

Commit ddb4c3f

Browse files
committed
Merge tag 'for-linus-6.9a-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fixes from Juergen Gross: "Two fixes when running as Xen PV guests for issues introduced in the 6.9 merge window, both related to apic id handling" * tag 'for-linus-6.9a-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: x86/xen: return a sane initial apic id when running as PV guest x86/xen/smp_pv: Register the boot CPU APIC properly
2 parents f094ee7 + 802600e commit ddb4c3f

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
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)

arch/x86/xen/smp_pv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ static void __init xen_pv_smp_config(void)
154154
u32 apicid = 0;
155155
int i;
156156

157-
topology_register_boot_apic(apicid++);
157+
topology_register_boot_apic(apicid);
158158

159-
for (i = 1; i < nr_cpu_ids; i++)
159+
for (i = 0; i < nr_cpu_ids; i++)
160160
topology_register_apic(apicid++, CPU_ACPIID_INVALID, true);
161161

162162
/* Pretend to be a proper enumerated system */

0 commit comments

Comments
 (0)