Commit | Line | Data |
---|---|---|
620165f9 KG |
1 | /* |
2 | * Author: Kumar Gala <galak@kernel.crashing.org> | |
3 | * | |
4 | * Copyright 2009 Freescale Semiconductor Inc. | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation; either version 2 of the License, or (at your | |
9 | * option) any later version. | |
10 | */ | |
11 | ||
12 | #include <linux/stddef.h> | |
13 | #include <linux/kernel.h> | |
14 | #include <linux/smp.h> | |
15 | #include <linux/threads.h> | |
23d72bfd | 16 | #include <linux/hardirq.h> |
620165f9 KG |
17 | |
18 | #include <asm/dbell.h> | |
0e37d259 | 19 | #include <asm/irq_regs.h> |
620165f9 KG |
20 | |
21 | #ifdef CONFIG_SMP | |
b9f1cd71 BH |
22 | void doorbell_setup_this_cpu(void) |
23 | { | |
42d02b81 | 24 | unsigned long tag = mfspr(SPRN_DOORBELL_CPUTAG) & PPC_DBELL_TAG_MASK; |
b9f1cd71 | 25 | |
23d72bfd | 26 | smp_muxed_ipi_set_data(smp_processor_id(), tag); |
b9f1cd71 BH |
27 | } |
28 | ||
23d72bfd | 29 | void doorbell_cause_ipi(int cpu, unsigned long data) |
620165f9 | 30 | { |
9fb1b36c PM |
31 | /* Order previous accesses vs. msgsnd, which is treated as a store */ |
32 | mb(); | |
42d02b81 | 33 | ppc_msgsnd(PPC_DBELL_MSGTYPE, 0, data); |
620165f9 | 34 | } |
e3145b38 BH |
35 | |
36 | void doorbell_exception(struct pt_regs *regs) | |
37 | { | |
0e37d259 | 38 | struct pt_regs *old_regs = set_irq_regs(regs); |
e3145b38 | 39 | |
23d72bfd | 40 | irq_enter(); |
b9f1cd71 | 41 | |
7230c564 BH |
42 | may_hard_irq_enable(); |
43 | ||
a6a058e5 IM |
44 | __get_cpu_var(irq_stat).doorbell_irqs++; |
45 | ||
23d72bfd | 46 | smp_ipi_demux(); |
e3145b38 | 47 | |
23d72bfd | 48 | irq_exit(); |
0e37d259 | 49 | set_irq_regs(old_regs); |
e3145b38 | 50 | } |
e3145b38 BH |
51 | #else /* CONFIG_SMP */ |
52 | void doorbell_exception(struct pt_regs *regs) | |
53 | { | |
54 | printk(KERN_WARNING "Received doorbell on non-smp system\n"); | |
55 | } | |
56 | #endif /* CONFIG_SMP */ | |
57 |