From: Kevin Cernekee <cernekee@gmail.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Subject: [PATCH V2 6/8] MIPS: Add NMI notifier
Date: Thu, 10 Nov 2011 22:30:29 -0800 [thread overview]
Message-ID: <598dabc28eb6fdbd820ea80c0a57e87d@localhost> (raw)
In-Reply-To: <5f9666eb295ce196b2a9688afab07dea@localhost>
Allow the board support code to register a raw notifier callback for
NMI, similar to what is done for CU2 exceptions.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
---
V2:
Use a raw notifier instead of a function pointer for NMI events.
arch/mips/include/asm/traps.h | 12 ++++++++++++
arch/mips/kernel/traps.c | 9 +++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/arch/mips/include/asm/traps.h b/arch/mips/include/asm/traps.h
index 90ff2f4..4edab87 100644
--- a/arch/mips/include/asm/traps.h
+++ b/arch/mips/include/asm/traps.h
@@ -25,4 +25,16 @@ extern void (*board_nmi_handler_setup)(void);
extern void (*board_ejtag_handler_setup)(void);
extern void (*board_bind_eic_interrupt)(int irq, int regset);
+extern int register_nmi_notifier(struct notifier_block *nb);
+
+#define nmi_notifier(fn, pri) \
+({ \
+ static struct notifier_block fn##_nb = { \
+ .notifier_call = fn, \
+ .priority = pri \
+ }; \
+ \
+ register_nmi_notifier(&fn##_nb); \
+})
+
#endif /* _ASM_TRAPS_H */
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 5c8a49d..33945aa 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1339,9 +1339,18 @@ void ejtag_exception_handler(struct pt_regs *regs)
/*
* NMI exception handler.
+ * No lock; only written during early bootup by CPU 0.
*/
+static RAW_NOTIFIER_HEAD(nmi_chain);
+
+int register_nmi_notifier(struct notifier_block *nb)
+{
+ return raw_notifier_chain_register(&nmi_chain, nb);
+}
+
NORET_TYPE void ATTRIB_NORET nmi_exception_handler(struct pt_regs *regs)
{
+ raw_notifier_call_chain(&nmi_chain, 0, regs);
bust_spinlocks(1);
printk("NMI taken!!!!\n");
die("NMI", regs);
--
1.7.6.3
next prev parent reply other threads:[~2011-11-11 6:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-11 6:30 [PATCH V2 1/8] MIPS: BMIPS: Fix up Kconfig settings Kevin Cernekee
2011-11-11 6:30 ` [PATCH V2 2/8] MIPS: Clean up whitespace warning in hazards.h Kevin Cernekee
2011-11-11 18:03 ` Ralf Baechle
2011-11-11 6:30 ` [PATCH V2 3/8] MIPS: BMIPS: Add CFLAGS, Makefile entries for BMIPS Kevin Cernekee
2011-11-11 12:58 ` Ralf Baechle
2011-11-11 16:57 ` Kevin Cernekee
2011-11-11 17:20 ` Ralf Baechle
2011-11-12 14:11 ` Florian Fainelli
2011-11-11 18:03 ` Ralf Baechle
2011-11-11 6:30 ` [PATCH V2 4/8] MIPS: BMIPS: Add set/clear CP0 macros for BMIPS operations Kevin Cernekee
2011-11-11 18:04 ` Ralf Baechle
2011-11-11 6:30 ` [PATCH V2 5/8] MIPS: BMIPS: Introduce bmips.h Kevin Cernekee
2011-11-11 13:32 ` Ralf Baechle
2011-11-11 18:04 ` Ralf Baechle
2011-11-11 6:30 ` Kevin Cernekee [this message]
2011-11-11 13:34 ` [PATCH V2 6/8] MIPS: Add NMI notifier Ralf Baechle
2011-11-11 18:04 ` Ralf Baechle
2011-11-11 6:30 ` [PATCH V2 7/8] MIPS: Add board_ebase_setup() Kevin Cernekee
2011-11-11 18:05 ` Ralf Baechle
2011-11-11 6:30 ` [PATCH V2 8/8] MIPS: BMIPS: Add SMP support code for BMIPS43xx/BMIPS5000 Kevin Cernekee
2011-11-11 18:05 ` Ralf Baechle
2011-11-12 14:31 ` Florian Fainelli
2011-11-12 16:07 ` Kevin Cernekee
2011-11-11 18:03 ` [PATCH V2 1/8] MIPS: BMIPS: Fix up Kconfig settings Ralf Baechle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=598dabc28eb6fdbd820ea80c0a57e87d@localhost \
--to=cernekee@gmail.com \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.