@@ -297,35 +297,46 @@ static void __init xen_filter_cpu_maps(void)
297
297
298
298
}
299
299
300
- static void __init xen_smp_prepare_boot_cpu (void )
300
+ static void __init xen_pv_smp_prepare_boot_cpu (void )
301
301
{
302
302
BUG_ON (smp_processor_id () != 0 );
303
303
native_smp_prepare_boot_cpu ();
304
304
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 );
310
309
311
310
#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 );
318
317
#endif
319
318
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 ();
323
335
324
336
/*
325
337
* Setup vcpu_info for boot CPU.
326
338
*/
327
- if (xen_hvm_domain ())
328
- xen_vcpu_setup (0 );
339
+ xen_vcpu_setup (0 );
329
340
330
341
/*
331
342
* 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)
717
728
}
718
729
719
730
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 ,
721
732
.smp_prepare_cpus = xen_smp_prepare_cpus ,
722
733
.smp_cpus_done = xen_smp_cpus_done ,
723
734
@@ -754,5 +765,5 @@ void __init xen_hvm_smp_init(void)
754
765
smp_ops .cpu_die = xen_cpu_die ;
755
766
smp_ops .send_call_func_ipi = xen_smp_send_call_function_ipi ;
756
767
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 ;
758
769
}
0 commit comments