~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/x86/xen/smp.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id);
47
47
 
48
48
/*
49
 
 * Reschedule call back. Nothing to do,
50
 
 * all the work is done automatically when
51
 
 * we return from the interrupt.
 
49
 * Reschedule call back.
52
50
 */
53
51
static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id)
54
52
{
55
53
        inc_irq_stat(irq_resched_count);
 
54
        scheduler_ipi();
56
55
 
57
56
        return IRQ_HANDLED;
58
57
}
59
58
 
60
 
static __cpuinit void cpu_bringup(void)
 
59
static void __cpuinit cpu_bringup(void)
61
60
{
62
61
        int cpu = smp_processor_id();
63
62
 
85
84
        wmb();                  /* make sure everything is out */
86
85
}
87
86
 
88
 
static __cpuinit void cpu_bringup_and_idle(void)
 
87
static void __cpuinit cpu_bringup_and_idle(void)
89
88
{
90
89
        cpu_bringup();
91
90
        cpu_idle();
206
205
static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
207
206
{
208
207
        unsigned cpu;
 
208
        unsigned int i;
209
209
 
210
210
        xen_init_lock_cpu(0);
211
211
 
212
212
        smp_store_cpu_info(0);
213
213
        cpu_data(0).x86_max_cores = 1;
 
214
 
 
215
        for_each_possible_cpu(i) {
 
216
                zalloc_cpumask_var(&per_cpu(cpu_sibling_map, i), GFP_KERNEL);
 
217
                zalloc_cpumask_var(&per_cpu(cpu_core_map, i), GFP_KERNEL);
 
218
                zalloc_cpumask_var(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL);
 
219
        }
214
220
        set_cpu_sibling_map(0);
215
221
 
216
222
        if (xen_smp_intr_init(0))
242
248
        }
243
249
}
244
250
 
245
 
static __cpuinit int
 
251
static int __cpuinit
246
252
cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
247
253
{
248
254
        struct vcpu_guest_context *ctxt;
486
492
        return IRQ_HANDLED;
487
493
}
488
494
 
489
 
static const struct smp_ops xen_smp_ops __initdata = {
 
495
static const struct smp_ops xen_smp_ops __initconst = {
490
496
        .smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
491
497
        .smp_prepare_cpus = xen_smp_prepare_cpus,
492
498
        .smp_cpus_done = xen_smp_cpus_done,
509
515
        xen_fill_possible_map();
510
516
        xen_init_spinlocks();
511
517
}
 
518
 
 
519
static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
 
520
{
 
521
        native_smp_prepare_cpus(max_cpus);
 
522
        WARN_ON(xen_smp_intr_init(0));
 
523
 
 
524
        if (!xen_have_vector_callback)
 
525
                return;
 
526
        xen_init_lock_cpu(0);
 
527
        xen_init_spinlocks();
 
528
}
 
529
 
 
530
static int __cpuinit xen_hvm_cpu_up(unsigned int cpu)
 
531
{
 
532
        int rc;
 
533
        rc = native_cpu_up(cpu);
 
534
        WARN_ON (xen_smp_intr_init(cpu));
 
535
        return rc;
 
536
}
 
537
 
 
538
static void xen_hvm_cpu_die(unsigned int cpu)
 
539
{
 
540
        unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL);
 
541
        unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
 
542
        unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
 
543
        unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL);
 
544
        native_cpu_die(cpu);
 
545
}
 
546
 
 
547
void __init xen_hvm_smp_init(void)
 
548
{
 
549
        smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
 
550
        smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
 
551
        smp_ops.cpu_up = xen_hvm_cpu_up;
 
552
        smp_ops.cpu_die = xen_hvm_cpu_die;
 
553
        smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi;
 
554
        smp_ops.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi;
 
555
}