notes

Testing an interrupt as a message on RISC-V, which has no SGI

Name: provisional, minted 2026-10-11 (UTC) by lane/third-ten-longest-notes.

An appendix to notes/interrupts.md, moved there on 2026-10-11 (UTC) under §212 (a prose budget). It records how the work of 2026-07-31 made the two interrupt-to-message tests run on RISC-V.

The two tests above (kernel::sched::tests::an_interrupt_becomes_a_message and an_interrupt_that_arrives_before_the_wait_is_not_lost) were aarch64-only for a year, gated because they trigger with an SGI. The properties are not architectural, though: one is interrupt-to-IPC delivery and the other is a lost-wakeup race, and RISC-V has interrupts and the same IPC. Only the trigger was in the way. They are portable now, with the trigger behind three functions in the test module (arm_test_interrupt, raise_test_interrupt, quiet_test_interrupt).

What RISC-V raises, and why that one. The console UART's own transmit-empty interrupt. A 16550 asserts its line the moment IER.ETBEI is set while LSR.THRE is set, and the transmitter of a polling console is always empty, so one register write raises the line into the PLIC and one lowers it. No transfer, no external stimulus, nothing to read back. console::raise_uart_interrupt / quiet_uart_interrupt, test builds only.

Two other options were considered and are worse, for reasons worth keeping:

So the two legs are not twins, and the note says so rather than the doc comment claiming it. aarch64's SGI needs no device at all; RISC-V's needs the UART to exist. In the other direction RISC-V covers more of the controller: an external interrupt goes through the PLIC's claim / mask / notify / complete handshake, which an aarch64 SGI does not reach. The kernel path under test, the part these tests exist for, is the same on both.

A claim that was in the tree and was not backed. The old doc comment on an_interrupt_becomes_a_message said the same path was "proven on RISC-V by the boot tour's userspace UART driver". The boot tour is script/console, interactive, and gates nothing, so as written the claim cited a witness the suite does not run. The substance was true by then for a different reason (the parity-C virtio tests), but the citation was to the wrong thing. A parity claim resting on a demo nobody runs is the shape of gap §19 exists to catch.