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 enter_from_user_mode() in the non-instrumentable section. Use
53 * __always_inline so the compiler cannot push it out of line and make it
54 * 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 irqentry_exit_cond_resched(void);
350
351 /**
352 * irqentry_enter_from_kernel_mode - Establish state before invoking the irq handler
353 * @regs: Pointer to currents pt_regs
354 *
355 * Invoked from architecture specific entry code with interrupts disabled.
356 * Can only be called when the interrupt entry came from kernel mode. The
357 * calling code must be non-instrumentable. When the function returns all
358 * state is correct and the subsequent functions can be instrumented.
359 *
360 * The function establishes state (lockdep, RCU (context tracking), tracing) and
361 * is provided for architectures which require a strict split between entry from
362 * kernel and user mode and therefore cannot use irqentry_enter() which handles
363 * both entry modes.
364 *
365 * Returns: An opaque object that must be passed to irqentry_exit_to_kernel_mode().
366 */
irqentry_enter_from_kernel_mode(struct pt_regs * regs)367 static __always_inline irqentry_state_t irqentry_enter_from_kernel_mode(struct pt_regs *regs)
368 {
369 irqentry_state_t ret = {
370 .exit_rcu = false,
371 };
372
373 /*
374 * If this entry hit the idle task invoke ct_irq_enter() whether
375 * RCU is watching or not.
376 *
377 * Interrupts can nest when the first interrupt invokes softirq
378 * processing on return which enables interrupts.
379 *
380 * Scheduler ticks in the idle task can mark quiescent state and
381 * terminate a grace period, if and only if the timer interrupt is
382 * not nested into another interrupt.
383 *
384 * Checking for rcu_is_watching() here would prevent the nesting
385 * interrupt to invoke ct_irq_enter(). If that nested interrupt is
386 * the tick then rcu_flavor_sched_clock_irq() would wrongfully
387 * assume that it is the first interrupt and eventually claim
388 * quiescent state and end grace periods prematurely.
389 *
390 * Unconditionally invoke ct_irq_enter() so RCU state stays
391 * consistent.
392 *
393 * TINY_RCU does not support EQS, so let the compiler eliminate
394 * this part when enabled.
395 */
396 if (!IS_ENABLED(CONFIG_TINY_RCU) &&
397 (is_idle_task(current) || arch_in_rcu_eqs())) {
398 /*
399 * If RCU is not watching then the same careful
400 * sequence vs. lockdep and tracing is required
401 * as in irqentry_enter_from_user_mode().
402 */
403 lockdep_hardirqs_off(CALLER_ADDR0);
404 ct_irq_enter();
405 instrumentation_begin();
406 kmsan_unpoison_entry_regs(regs);
407 trace_hardirqs_off_finish();
408 instrumentation_end();
409
410 ret.exit_rcu = true;
411 return ret;
412 }
413
414 /*
415 * If RCU is watching then RCU only wants to check whether it needs
416 * to restart the tick in NOHZ mode. rcu_irq_enter_check_tick()
417 * already contains a warning when RCU is not watching, so no point
418 * in having another one here.
419 */
420 lockdep_hardirqs_off(CALLER_ADDR0);
421 instrumentation_begin();
422 kmsan_unpoison_entry_regs(regs);
423 rcu_irq_enter_check_tick();
424 trace_hardirqs_off_finish();
425 instrumentation_end();
426
427 return ret;
428 }
429
430 /**
431 * irqentry_exit_to_kernel_mode_preempt - Run preempt checks on return to kernel mode
432 * @regs: Pointer to current's pt_regs
433 * @state: Return value from matching call to irqentry_enter_from_kernel_mode()
434 *
435 * This is to be invoked before irqentry_exit_to_kernel_mode_after_preempt() to
436 * allow kernel preemption on return from interrupt.
437 *
438 * Must be invoked with interrupts disabled and CPU state which allows kernel
439 * preemption.
440 *
441 * After returning from this function, the caller can modify CPU state before
442 * invoking irqentry_exit_to_kernel_mode_after_preempt(), which is required to
443 * re-establish the tracing, lockdep and RCU state for returning to the
444 * interrupted context.
445 */
irqentry_exit_to_kernel_mode_preempt(struct pt_regs * regs,irqentry_state_t state)446 static inline void irqentry_exit_to_kernel_mode_preempt(struct pt_regs *regs,
447 irqentry_state_t state)
448 {
449 if (regs_irqs_disabled(regs) || state.exit_rcu)
450 return;
451
452 if (IS_ENABLED(CONFIG_PREEMPTION))
453 irqentry_exit_cond_resched();
454 }
455
456 /*
457 * The deferred hrtimer rearm is the tail of the timer interrupt, moved to the
458 * interrupt return path so that it runs after a possible reschedule. By now
459 * irq_exit_rcu() has left lockdep's hardirq context. Re-enter it for the
460 * rearm, so that the hrtimer base lock and the timekeeping sequence count are
461 * not chained onto the locks held by the interrupted context, which would add
462 * new lock chains for every lock stack an interrupt hits.
463 *
464 * The rearm on return to user mode needs no such annotation: no locks are
465 * held there, so it uses the same lock chains as the rearm in hardirq
466 * context.
467 */
irqentry_hrtimer_rearm_deferred(void)468 static __always_inline void irqentry_hrtimer_rearm_deferred(void)
469 {
470 lockdep_hardirq_enter();
471 hrtimer_rearm_deferred();
472 lockdep_hardirq_exit();
473 }
474
475 /**
476 * irqentry_exit_to_kernel_mode_after_preempt - Establish trace, lockdep and RCU state
477 * @regs: Pointer to current's pt_regs
478 * @state: Return value from matching call to irqentry_enter_from_kernel_mode()
479 *
480 * This is to be invoked after irqentry_exit_to_kernel_mode_preempt() and before
481 * actually returning to the interrupted context.
482 *
483 * There are no requirements for the CPU state other than being able to complete
484 * the tracing, lockdep and RCU state transitions. After this function returns
485 * the caller must return directly to the interrupted context.
486 */
487 static __always_inline void
irqentry_exit_to_kernel_mode_after_preempt(struct pt_regs * regs,irqentry_state_t state)488 irqentry_exit_to_kernel_mode_after_preempt(struct pt_regs *regs, irqentry_state_t state)
489 {
490 if (!regs_irqs_disabled(regs)) {
491 /*
492 * If RCU was not watching on entry this needs to be done
493 * carefully and needs the same ordering of lockdep/tracing
494 * and RCU as the return to user mode path.
495 */
496 if (state.exit_rcu) {
497 instrumentation_begin();
498 irqentry_hrtimer_rearm_deferred();
499 /* Tell the tracer that IRET will enable interrupts */
500 trace_hardirqs_on_prepare();
501 lockdep_hardirqs_on_prepare();
502 instrumentation_end();
503 ct_irq_exit();
504 lockdep_hardirqs_on(CALLER_ADDR0);
505 return;
506 }
507
508 instrumentation_begin();
509 irqentry_hrtimer_rearm_deferred();
510 /* Covers both tracing and lockdep */
511 trace_hardirqs_on();
512 instrumentation_end();
513 } else {
514 /*
515 * IRQ flags state is correct already. Just tell RCU if it
516 * was not watching on entry.
517 */
518 if (state.exit_rcu)
519 ct_irq_exit();
520 }
521 }
522
523 /**
524 * irqentry_exit_to_kernel_mode - Run preempt checks and establish state after
525 * invoking the interrupt handler
526 * @regs: Pointer to current's pt_regs
527 * @state: Return value from matching call to irqentry_enter_from_kernel_mode()
528 *
529 * This is the counterpart of irqentry_enter_from_kernel_mode() and combines
530 * the calls to irqentry_exit_to_kernel_mode_preempt() and
531 * irqentry_exit_to_kernel_mode_after_preempt().
532 *
533 * The requirement for the CPU state is that it can schedule. After the function
534 * returns the tracing, lockdep and RCU state transitions are completed and the
535 * caller must return directly to the interrupted context.
536 */
irqentry_exit_to_kernel_mode(struct pt_regs * regs,irqentry_state_t state)537 static __always_inline void irqentry_exit_to_kernel_mode(struct pt_regs *regs,
538 irqentry_state_t state)
539 {
540 lockdep_assert_irqs_disabled();
541
542 instrumentation_begin();
543 irqentry_exit_to_kernel_mode_preempt(regs, state);
544 instrumentation_end();
545
546 irqentry_exit_to_kernel_mode_after_preempt(regs, state);
547 }
548
549 /**
550 * irqentry_enter - Handle state tracking on ordinary interrupt entries
551 * @regs: Pointer to pt_regs of interrupted context
552 *
553 * Invokes:
554 * - lockdep irqflag state tracking as low level ASM entry disabled
555 * interrupts.
556 *
557 * - Context tracking if the exception hit user mode.
558 *
559 * - The hardirq tracer to keep the state consistent as low level ASM
560 * entry disabled interrupts.
561 *
562 * As a precondition, this requires that the entry came from user mode,
563 * idle, or a kernel context in which RCU is watching.
564 *
565 * For kernel mode entries RCU handling is done conditional. If RCU is
566 * watching then the only RCU requirement is to check whether the tick has
567 * to be restarted. If RCU is not watching then ct_irq_enter() has to be
568 * invoked on entry and ct_irq_exit() on exit.
569 *
570 * Avoiding the ct_irq_enter/exit() calls is an optimization but also
571 * solves the problem of kernel mode pagefaults which can schedule, which
572 * is not possible after invoking ct_irq_enter() without undoing it.
573 *
574 * For user mode entries irqentry_enter_from_user_mode() is invoked to
575 * establish the proper context for NOHZ_FULL. Otherwise scheduling on exit
576 * would not be possible.
577 *
578 * Returns: An opaque object that must be passed to irqentry_exit()
579 */
580 irqentry_state_t noinstr irqentry_enter(struct pt_regs *regs);
581
582 /**
583 * irqentry_exit - Handle return from exception that used irqentry_enter()
584 * @regs: Pointer to pt_regs (exception entry regs)
585 * @state: Return value from matching call to irqentry_enter()
586 *
587 * Depending on the return target (kernel/user) this runs the necessary
588 * preemption and work checks if possible and required and returns to
589 * the caller with interrupts disabled and no further work pending.
590 *
591 * This is the last action before returning to the low level ASM code which
592 * just needs to return to the appropriate context.
593 *
594 * Counterpart to irqentry_enter().
595 */
596 void noinstr irqentry_exit(struct pt_regs *regs, irqentry_state_t state);
597
598 /**
599 * irqentry_nmi_enter - Handle NMI entry
600 * @regs: Pointer to currents pt_regs
601 *
602 * Similar to irqentry_enter() but taking care of the NMI constraints.
603 */
604 irqentry_state_t noinstr irqentry_nmi_enter(struct pt_regs *regs);
605
606 /**
607 * irqentry_nmi_exit - Handle return from NMI handling
608 * @regs: Pointer to pt_regs (NMI entry regs)
609 * @irq_state: Return value from matching call to irqentry_nmi_enter()
610 *
611 * Last action before returning to the low level assembly code.
612 *
613 * Counterpart to irqentry_nmi_enter().
614 */
615 void noinstr irqentry_nmi_exit(struct pt_regs *regs, irqentry_state_t irq_state);
616
617 #endif
618