Merge tag 'dm-3.15-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device...
[cascardo/linux.git] / arch / mips / kernel / smp-gic.c
1 /*
2  * Copyright (C) 2013 Imagination Technologies
3  * Author: Paul Burton <paul.burton@imgtec.com>
4  *
5  * Based on smp-cmp.c:
6  *  Copyright (C) 2007 MIPS Technologies, Inc.
7  *  Author: Chris Dearman (chris@mips.com)
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License as published by the
11  * Free Software Foundation;  either version 2 of the  License, or (at your
12  * option) any later version.
13  */
14
15 #include <linux/printk.h>
16
17 #include <asm/gic.h>
18 #include <asm/smp-ops.h>
19
20 void gic_send_ipi_single(int cpu, unsigned int action)
21 {
22         unsigned long flags;
23         unsigned int intr;
24
25         pr_debug("CPU%d: %s cpu %d action %u status %08x\n",
26                  smp_processor_id(), __func__, cpu, action, read_c0_status());
27
28         local_irq_save(flags);
29
30         switch (action) {
31         case SMP_CALL_FUNCTION:
32                 intr = plat_ipi_call_int_xlate(cpu);
33                 break;
34
35         case SMP_RESCHEDULE_YOURSELF:
36                 intr = plat_ipi_resched_int_xlate(cpu);
37                 break;
38
39         default:
40                 BUG();
41         }
42
43         gic_send_ipi(intr);
44         local_irq_restore(flags);
45 }
46
47 void gic_send_ipi_mask(const struct cpumask *mask, unsigned int action)
48 {
49         unsigned int i;
50
51         for_each_cpu(i, mask)
52                 gic_send_ipi_single(i, action);
53 }