Skip to content

Commit a52482d

Browse files
vittyvkjgross1
authored andcommitted
x86/xen: split off smp_hvm.c
Move PVHVM related code to smp_hvm.c. Drop 'static' qualifier from xen_smp_send_reschedule(), xen_smp_send_call_function_ipi(), xen_smp_send_call_function_single_ipi(), these functions will be moved to common smp code when smp_pv.c is split. Signed-off-by: Vitaly Kuznetsov <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent aa1c84e commit a52482d

File tree

5 files changed

+69
-54
lines changed

5 files changed

+69
-54
lines changed

arch/x86/xen/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ config XEN_PVHVM
3737
help
3838
Support running as a Xen PVHVM guest.
3939

40+
config XEN_PVHVM_SMP
41+
def_bool y
42+
depends on XEN_PVHVM && SMP
43+
4044
config XEN_512GB
4145
bool "Limit Xen pv-domain memory to 512GB"
4246
depends on XEN_PV && X86_64

arch/x86/xen/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ obj-$(CONFIG_XEN_PVH) += enlighten_pvh.o
2121
obj-$(CONFIG_EVENT_TRACING) += trace.o
2222

2323
obj-$(CONFIG_SMP) += smp.o
24+
obj-$(CONFIG_XEN_PVHVM_SMP) += smp_hvm.o
2425
obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
2526
obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o
2627
obj-$(CONFIG_XEN_DOM0) += vga.o

arch/x86/xen/smp.c

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -328,25 +328,6 @@ static void __init xen_pv_smp_prepare_boot_cpu(void)
328328
xen_init_spinlocks();
329329
}
330330

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();
335-
336-
/*
337-
* Setup vcpu_info for boot CPU.
338-
*/
339-
xen_vcpu_setup(0);
340-
341-
/*
342-
* The alternative logic (which patches the unlock/lock) runs before
343-
* the smp bootup up code is activated. Hence we need to set this up
344-
* the core kernel is being patched. Otherwise we will have only
345-
* modules patched but not core code.
346-
*/
347-
xen_init_spinlocks();
348-
}
349-
350331
static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
351332
{
352333
unsigned cpu;
@@ -530,15 +511,6 @@ static void xen_pv_cpu_die(unsigned int cpu)
530511
}
531512
}
532513

533-
static void xen_hvm_cpu_die(unsigned int cpu)
534-
{
535-
if (common_cpu_die(cpu) == 0) {
536-
xen_smp_intr_free(cpu);
537-
xen_uninit_lock_cpu(cpu);
538-
xen_teardown_timer(cpu);
539-
}
540-
}
541-
542514
static void xen_play_dead(void) /* used only with HOTPLUG_CPU */
543515
{
544516
play_dead_common();
@@ -566,11 +538,6 @@ static void xen_pv_cpu_die(unsigned int cpu)
566538
BUG();
567539
}
568540

569-
static void xen_hvm_cpu_die(unsigned int cpu)
570-
{
571-
BUG();
572-
}
573-
574541
static void xen_play_dead(void)
575542
{
576543
BUG();
@@ -596,7 +563,7 @@ static void xen_stop_other_cpus(int wait)
596563
smp_call_function(stop_self, NULL, wait);
597564
}
598565

599-
static void xen_smp_send_reschedule(int cpu)
566+
void xen_smp_send_reschedule(int cpu)
600567
{
601568
xen_send_IPI_one(cpu, XEN_RESCHEDULE_VECTOR);
602569
}
@@ -610,7 +577,7 @@ static void __xen_send_IPI_mask(const struct cpumask *mask,
610577
xen_send_IPI_one(cpu, vector);
611578
}
612579

613-
static void xen_smp_send_call_function_ipi(const struct cpumask *mask)
580+
void xen_smp_send_call_function_ipi(const struct cpumask *mask)
614581
{
615582
int cpu;
616583

@@ -625,7 +592,7 @@ static void xen_smp_send_call_function_ipi(const struct cpumask *mask)
625592
}
626593
}
627594

628-
static void xen_smp_send_call_function_single_ipi(int cpu)
595+
void xen_smp_send_call_function_single_ipi(int cpu)
629596
{
630597
__xen_send_IPI_mask(cpumask_of(cpu),
631598
XEN_CALL_FUNCTION_SINGLE_VECTOR);
@@ -763,21 +730,3 @@ void __init xen_smp_init(void)
763730
smp_ops = xen_smp_ops;
764731
xen_fill_possible_map();
765732
}
766-
767-
static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
768-
{
769-
native_smp_prepare_cpus(max_cpus);
770-
WARN_ON(xen_smp_intr_init(0));
771-
772-
xen_init_lock_cpu(0);
773-
}
774-
775-
void __init xen_hvm_smp_init(void)
776-
{
777-
smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
778-
smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
779-
smp_ops.cpu_die = xen_hvm_cpu_die;
780-
smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi;
781-
smp_ops.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi;
782-
smp_ops.smp_prepare_boot_cpu = xen_hvm_smp_prepare_boot_cpu;
783-
}

arch/x86/xen/smp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ extern void xen_smp_intr_free(unsigned int cpu);
1414
int xen_smp_intr_init_pv(unsigned int cpu);
1515
void xen_smp_intr_free_pv(unsigned int cpu);
1616

17+
void xen_smp_send_reschedule(int cpu);
18+
void xen_smp_send_call_function_ipi(const struct cpumask *mask);
19+
void xen_smp_send_call_function_single_ipi(int cpu);
1720
#else /* CONFIG_SMP */
1821

1922
static inline int xen_smp_intr_init(unsigned int cpu)

arch/x86/xen/smp_hvm.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#include <asm/smp.h>
2+
3+
#include "xen-ops.h"
4+
#include "smp.h"
5+
6+
7+
static void __init xen_hvm_smp_prepare_boot_cpu(void)
8+
{
9+
BUG_ON(smp_processor_id() != 0);
10+
native_smp_prepare_boot_cpu();
11+
12+
/*
13+
* Setup vcpu_info for boot CPU.
14+
*/
15+
xen_vcpu_setup(0);
16+
17+
/*
18+
* The alternative logic (which patches the unlock/lock) runs before
19+
* the smp bootup up code is activated. Hence we need to set this up
20+
* the core kernel is being patched. Otherwise we will have only
21+
* modules patched but not core code.
22+
*/
23+
xen_init_spinlocks();
24+
}
25+
26+
static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
27+
{
28+
native_smp_prepare_cpus(max_cpus);
29+
WARN_ON(xen_smp_intr_init(0));
30+
31+
xen_init_lock_cpu(0);
32+
}
33+
34+
#ifdef CONFIG_HOTPLUG_CPU
35+
static void xen_hvm_cpu_die(unsigned int cpu)
36+
{
37+
if (common_cpu_die(cpu) == 0) {
38+
xen_smp_intr_free(cpu);
39+
xen_uninit_lock_cpu(cpu);
40+
xen_teardown_timer(cpu);
41+
}
42+
}
43+
#else
44+
static void xen_hvm_cpu_die(unsigned int cpu)
45+
{
46+
BUG();
47+
}
48+
#endif
49+
50+
void __init xen_hvm_smp_init(void)
51+
{
52+
smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
53+
smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
54+
smp_ops.cpu_die = xen_hvm_cpu_die;
55+
smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi;
56+
smp_ops.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi;
57+
smp_ops.smp_prepare_boot_cpu = xen_hvm_smp_prepare_boot_cpu;
58+
}

0 commit comments

Comments
 (0)