aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/dbell.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/dbell.c')
-rw-r--r--arch/powerpc/kernel/dbell.c46
1 files changed, 8 insertions, 38 deletions
diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c
index e49b24c84133..2cc451aaaca7 100644
--- a/arch/powerpc/kernel/dbell.c
+++ b/arch/powerpc/kernel/dbell.c
@@ -13,65 +13,35 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/smp.h> 14#include <linux/smp.h>
15#include <linux/threads.h> 15#include <linux/threads.h>
16#include <linux/percpu.h> 16#include <linux/hardirq.h>
17 17
18#include <asm/dbell.h> 18#include <asm/dbell.h>
19#include <asm/irq_regs.h> 19#include <asm/irq_regs.h>
20 20
21#ifdef CONFIG_SMP 21#ifdef CONFIG_SMP
22struct doorbell_cpu_info {
23 unsigned long messages; /* current messages bits */
24 unsigned int tag; /* tag value */
25};
26
27static DEFINE_PER_CPU(struct doorbell_cpu_info, doorbell_cpu_info);
28
29void doorbell_setup_this_cpu(void) 22void doorbell_setup_this_cpu(void)
30{ 23{
31 struct doorbell_cpu_info *info = &__get_cpu_var(doorbell_cpu_info); 24 unsigned long tag = mfspr(SPRN_PIR) & 0x3fff;
32 25
33 info->messages = 0; 26 smp_muxed_ipi_set_data(smp_processor_id(), tag);
34 info->tag = mfspr(SPRN_PIR) & 0x3fff;
35} 27}
36 28
37void doorbell_message_pass(int cpu, int msg) 29void doorbell_cause_ipi(int cpu, unsigned long data)
38{ 30{
39 struct doorbell_cpu_info *info; 31 ppc_msgsnd(PPC_DBELL, 0, data);
40
41 info = &per_cpu(doorbell_cpu_info, cpu);
42 set_bit(msg, &info->messages);
43 ppc_msgsnd(PPC_DBELL, 0, info->tag);
44} 32}
45 33
46void doorbell_exception(struct pt_regs *regs) 34void doorbell_exception(struct pt_regs *regs)
47{ 35{
48 struct pt_regs *old_regs = set_irq_regs(regs); 36 struct pt_regs *old_regs = set_irq_regs(regs);
49 struct doorbell_cpu_info *info = &__get_cpu_var(doorbell_cpu_info);
50 int msg;
51 37
52 /* Warning: regs can be NULL when called from irq enable */ 38 irq_enter();
53 39
54 if (!info->messages || (num_online_cpus() < 2)) 40 smp_ipi_demux();
55 goto out;
56 41
57 for (msg = 0; msg < 4; msg++) 42 irq_exit();
58 if (test_and_clear_bit(msg, &info->messages))
59 smp_message_recv(msg);
60
61out:
62 set_irq_regs(old_regs); 43 set_irq_regs(old_regs);
63} 44}
64
65void doorbell_check_self(void)
66{
67 struct doorbell_cpu_info *info = &__get_cpu_var(doorbell_cpu_info);
68
69 if (!info->messages)
70 return;
71
72 ppc_msgsnd(PPC_DBELL, 0, info->tag);
73}
74
75#else /* CONFIG_SMP */ 45#else /* CONFIG_SMP */
76void doorbell_exception(struct pt_regs *regs) 46void doorbell_exception(struct pt_regs *regs)
77{ 47{