1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LINUX_IRQENTRYCOMMON_H
3 #define __LINUX_IRQENTRYCOMMON_H
4
5 #include <linux/context_tracking.h>
6 #include <linux/hrtimer_rearm.h>
7 #include <linux/kmsan.h>
8 #include <linux/rseq_entry.h>
9 #include <linux/static_call_types.h>
10 #include <linux/syscalls.h>
11 #include <linux/tick.h>
12 #include <linux/unwind_deferred.h>
13
14 #include <asm/entry-common.h>
15
16 /*
17 * Define dummy _TIF work flags if not defined by the architecture or for
18 * disabled functionality.
19 */
20 #ifndef _TIF_PATCH_PENDING
21 # define _TIF_PATCH_PENDING (0)
22 #endif
23
24 /*
25 * TIF flags handled in exit_to_user_mode_loop()
26 */
27 #ifndef ARCH_EXIT_TO_USER_MODE_WORK
28 # define ARCH_EXIT_TO_USER_MODE_WORK (0)
29 #endif
30
31 #define EXIT_TO_USER_MODE_WORK \
32 (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE | \
33 _TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY | \
34 _TIF_PATCH_PENDING | _TIF_NOTIFY_SIGNAL | _TIF_RSEQ | \
35 ARCH_EXIT_TO_USER_MODE_WORK)
36
37 #ifdef CONFIG_HRTIMER_REARM_DEFERRED
38 # define EXIT_TO_USER_MODE_WORK_SYSCALL (EXIT_TO_USER_MODE_WORK)
39 # define EXIT_TO_USER_MODE_WORK_IRQ (EXIT_TO_USER_MODE_WORK | _TIF_HRTIMER_REARM)
40 #else
41 # define EXIT_TO_USER_MODE_WORK_SYSCALL (EXIT_TO_USER_MODE_WORK)
42 # define EXIT_TO_USER_MODE_WORK_IRQ (EXIT_TO_USER_MODE_WORK)
43 #endif
44
45 /**
46 * arch_enter_from_user_mode - Architecture specific sanity check for user mode regs
47 * @regs: Pointer to currents pt_regs
48 *
49 * Defaults to an empty implementation. Can be replaced by architecture
50 * specific code.
51 *
52 * Invoked from syscall_enter_from_user_mode() in the non-instrumentable
53 * section. Use __always_inline so the compiler cannot push it out of line
54 * and make it instrumentable.
55 */
56 static __always_inline void arch_enter_from_user_mode(struct pt_regs *regs);
57
58 #ifndef arch_enter_from_user_mode
arch_enter_from_user_mode(struct pt_regs * regs)59 static __always_inline void arch_enter_from_user_mode(struct pt_regs *regs) {}
60 #endif
61
62 /**
63 * arch_in_rcu_eqs - Architecture specific check for RCU extended quiescent
64 * states.
65 *
66 * Returns: true if the CPU is potentially in an RCU EQS, false otherwise.
67 *
68 * Architectures only need to define this if threads other than the idle thread
69 * may have an interruptible EQS. This does not need to handle idle threads. It
70 * is safe to over-estimate at the cost of redundant RCU management work.
71 *
72 * Invoked from irqentry_enter()
73 */
74 #ifndef arch_in_rcu_eqs
arch_in_rcu_eqs(void)75 static __always_inline bool arch_in_rcu_eqs(void) { return false; }
76 #endif
77
78 /**
79 * enter_from_user_mode - Establish state when coming from user mode
80 * @regs: Pointer to currents pt_regs
81 *
82 * Syscall/interrupt entry disables interrupts, but user mode is traced as
83 * interrupts enabled. Also with NO_HZ_FULL RCU might be idle.
84 *
85 * 1) Tell lockdep that interrupts are disabled
86 * 2) Invoke context tracking if enabled to reactivate RCU
87 * 3) Trace interrupts off state
88 *
89 * Invoked from architecture specific syscall entry code with interrupts
90 * disabled. The calling code has to be non-instrumentable. When the
91 * function returns all state is correct and interrupts are still
92 * disabled. The subsequent functions can be instrumented.
93 *
94 * This is invoked when there is architecture specific functionality to be
95 * done between establishing state and enabling interrupts. The caller must
96 * enable interrupts before invoking syscall_enter_from_user_mode_work().
97 */
enter_from_user_mode(struct pt_regs * regs)98 static __always_inline void enter_from_user_mode(struct pt_regs *regs)
99 {
100 arch_enter_from_user_mode(regs);
101 lockdep_hardirqs_off(CALLER_ADDR0);
102
103 CT_WARN_ON(__ct_state() != CT_STATE_USER);
104 user_exit_irqoff();
105
106 instrumentation_begin();
107 kmsan_unpoison_entry_regs(regs);
108 trace_hardirqs_off_finish();
109 instrumentation_end();
110 }
111
112 /**
113 * arch_exit_to_user_mode_work - Architecture specific TIF work for exit
114 * to user mode.
115 * @regs: Pointer to currents pt_regs
116 * @ti_work: Cached TIF flags gathered with interrupts disabled
117 *
118 * Invoked from exit_to_user_mode_loop() with interrupt enabled
119 *
120 * Defaults to NOOP. Can be supplied by architecture specific code.
121 */
122 static inline void arch_exit_to_user_mode_work(struct pt_regs *regs,
123 unsigned long ti_work);
124
125 #ifndef arch_exit_to_user_mode_work
arch_exit_to_user_mode_work(struct pt_regs * regs,unsigned long ti_work)126 static inline void arch_exit_to_user_mode_work(struct pt_regs *regs,
127 unsigned long ti_work)
128 {
129 }
130 #endif
131
132 /**
133 * arch_exit_to_user_mode_prepare - Architecture specific preparation for
134 * exit to user mode.
135 * @regs: Pointer to currents pt_regs
136 * @ti_work: Cached TIF flags gathered with interrupts disabled
137 *
138 * Invoked from exit_to_user_mode_prepare() with interrupt disabled as the last
139 * function before return. Defaults to NOOP.
140 */
141 static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
142 unsigned long ti_work);
143
144 #ifndef arch_exit_to_user_mode_prepare
arch_exit_to_user_mode_prepare(struct pt_regs * regs,unsigned long ti_work)145 static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
146 unsigned long ti_work)
147 {
148 }
149 #endif
150
151 /**
152 * arch_exit_to_user_mode - Architecture specific final work before
153 * exit to user mode.
154 *
155 * Invoked from exit_to_user_mode() with interrupt disabled as the last
156 * function before return. Defaults to NOOP.
157 *
158 * This needs to be __always_inline because it is non-instrumentable code
159 * invoked after context tracking switched to user mode.
160 *
161 * An architecture implementation must not do anything complex, no locking
162 * etc. The main purpose is for speculation mitigations.
163 */
164 static __always_inline void arch_exit_to_user_mode(void);
165
166 #ifndef arch_exit_to_user_mode
arch_exit_to_user_mode(void)167 static __always_inline void arch_exit_to_user_mode(void) { }
168 #endif
169
170 /**
171 * arch_do_signal_or_restart - Architecture specific signal delivery function
172 * @regs: Pointer to currents pt_regs
173 *
174 * Invoked from exit_to_user_mode_loop().
175 */
176 void arch_do_signal_or_restart(struct pt_regs *regs);
177
178 /* Handle pending TIF work */
179 unsigned long exit_to_user_mode_loop(struct pt_regs *regs, unsigned long ti_work);
180
181 /**
182 * __exit_to_user_mode_prepare - call exit_to_user_mode_loop() if required
183 * @regs: Pointer to pt_regs on entry stack
184 * @work_mask: Which TIF bits need to be evaluated
185 *
186 * 1) check that interrupts are disabled
187 * 2) call tick_nohz_user_enter_prepare()
188 * 3) call exit_to_user_mode_loop() if any flags from
189 * EXIT_TO_USER_MODE_WORK are set
190 * 4) check that interrupts are still disabled
191 *
192 * Don't invoke directly, use the syscall/irqentry_ prefixed variants below
193 */
__exit_to_user_mode_prepare(struct pt_regs * regs,const unsigned long work_mask)194 static __always_inline void __exit_to_user_mode_prepare(struct pt_regs *regs,
195 const unsigned long work_mask)
196 {
197 unsigned long ti_work;
198
199 lockdep_assert_irqs_disabled();
200
201 /* Flush pending rcuog wakeup before the last need_resched() check */
202 tick_nohz_user_enter_prepare();
203
204 ti_work = read_thread_flags();
205 if (unlikely(ti_work & work_mask)) {
206 if (!hrtimer_rearm_deferred_user_irq(&ti_work, work_mask))
207 ti_work = exit_to_user_mode_loop(regs, ti_work);
208 }
209
210 arch_exit_to_user_mode_prepare(regs, ti_work);
211 }
212
__exit_to_user_mode_validate(void)213 static __always_inline void __exit_to_user_mode_validate(void)
214 {
215 /* Ensure that kernel state is sane for a return to userspace */
216 kmap_assert_nomap();
217 lockdep_assert_irqs_disabled();
218 lockdep_sys_exit();
219 }
220
221 /**
222 * syscall_exit_to_user_mode_prepare - call exit_to_user_mode_loop() if required
223 * @regs: Pointer to pt_regs on entry stack
224 *
225 * Wrapper around __exit_to_user_mode_prepare() to separate the exit work for
226 * syscalls and interrupts.
227 */
syscall_exit_to_user_mode_prepare(struct pt_regs * regs)228 static __always_inline void syscall_exit_to_user_mode_prepare(struct pt_regs *regs)
229 {
230 __exit_to_user_mode_prepare(regs, EXIT_TO_USER_MODE_WORK_SYSCALL);
231 rseq_syscall_exit_to_user_mode();
232 __exit_to_user_mode_validate();
233 }
234
235 /**
236 * irqentry_exit_to_user_mode_prepare - call exit_to_user_mode_loop() if required
237 * @regs: Pointer to pt_regs on entry stack
238 *
239 * Wrapper around __exit_to_user_mode_prepare() to separate the exit work for
240 * syscalls and interrupts.
241 */
irqentry_exit_to_user_mode_prepare(struct pt_regs * regs)242 static __always_inline void irqentry_exit_to_user_mode_prepare(struct pt_regs *regs)
243 {
244 __exit_to_user_mode_prepare(regs, EXIT_TO_USER_MODE_WORK_IRQ);
245 rseq_irqentry_exit_to_user_mode();
246 __exit_to_user_mode_validate();
247 }
248
249 /**
250 * exit_to_user_mode - Fixup state when exiting to user mode
251 *
252 * Syscall/interrupt exit enables interrupts, but the kernel state is
253 * interrupts disabled when this is invoked. Also tell RCU about it.
254 *
255 * 1) Trace interrupts on state
256 * 2) Invoke context tracking if enabled to adjust RCU state
257 * 3) Invoke architecture specific last minute exit code, e.g. speculation
258 * mitigations, etc.: arch_exit_to_user_mode()
259 * 4) Tell lockdep that interrupts are enabled
260 *
261 * Invoked from architecture specific code when syscall_exit_to_user_mode()
262 * is not suitable as the last step before returning to userspace. Must be
263 * invoked with interrupts disabled and the caller must be
264 * non-instrumentable.
265 * The caller has to invoke syscall_exit_to_user_mode_work() before this.
266 */
exit_to_user_mode(void)267 static __always_inline void exit_to_user_mode(void)
268 {
269 instrumentation_begin();
270 unwind_reset_info();
271 trace_hardirqs_on_prepare();
272 lockdep_hardirqs_on_prepare();
273 instrumentation_end();
274
275 user_enter_irqoff();
276 arch_exit_to_user_mode();
277 lockdep_hardirqs_on(CALLER_ADDR0);
278 }
279
280 /**
281 * irqentry_enter_from_user_mode - Establish state before invoking the irq handler
282 * @regs: Pointer to currents pt_regs
283 *
284 * Invoked from architecture specific entry code with interrupts disabled.
285 * Can only be called when the interrupt entry came from user mode. The
286 * calling code must be non-instrumentable. When the function returns all
287 * state is correct and the subsequent functions can be instrumented.
288 *
289 * The function establishes state (lockdep, RCU (context tracking), tracing)
290 */
irqentry_enter_from_user_mode(struct pt_regs * regs)291 static __always_inline void irqentry_enter_from_user_mode(struct pt_regs *regs)
292 {
293 enter_from_user_mode(regs);
294 rseq_note_user_irq_entry();
295 }
296
297 /**
298 * irqentry_exit_to_user_mode - Interrupt exit work
299 * @regs: Pointer to current's pt_regs
300 *
301 * Invoked with interrupts disabled and fully valid regs. Returns with all
302 * work handled, interrupts disabled such that the caller can immediately
303 * switch to user mode. Called from architecture specific interrupt
304 * handling code.
305 *
306 * The call order is #2 and #3 as described in syscall_exit_to_user_mode().
307 * Interrupt exit is not invoking #1 which is the syscall specific one time
308 * work.
309 */
irqentry_exit_to_user_mode(struct pt_regs * regs)310 static __always_inline void irqentry_exit_to_user_mode(struct pt_regs *regs)
311 {
312 lockdep_assert_irqs_disabled();
313
314 instrumentation_begin();
315 irqentry_exit_to_user_mode_prepare(regs);
316 instrumentation_end();
317 exit_to_user_mode();
318 }
319
320 #ifndef irqentry_state
321 /**
322 * struct irqentry_state - Opaque object for exception state storage
323 * @exit_rcu: Used exclusively in the irqentry_*() calls; signals whether the
324 * exit path has to invoke ct_irq_exit().
325 * @lockdep: Used exclusively in the irqentry_nmi_*() calls; ensures that
326 * lockdep state is restored correctly on exit from nmi.
327 *
328 * This opaque object is filled in by the irqentry_*_enter() functions and
329 * must be passed back into the corresponding irqentry_*_exit() functions
330 * when the exception is complete.
331 *
332 * Callers of irqentry_*_[enter|exit]() must consider this structure opaque
333 * and all members private. Descriptions of the members are provided to aid in
334 * the maintenance of the irqentry_*() functions.
335 */
336 typedef struct irqentry_state {
337 union {
338 bool exit_rcu;
339 bool lockdep;
340 };
341 } irqentry_state_t;
342 #endif
343
344 /**
345 * irqentry_exit_cond_resched - Conditionally reschedule on return from interrupt
346 *
347 * Conditional reschedule with additional sanity checks.
348 */
349 void raw_irqentry_exit_cond_resched(void);
350
351 #ifdef CONFIG_PREEMPT_DYNAMIC
352 #if defined(CONFIG_HAVE_PREEMPT_DYNAMIC_CALL)
353 #define irqentry_exit_cond_resched_dynamic_enabled raw_irqentry_exit_cond_resched
354 #define irqentry_exit_cond_resched_dynamic_disabled NULL
355 DECLARE_STATIC_CALL(irqentry_exit_cond_resched, raw_irqentry_exit_cond_resched);
356 #define irqentry_exit_cond_resched() static_call(irqentry_exit_cond_resched)()
357 #elif defined(CONFIG_HAVE_PREEMPT_DYNAMIC_KEY)
358 DECLARE_STATIC_KEY_TRUE(sk_dynamic_irqentry_exit_cond_resched);
359 void dynamic_irqentry_exit_cond_resched(void);
360 #define irqentry_exit_cond_resched() dynamic_irqentry_exit_cond_resched()
361 #endif
362 #else /* CONFIG_PREEMPT_DYNAMIC */
363 #define irqentry_exit_cond_resched() raw_irqentry_exit_cond_resched()
364 #endif /* CONFIG_PREEMPT_DYNAMIC */
365
366 /**
367 * irqentry_enter_from_kernel_mode - Establish state before invoking the irq handler
368 * @regs: Pointer to currents pt_regs
369 *
370 * Invoked from architecture specific entry code with interrupts disabled.
371 * Can only be called when the interrupt entry came from kernel mode. The
372 * calling code must be non-instrumentable. When the function returns all
373 * state is correct and the subsequent functions can be instrumented.
374 *
375 * The function establishes state (lockdep, RCU (context tracking), tracing) and
376 * is provided for architectures which require a strict split between entry from
377 * kernel and user mode and therefore cannot use irqentry_enter() which handles
378 * both entry modes.
379 *
380 * Returns: An opaque object that must be passed to irqentry_exit_to_kernel_mode().
381 */
irqentry_enter_from_kernel_mode(struct pt_regs * regs)382 static __always_inline irqentry_state_t irqentry_enter_from_kernel_mode(struct pt_regs *regs)
383 {
384 irqentry_state_t ret = {
385 .exit_rcu = false,
386 };
387
388 /*
389 * If this entry hit the idle task invoke ct_irq_enter() whether
390 * RCU is watching or not.
391 *
392 * Interrupts can nest when the first interrupt invokes softirq
393 * processing on return which enables interrupts.
394 *
395 * Scheduler ticks in the idle task can mark quiescent state and
396 * terminate a grace period, if and only if the timer interrupt is
397 * not nested into another interrupt.
398 *
399 * Checking for rcu_is_watching() here would prevent the nesting
400 * interrupt to invoke ct_irq_enter(). If that nested interrupt is
401 * the tick then rcu_flavor_sched_clock_irq() would wrongfully
402 * assume that it is the first interrupt and eventually claim
403 * quiescent state and end grace periods prematurely.
404 *
405 * Unconditionally invoke ct_irq_enter() so RCU state stays
406 * consistent.
407 *
408 * TINY_RCU does not support EQS, so let the compiler eliminate
409 * this part when enabled.
410 */
411 if (!IS_ENABLED(CONFIG_TINY_RCU) &&
412 (is_idle_task(current) || arch_in_rcu_eqs())) {
413 /*
414 * If RCU is not watching then the same careful
415 * sequence vs. lockdep and tracing is required
416 * as in irqentry_enter_from_user_mode().
417 */
418 lockdep_hardirqs_off(CALLER_ADDR0);
419 ct_irq_enter();
420 instrumentation_begin();
421 kmsan_unpoison_entry_regs(regs);
422 trace_hardirqs_off_finish();
423 instrumentation_end();
424
425 ret.exit_rcu = true;
426 return ret;
427 }
428
429 /*
430 * If RCU is watching then RCU only wants to check whether it needs
431 * to restart the tick in NOHZ mode. rcu_irq_enter_check_tick()
432 * already contains a warning when RCU is not watching, so no point
433 * in having another one here.
434 */
435 lockdep_hardirqs_off(CALLER_ADDR0);
436 instrumentation_begin();
437 kmsan_unpoison_entry_regs(regs);
438 rcu_irq_enter_check_tick();
439 trace_hardirqs_off_finish();
440 instrumentation_end();
441
442 return ret;
443 }
444
445 /**
446 * irqentry_exit_to_kernel_mode_preempt - Run preempt checks on return to kernel mode
447 * @regs: Pointer to current's pt_regs
448 * @state: Return value from matching call to irqentry_enter_from_kernel_mode()
449 *
450 * This is to be invoked before irqentry_exit_to_kernel_mode_after_preempt() to
451 * allow kernel preemption on return from interrupt.
452 *
453 * Must be invoked with interrupts disabled and CPU state which allows kernel
454 * preemption.
455 *
456 * After returning from this function, the caller can modify CPU state before
457 * invoking irqentry_exit_to_kernel_mode_after_preempt(), which is required to
458 * re-establish the tracing, lockdep and RCU state for returning to the
459 * interrupted context.
460 */
irqentry_exit_to_kernel_mode_preempt(struct pt_regs * regs,irqentry_state_t state)461 static inline void irqentry_exit_to_kernel_mode_preempt(struct pt_regs *regs,
462 irqentry_state_t state)
463 {
464 if (regs_irqs_disabled(regs) || state.exit_rcu)
465 return;
466
467 if (IS_ENABLED(CONFIG_PREEMPTION))
468 irqentry_exit_cond_resched();
469 }
470
471 /**
472 * irqentry_exit_to_kernel_mode_after_preempt - Establish trace, lockdep and RCU state
473 * @regs: Pointer to current's pt_regs
474 * @state: Return value from matching call to irqentry_enter_from_kernel_mode()
475 *
476 * This is to be invoked after irqentry_exit_to_kernel_mode_preempt() and before
477 * actually returning to the interrupted context.
478 *
479 * There are no requirements for the CPU state other than being able to complete
480 * the tracing, lockdep and RCU state transitions. After this function returns
481 * the caller must return directly to the interrupted context.
482 */
483 static __always_inline void
irqentry_exit_to_kernel_mode_after_preempt(struct pt_regs * regs,irqentry_state_t state)484 irqentry_exit_to_kernel_mode_after_preempt(struct pt_regs *regs, irqentry_state_t state)
485 {
486 if (!regs_irqs_disabled(regs)) {
487 /*
488 * If RCU was not watching on entry this needs to be done
489 * carefully and needs the same ordering of lockdep/tracing
490 * and RCU as the return to user mode path.
491 */
492 if (state.exit_rcu) {
493 instrumentation_begin();
494 hrtimer_rearm_deferred();
495 /* Tell the tracer that IRET will enable interrupts */
496 trace_hardirqs_on_prepare();
497 lockdep_hardirqs_on_prepare();
498 instrumentation_end();
499 ct_irq_exit();
500 lockdep_hardirqs_on(CALLER_ADDR0);
501 return;
502 }
503
504 instrumentation_begin();
505 hrtimer_rearm_deferred();
506 /* Covers both tracing and lockdep */
507 trace_hardirqs_on();
508 instrumentation_end();
509 } else {
510 /*
511 * IRQ flags state is correct already. Just tell RCU if it
512 * was not watching on entry.
513 */
514 if (state.exit_rcu)
515 ct_irq_exit();
516 }
517 }
518
519 /**
520 * irqentry_exit_to_kernel_mode - Run preempt checks and establish state after
521 * invoking the interrupt handler
522 * @regs: Pointer to current's pt_regs
523 * @state: Return value from matching call to irqentry_enter_from_kernel_mode()
524 *
525 * This is the counterpart of irqentry_enter_from_kernel_mode() and combines
526 * the calls to irqentry_exit_to_kernel_mode_preempt() and
527 * irqentry_exit_to_kernel_mode_after_preempt().
528 *
529 * The requirement for the CPU state is that it can schedule. After the function
530 * returns the tracing, lockdep and RCU state transitions are completed and the
531 * caller must return directly to the interrupted context.
532 */
irqentry_exit_to_kernel_mode(struct pt_regs * regs,irqentry_state_t state)533 static __always_inline void irqentry_exit_to_kernel_mode(struct pt_regs *regs,
534 irqentry_state_t state)
535 {
536 lockdep_assert_irqs_disabled();
537
538 instrumentation_begin();
539 irqentry_exit_to_kernel_mode_preempt(regs, state);
540 instrumentation_end();
541
542 irqentry_exit_to_kernel_mode_after_preempt(regs, state);
543 }
544
545 /**
546 * irqentry_enter - Handle state tracking on ordinary interrupt entries
547 * @regs: Pointer to pt_regs of interrupted context
548 *
549 * Invokes:
550 * - lockdep irqflag state tracking as low level ASM entry disabled
551 * interrupts.
552 *
553 * - Context tracking if the exception hit user mode.
554 *
555 * - The hardirq tracer to keep the state consistent as low level ASM
556 * entry disabled interrupts.
557 *
558 * As a precondition, this requires that the entry came from user mode,
559 * idle, or a kernel context in which RCU is watching.
560 *
561 * For kernel mode entries RCU handling is done conditional. If RCU is
562 * watching then the only RCU requirement is to check whether the tick has
563 * to be restarted. If RCU is not watching then ct_irq_enter() has to be
564 * invoked on entry and ct_irq_exit() on exit.
565 *
566 * Avoiding the ct_irq_enter/exit() calls is an optimization but also
567 * solves the problem of kernel mode pagefaults which can schedule, which
568 * is not possible after invoking ct_irq_enter() without undoing it.
569 *
570 * For user mode entries irqentry_enter_from_user_mode() is invoked to
571 * establish the proper context for NOHZ_FULL. Otherwise scheduling on exit
572 * would not be possible.
573 *
574 * Returns: An opaque object that must be passed to irqentry_exit()
575 */
576 irqentry_state_t noinstr irqentry_enter(struct pt_regs *regs);
577
578 /**
579 * irqentry_exit - Handle return from exception that used irqentry_enter()
580 * @regs: Pointer to pt_regs (exception entry regs)
581 * @state: Return value from matching call to irqentry_enter()
582 *
583 * Depending on the return target (kernel/user) this runs the necessary
584 * preemption and work checks if possible and required and returns to
585 * the caller with interrupts disabled and no further work pending.
586 *
587 * This is the last action before returning to the low level ASM code which
588 * just needs to return to the appropriate context.
589 *
590 * Counterpart to irqentry_enter().
591 */
592 void noinstr irqentry_exit(struct pt_regs *regs, irqentry_state_t state);
593
594 /**
595 * irqentry_nmi_enter - Handle NMI entry
596 * @regs: Pointer to currents pt_regs
597 *
598 * Similar to irqentry_enter() but taking care of the NMI constraints.
599 */
600 irqentry_state_t noinstr irqentry_nmi_enter(struct pt_regs *regs);
601
602 /**
603 * irqentry_nmi_exit - Handle return from NMI handling
604 * @regs: Pointer to pt_regs (NMI entry regs)
605 * @irq_state: Return value from matching call to irqentry_nmi_enter()
606 *
607 * Last action before returning to the low level assembly code.
608 *
609 * Counterpart to irqentry_nmi_enter().
610 */
611 void noinstr irqentry_nmi_exit(struct pt_regs *regs, irqentry_state_t irq_state);
612
613 #endif
614