1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef LINUX_HARDIRQ_H
3 #define LINUX_HARDIRQ_H
5 #include <linux/preempt.h>
6 #include <linux/lockdep.h>
7 #include <linux/ftrace_irq.h>
8 #include <linux/vtime.h>
9 #include <asm/hardirq.h>
12 extern void synchronize_irq(unsigned int irq);
13 extern bool synchronize_hardirq(unsigned int irq);
15 #if defined(CONFIG_TINY_RCU)
17 static inline void rcu_nmi_enter(void)
21 static inline void rcu_nmi_exit(void)
26 extern void rcu_nmi_enter(void);
27 extern void rcu_nmi_exit(void);
31 * It is safe to do non-atomic ops on ->hardirq_context,
32 * because NMI handlers may not preempt and the ops are
33 * always balanced, so the interrupted value of ->hardirq_context
34 * will always be restored.
36 #define __irq_enter() \
38 account_irq_enter_time(current); \
39 preempt_count_add(HARDIRQ_OFFSET); \
40 trace_hardirq_enter(); \
44 * Enter irq context (on NO_HZ, update jiffies):
46 extern void irq_enter(void);
49 * Exit irq context without processing softirqs:
51 #define __irq_exit() \
53 trace_hardirq_exit(); \
54 account_irq_exit_time(current); \
55 preempt_count_sub(HARDIRQ_OFFSET); \
59 * Exit irq context and process softirqs if needed:
61 extern void irq_exit(void);
69 preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
71 trace_hardirq_enter(); \
76 trace_hardirq_exit(); \
79 preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
85 #endif /* LINUX_HARDIRQ_H */