@@ -54,7 +54,6 @@ extern void disable_fiq(int fiq);
extern int ack_fiq(int fiq);
extern void eoi_fiq(int fiq);
extern bool has_fiq(int fiq);
-extern int register_fiq_nmi_notifier(struct notifier_block *nb);
extern void fiq_register_mapping(int irq, struct fiq_chip *chip);
/* helpers defined in fiqasm.S: */
@@ -51,6 +51,7 @@ extern void kgdb_handle_bus_error(void);
extern int kgdb_fault_expected;
extern int kgdb_register_fiq(unsigned int fiq);
+extern void kgdb_handle_fiq(struct pt_regs *regs);
#endif /* !__ASSEMBLY__ */
@@ -43,12 +43,14 @@
#include <linux/irq.h>
#include <linux/radix-tree.h>
#include <linux/slab.h>
+#include <linux/irqchip/arm-gic.h>
#include <asm/cacheflush.h>
#include <asm/cp15.h>
#include <asm/exception.h>
#include <asm/fiq.h>
#include <asm/irq.h>
+#include <asm/kgdb.h>
#include <asm/traps.h>
#define FIQ_OFFSET ({ \
@@ -65,7 +67,6 @@ static unsigned long no_fiq_insn;
static int fiq_start = -1;
static RADIX_TREE(fiq_data_tree, GFP_KERNEL);
static DEFINE_MUTEX(fiq_data_mutex);
-static ATOMIC_NOTIFIER_HEAD(fiq_nmi_chain);
/* Default reacquire function
* - we always relinquish FIQ control
@@ -218,17 +219,19 @@ bool has_fiq(int fiq)
}
EXPORT_SYMBOL(has_fiq);
-int register_fiq_nmi_notifier(struct notifier_block *nb)
-{
- return atomic_notifier_chain_register(&fiq_nmi_chain, nb);
-}
-
asmlinkage void __exception_irq_entry fiq_nmi_handler(struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
nmi_enter();
- atomic_notifier_call_chain(&fiq_nmi_chain, (unsigned long)regs, NULL);
+
+ /* these callbacks deliberately avoid using a notifier chain in
+ * order to ensure code review happens (drivers cannot "secretly"
+ * employ FIQ without modifying this chain of calls).
+ */
+ kgdb_handle_fiq(regs);
+ gic_handle_fiq_ipi();
+
nmi_exit();
set_irq_regs(old_regs);
}
@@ -312,12 +312,13 @@ struct kgdb_arch arch_kgdb_ops = {
};
#ifdef CONFIG_KGDB_FIQ
-static int kgdb_handle_fiq(struct notifier_block *nb, unsigned long arg,
- void *data)
+void kgdb_handle_fiq(struct pt_regs *regs)
{
- struct pt_regs *regs = (void *) arg;
int actual;
+ if (!kgdb_fiq)
+ return;
+
if (!kgdb_nmicallback(raw_smp_processor_id(), regs))
return NOTIFY_OK;
@@ -333,11 +334,6 @@ static int kgdb_handle_fiq(struct notifier_block *nb, unsigned long arg,
return NOTIFY_OK;
}
-static struct notifier_block kgdb_fiq_notifier = {
- .notifier_call = kgdb_handle_fiq,
- .priority = 100,
-};
-
int kgdb_register_fiq(unsigned int fiq)
{
static struct fiq_handler kgdb_fiq_desc = { .name = "kgdb", };
@@ -357,7 +353,6 @@ int kgdb_register_fiq(unsigned int fiq)
}
kgdb_fiq = fiq;
- register_fiq_nmi_notifier(&kgdb_fiq_notifier);
return 0;
}
@@ -502,13 +502,17 @@ static void __init gic_init_fiq(struct gic_chip_data *gic,
/*
* Fully acknowledge (both ack and eoi) a FIQ-based IPI
*/
-static int gic_handle_fiq_ipi(struct notifier_block *nb, unsigned long regs,
- void *data)
+void gic_handle_fiq_ipi(void)
{
struct gic_chip_data *gic = &gic_data[0];
- void __iomem *cpu_base = gic_data_cpu_base(gic);
+ void __iomem *cpu_base;
unsigned long irqstat, irqnr;
+ if (!gic || !gic->fiq_enable)
+ return;
+
+ cpu_base = gic_data_cpu_base(gic);
+
if (WARN_ON(!in_nmi()))
return NOTIFY_BAD;
@@ -525,13 +529,6 @@ static int gic_handle_fiq_ipi(struct notifier_block *nb, unsigned long regs,
return NOTIFY_OK;
}
-
-/*
- * Notifier to ensure IPI FIQ is acknowledged correctly.
- */
-static struct notifier_block gic_fiq_ipi_notifier = {
- .notifier_call = gic_handle_fiq_ipi,
-};
#else /* CONFIG_FIQ */
static inline void gic_set_group_irq(void __iomem *base, unsigned int hwirq,
int group) {}
@@ -1250,10 +1247,6 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start,
#ifdef CONFIG_SMP
set_smp_cross_call(gic_raise_softirq);
register_cpu_notifier(&gic_cpu_notifier);
-#ifdef CONFIG_FIQ
- if (gic_data_fiq_enable(gic))
- register_fiq_nmi_notifier(&gic_fiq_ipi_notifier);
-#endif
#endif
set_handle_irq(gic_handle_irq);
}
@@ -101,5 +101,8 @@ static inline void __init register_routable_domain_ops
{
gic_routable_irq_domain_ops = ops;
}
+
+void gic_handle_fiq_ipi(void);
+
#endif /* __ASSEMBLY */
#endif