Merge tag 'for-4.1-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux...
[deliverable/linux.git] / arch / powerpc / kernel / dbell.c
CommitLineData
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>
755563bc 20#include <asm/kvm_ppc.h>
620165f9
KG
21
22#ifdef CONFIG_SMP
b9f1cd71
BH
23void doorbell_setup_this_cpu(void)
24{
42d02b81 25 unsigned long tag = mfspr(SPRN_DOORBELL_CPUTAG) & PPC_DBELL_TAG_MASK;
b9f1cd71 26
23d72bfd 27 smp_muxed_ipi_set_data(smp_processor_id(), tag);
b9f1cd71
BH
28}
29
23d72bfd 30void doorbell_cause_ipi(int cpu, unsigned long data)
620165f9 31{
9fb1b36c
PM
32 /* Order previous accesses vs. msgsnd, which is treated as a store */
33 mb();
42d02b81 34 ppc_msgsnd(PPC_DBELL_MSGTYPE, 0, data);
620165f9 35}
e3145b38
BH
36
37void doorbell_exception(struct pt_regs *regs)
38{
0e37d259 39 struct pt_regs *old_regs = set_irq_regs(regs);
e3145b38 40
23d72bfd 41 irq_enter();
b9f1cd71 42
7230c564
BH
43 may_hard_irq_enable();
44
755563bc 45 kvmppc_set_host_ipi(smp_processor_id(), 0);
69111bac 46 __this_cpu_inc(irq_stat.doorbell_irqs);
a6a058e5 47
23d72bfd 48 smp_ipi_demux();
e3145b38 49
23d72bfd 50 irq_exit();
0e37d259 51 set_irq_regs(old_regs);
e3145b38 52}
e3145b38
BH
53#else /* CONFIG_SMP */
54void doorbell_exception(struct pt_regs *regs)
55{
56 printk(KERN_WARNING "Received doorbell on non-smp system\n");
57}
58#endif /* CONFIG_SMP */
59
This page took 0.350958 seconds and 5 git commands to generate.