2009-02-12 13:54:53 +00:00
|
|
|
/*
|
|
|
|
|
* Author: Kumar Gala <galak@kernel.crashing.org>
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2009 Freescale Semiconductor Inc.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
|
* option) any later version.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <linux/stddef.h>
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
|
#include <linux/smp.h>
|
|
|
|
|
#include <linux/threads.h>
|
2011-05-10 19:29:39 +00:00
|
|
|
#include <linux/hardirq.h>
|
2009-02-12 13:54:53 +00:00
|
|
|
|
|
|
|
|
#include <asm/dbell.h>
|
2010-07-09 15:32:30 +10:00
|
|
|
#include <asm/irq_regs.h>
|
2009-02-12 13:54:53 +00:00
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
2010-07-09 15:29:53 +10:00
|
|
|
void doorbell_setup_this_cpu(void)
|
|
|
|
|
{
|
2012-11-14 18:49:44 +00:00
|
|
|
unsigned long tag = mfspr(SPRN_DOORBELL_CPUTAG) & PPC_DBELL_TAG_MASK;
|
2010-07-09 15:29:53 +10:00
|
|
|
|
2011-05-10 19:29:39 +00:00
|
|
|
smp_muxed_ipi_set_data(smp_processor_id(), tag);
|
2010-07-09 15:29:53 +10:00
|
|
|
}
|
|
|
|
|
|
2011-05-10 19:29:39 +00:00
|
|
|
void doorbell_cause_ipi(int cpu, unsigned long data)
|
2009-02-12 13:54:53 +00:00
|
|
|
{
|
2012-09-04 18:33:08 +00:00
|
|
|
/* Order previous accesses vs. msgsnd, which is treated as a store */
|
|
|
|
|
mb();
|
2012-11-14 18:49:44 +00:00
|
|
|
ppc_msgsnd(PPC_DBELL_MSGTYPE, 0, data);
|
2009-02-12 13:54:53 +00:00
|
|
|
}
|
2010-07-09 15:25:18 +10:00
|
|
|
|
|
|
|
|
void doorbell_exception(struct pt_regs *regs)
|
|
|
|
|
{
|
2010-07-09 15:32:30 +10:00
|
|
|
struct pt_regs *old_regs = set_irq_regs(regs);
|
2010-07-09 15:25:18 +10:00
|
|
|
|
2011-05-10 19:29:39 +00:00
|
|
|
irq_enter();
|
2010-07-09 15:29:53 +10:00
|
|
|
|
2012-03-06 18:27:59 +11:00
|
|
|
may_hard_irq_enable();
|
|
|
|
|
|
2013-03-21 19:22:52 +00:00
|
|
|
__get_cpu_var(irq_stat).doorbell_irqs++;
|
|
|
|
|
|
2011-05-10 19:29:39 +00:00
|
|
|
smp_ipi_demux();
|
2010-07-09 15:25:18 +10:00
|
|
|
|
2011-05-10 19:29:39 +00:00
|
|
|
irq_exit();
|
2010-07-09 15:32:30 +10:00
|
|
|
set_irq_regs(old_regs);
|
2010-07-09 15:25:18 +10:00
|
|
|
}
|
|
|
|
|
#else /* CONFIG_SMP */
|
|
|
|
|
void doorbell_exception(struct pt_regs *regs)
|
|
|
|
|
{
|
|
|
|
|
printk(KERN_WARNING "Received doorbell on non-smp system\n");
|
|
|
|
|
}
|
|
|
|
|
#endif /* CONFIG_SMP */
|
|
|
|
|
|