Skip to content

port: IRQ masking primitives and interrupt-context tracking - #4

Closed
gmacd wants to merge 6 commits into
mainfrom
port-irq-masking
Closed

port: IRQ masking primitives and interrupt-context tracking#4
gmacd wants to merge 6 commits into
mainfrom
port-irq-masking

Conversation

@gmacd

@gmacd gmacd commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Adds port::irq: an RAII IrqGuard that masks IRQs and restores the previous state on drop (nestable; a no-op until an arch registers mask/restore hooks), plus an interrupt-depth counter (enter_interrupt/exit_interrupt/in_interrupt). Subsystems can either mask around locks shared with interrupt context, or assert they are never used from it.

aarch64 registers a DAIF-based implementation at early boot and brackets the trap handler with the depth counter. Behaviorally inert on its own: nothing takes a guard yet, and the other arches see no-ops.

Stacked on #3; review the last commit.

gmacd added 6 commits July 8, 2026 10:39
Signed-off-by: Graham MacDonald <grahamamacdonald@gmail.com>
Signed-off-by: Graham MacDonald <grahamamacdonald@gmail.com>
Signed-off-by: Graham MacDonald <grahamamacdonald@gmail.com>
req_buffer_va/req_buffer_pa held VirtRange/PhysRange values; name
them req_buf_virtrange/req_buf_physrange like the rest of the file.
Also drop an unused pub on mbox_virtrange.
Add port::irq with an RAII IrqGuard (mask IRQs on new, restore the
previous state on drop; nestable; no-op until an arch registers its
mask/restore hooks) and an interrupt-depth counter (enter_interrupt/
exit_interrupt/in_interrupt) so subsystems can either mask around
locks shared with interrupt context or assert they are never used
from it.

aarch64 registers a DAIF-based implementation at early boot and
brackets the trap handler with the depth counter.  Other arches are
unaffected: the guard is a no-op and in_interrupt is always false
until they opt in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant