Skip to content

Commit a2d1078

Browse files
vittyvkjgross1
authored andcommitted
x86/xen: split xen_smp_prepare_boot_cpu()
Split xen_smp_prepare_boot_cpu() into xen_pv_smp_prepare_boot_cpu() and xen_hvm_smp_prepare_boot_cpu() to support further splitting of smp.c. Signed-off-by: Vitaly Kuznetsov <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent 04e9576 commit a2d1078

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

arch/x86/xen/smp.c

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -297,35 +297,46 @@ static void __init xen_filter_cpu_maps(void)
297297

298298
}
299299

300-
static void __init xen_smp_prepare_boot_cpu(void)
300+
static void __init xen_pv_smp_prepare_boot_cpu(void)
301301
{
302302
BUG_ON(smp_processor_id() != 0);
303303
native_smp_prepare_boot_cpu();
304304

305-
if (xen_pv_domain()) {
306-
if (!xen_feature(XENFEAT_writable_page_tables))
307-
/* We've switched to the "real" per-cpu gdt, so make
308-
* sure the old memory can be recycled. */
309-
make_lowmem_page_readwrite(xen_initial_gdt);
305+
if (!xen_feature(XENFEAT_writable_page_tables))
306+
/* We've switched to the "real" per-cpu gdt, so make
307+
* sure the old memory can be recycled. */
308+
make_lowmem_page_readwrite(xen_initial_gdt);
310309

311310
#ifdef CONFIG_X86_32
312-
/*
313-
* Xen starts us with XEN_FLAT_RING1_DS, but linux code
314-
* expects __USER_DS
315-
*/
316-
loadsegment(ds, __USER_DS);
317-
loadsegment(es, __USER_DS);
311+
/*
312+
* Xen starts us with XEN_FLAT_RING1_DS, but linux code
313+
* expects __USER_DS
314+
*/
315+
loadsegment(ds, __USER_DS);
316+
loadsegment(es, __USER_DS);
318317
#endif
319318

320-
xen_filter_cpu_maps();
321-
xen_setup_vcpu_info_placement();
322-
}
319+
xen_filter_cpu_maps();
320+
xen_setup_vcpu_info_placement();
321+
322+
/*
323+
* The alternative logic (which patches the unlock/lock) runs before
324+
* the smp bootup up code is activated. Hence we need to set this up
325+
* the core kernel is being patched. Otherwise we will have only
326+
* modules patched but not core code.
327+
*/
328+
xen_init_spinlocks();
329+
}
330+
331+
static void __init xen_hvm_smp_prepare_boot_cpu(void)
332+
{
333+
BUG_ON(smp_processor_id() != 0);
334+
native_smp_prepare_boot_cpu();
323335

324336
/*
325337
* Setup vcpu_info for boot CPU.
326338
*/
327-
if (xen_hvm_domain())
328-
xen_vcpu_setup(0);
339+
xen_vcpu_setup(0);
329340

330341
/*
331342
* The alternative logic (which patches the unlock/lock) runs before
@@ -717,7 +728,7 @@ static irqreturn_t xen_irq_work_interrupt(int irq, void *dev_id)
717728
}
718729

719730
static const struct smp_ops xen_smp_ops __initconst = {
720-
.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
731+
.smp_prepare_boot_cpu = xen_pv_smp_prepare_boot_cpu,
721732
.smp_prepare_cpus = xen_smp_prepare_cpus,
722733
.smp_cpus_done = xen_smp_cpus_done,
723734

@@ -754,5 +765,5 @@ void __init xen_hvm_smp_init(void)
754765
smp_ops.cpu_die = xen_cpu_die;
755766
smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi;
756767
smp_ops.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi;
757-
smp_ops.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu;
768+
smp_ops.smp_prepare_boot_cpu = xen_hvm_smp_prepare_boot_cpu;
758769
}

0 commit comments

Comments
 (0)