XenevaOS
Loading...
Searching...
No Matches
irqflags.h
Go to the documentation of this file.
1/*
2 * DCL <linux/irqflags.h> -- the one thing the kernel side asks about
3 * interrupt state: irqs_disabled().
4 *
5 * mainline gets it here, and every consumer reaches it through
6 * <linux/interrupt.h>'s own include of this header (mainline: 12), which is
7 * why <drm/drm_util.h>:37 -- `in_atomic() || in_dbg_master() || irqs_disabled()`
8 * inside drm_can_sleep() -- resolves without this header being named at the
9 * call site. <linux/interrupt.h> in this tree carries the same include.
10 *
11 * The answer is read from the real register rather than from a flag DCL
12 * keeps, because there is no such flag: daif's bit 7 (DAIF.I) is the mask
13 * ARM64 itself honours, and Hal/AA64/aa64lowlevel.s:309 already exposes it
14 * as read_daif(). A fabricated constant would be right almost always and
15 * wrong precisely when drm_can_sleep() matters -- inside an IRQ handler that
16 * took a lock it should not have.
17 *
18 * Deliberately not here: local_irq_save/restore/disable/enable. The only
19 * mentions in this tree are seqlock.h:72/:75, inside a CONFIG_LOCKDEP arm
20 * that does not compile, and DCL has no way to mask interrupts from C (only
21 * restore_daif() to put an old value back). Writing those macros as no-ops
22 * would make the next caller believe it had a critical section; letting the
23 * compiler say "implicit declaration" instead means it has to be built
24 * honestly, the day something here actually needs it.
25 */
26#ifndef __LINUX_IRQFLAGS_H__
27#define __LINUX_IRQFLAGS_H__
28
29#include <Hal/AA64/aa64lowlevel.h> /* read_daif() */
30
31static inline int irqs_disabled(void)
32{
33 return (read_daif() & (1UL << 7)) != 0; /* DAIF_I */
34}
35
36#endif /* __LINUX_IRQFLAGS_H__ */
uint64_t read_daif()