Skip to content

Commit

Permalink
xen: move smp setup into smp.c
Browse files Browse the repository at this point in the history
Move all the smp_ops setup into smp.c, allowing a lot of things to
become static.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Jeremy Fitzhardinge authored and Ingo Molnar committed Jul 16, 2008
1 parent ce87b3d commit a9e7062
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 34 deletions.
19 changes: 1 addition & 18 deletions arch/x86/xen/enlighten.c
Original file line number Diff line number Diff line change
Expand Up @@ -1237,21 +1237,6 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
.set_fixmap = xen_set_fixmap,
};

#ifdef CONFIG_SMP
static const struct smp_ops xen_smp_ops __initdata = {
.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
.smp_prepare_cpus = xen_smp_prepare_cpus,
.cpu_up = xen_cpu_up,
.smp_cpus_done = xen_smp_cpus_done,

.smp_send_stop = xen_smp_send_stop,
.smp_send_reschedule = xen_smp_send_reschedule,

.send_call_func_ipi = xen_smp_send_call_function_ipi,
.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi,
};
#endif /* CONFIG_SMP */

static void xen_reboot(int reason)
{
struct sched_shutdown r = { .reason = reason };
Expand Down Expand Up @@ -1340,9 +1325,7 @@ asmlinkage void __init xen_start_kernel(void)
have_vcpu_info_placement = 0;
#endif

#ifdef CONFIG_SMP
smp_ops = xen_smp_ops;
#endif
xen_smp_init();

/* Get mfn list */
if (!xen_feature(XENFEAT_auto_translated_physmap))
Expand Down
34 changes: 26 additions & 8 deletions arch/x86/xen/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void __init xen_fill_possible_map(void)
}
}

void __init xen_smp_prepare_boot_cpu(void)
static void __init xen_smp_prepare_boot_cpu(void)
{
int cpu;

Expand All @@ -176,7 +176,7 @@ void __init xen_smp_prepare_boot_cpu(void)
xen_setup_vcpu_info_placement();
}

void __init xen_smp_prepare_cpus(unsigned int max_cpus)
static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
{
unsigned cpu;

Expand Down Expand Up @@ -276,7 +276,7 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
return 0;
}

int __cpuinit xen_cpu_up(unsigned int cpu)
static int __cpuinit xen_cpu_up(unsigned int cpu)
{
struct task_struct *idle = idle_task(cpu);
int rc;
Expand Down Expand Up @@ -319,7 +319,7 @@ int __cpuinit xen_cpu_up(unsigned int cpu)
return 0;
}

void xen_smp_cpus_done(unsigned int max_cpus)
static void xen_smp_cpus_done(unsigned int max_cpus)
{
}

Expand All @@ -335,12 +335,12 @@ static void stop_self(void *v)
BUG();
}

void xen_smp_send_stop(void)
static void xen_smp_send_stop(void)
{
smp_call_function(stop_self, NULL, 0);
}

void xen_smp_send_reschedule(int cpu)
static void xen_smp_send_reschedule(int cpu)
{
xen_send_IPI_one(cpu, XEN_RESCHEDULE_VECTOR);
}
Expand All @@ -355,7 +355,7 @@ static void xen_send_IPI_mask(cpumask_t mask, enum ipi_vector vector)
xen_send_IPI_one(cpu, vector);
}

void xen_smp_send_call_function_ipi(cpumask_t mask)
static void xen_smp_send_call_function_ipi(cpumask_t mask)
{
int cpu;

Expand All @@ -370,7 +370,7 @@ void xen_smp_send_call_function_ipi(cpumask_t mask)
}
}

void xen_smp_send_call_function_single_ipi(int cpu)
static void xen_smp_send_call_function_single_ipi(int cpu)
{
xen_send_IPI_mask(cpumask_of_cpu(cpu), XEN_CALL_FUNCTION_SINGLE_VECTOR);
}
Expand All @@ -394,3 +394,21 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)

return IRQ_HANDLED;
}

static const struct smp_ops xen_smp_ops __initdata = {
.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
.smp_prepare_cpus = xen_smp_prepare_cpus,
.cpu_up = xen_cpu_up,
.smp_cpus_done = xen_smp_cpus_done,

.smp_send_stop = xen_smp_send_stop,
.smp_send_reschedule = xen_smp_send_reschedule,

.send_call_func_ipi = xen_smp_send_call_function_ipi,
.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi,
};

void __init xen_smp_init(void)
{
smp_ops = xen_smp_ops;
}
13 changes: 5 additions & 8 deletions arch/x86/xen/xen-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,14 @@ void xen_mark_init_mm_pinned(void);
void __init xen_fill_possible_map(void);

void __init xen_setup_vcpu_info_placement(void);
void xen_smp_prepare_boot_cpu(void);
void xen_smp_prepare_cpus(unsigned int max_cpus);
int xen_cpu_up(unsigned int cpu);
void xen_smp_cpus_done(unsigned int max_cpus);

void xen_smp_send_stop(void);
void xen_smp_send_reschedule(int cpu);
void xen_smp_send_call_function_ipi(cpumask_t mask);
void xen_smp_send_call_function_single_ipi(int cpu);
#ifdef CONFIG_SMP
void xen_smp_init(void);

extern cpumask_t xen_cpu_initialized_map;
#else
static inline void xen_smp_init(void) {}
#endif


/* Declare an asm function, along with symbols needed to make it
Expand Down

0 comments on commit a9e7062

Please sign in to comment.