# Deliberation: kido interrupt-chain QEMU proof — vec + timer PPI 30 + serial-irq SPI 33 (session 31)

Builder crew micro-agent circle. One solid piece: the queued
proofs from sessions 28/29/30, run together because they are one
chain — vec install -> GIC init -> handlers -> DAIF unmask ->
timer IRQ -> UART RX IRQ -> clean return. The toolchain is
PRESENT this session (aarch64-linux-gnu-gcc, qemu-system-aarch64);
sessions 29/30 queued exactly these proofs on its return, and
the toolchain has vanished 13 times before. Seize the window;
do not draft past it.

## Positions

- P1 (proof keeper): the acceptance bar is the session-27 SGI
  bar, extended, not lowered: one timer IRQ taken, one clean
  exception return, the UART RX bytes arriving in the ring
  byte-identical to what was sent, zero fault-class entries
  in the -d int log. Anything less is not the proof.
- P2 (harness keeper): scratch harness only (/tmp), pristine
  scaffold tree. The committed kido-vec-arm64.S is the module
  under proof — the session-27 scratch stub is NOT reused;
  this proof retires the "scratch stub" qualifier from the
  vec record. Scratch owns only the entry shim and main:
  EL drop, stack, BSS zero, raw PL011 puts, the two silent
  handlers, the main-loop printer.
- P3 (IRQ realist): handlers set flags and disarm, they do
  not print. Printing from IRQ context while the main loop
  also prints would interleave markers and make the log
  unreadable; worse, it would hide a storm behind garbled
  output. The main loop is the only printer. A handler that
  prints is a harness bug, not a feature.
- P4 (honesty auditor): this proof proves delivery through
  the committed modules on QEMU virt. It does NOT prove the
  scheduler-tick policy (re-arm in the handler is a caller
  policy, not run here beyond disarm), the HAL wiring, the
  MMU call-site seam, or any Pi4 identity. Those stay Gate
  items / named futures, stated in the ledger, not smuggled
  in by a passing run.
- P5 (fence keeper): zero scaffold files modified by the
  harness. If the proof lands, the only scaffold edits are
  the ledger entry, the module-map proof notes, and (per
  the session-18 precedent) comment-only PROOF STATUS
  updates in the three headers. No logic, no wiring.

## Challenges, answered

- C1 (why does the console share the RX device?): the QEMU
  virt PL011 at 0x09000000 is both the proof console (TX)
  and the RX device under proof. That is the point, not a
  flaw: the same UART that prints the markers receives the
  injected bytes. TX and RX are separate FIFOs; the
  serial-irq init touches only the RX window (IFLS/IMSC/
  ICR), never CR/LCR, so console TX is undisturbed.
- C2 (how do injected bytes reach the UART without losing
  the early console?): QEMU chardev socket, server=on,
  wait=on. QEMU blocks before boot until the driver
  connects, so no early marker is dropped to an unconnected
  socket. The driver reads until READY, sends exactly
  "KIDO" (4 bytes = the IFLS 1/4 trigger level, so one IRQ
  assertion is the expected shape), then reads until DONE.
  Sending more than 4 bytes would invite a second IRQ and
  muddy the count; sending fewer would never assert.
- C3 (PPI trigger config?): the GIC driver refuses
  set_config for PPIs — architecturally fixed, and the
  timer header says so. The wiring is enable(30) +
  register handler + arm, nothing more. Calling
  set_config(30) in the harness would be a harness bug
  (it fails loud by design); the proof must not call it.
- C4 (timer storm?): the physical timer is one-shot with
  no periodic mode. The handler disarms (CTL = 0) before
  dispatch writes EOIR, so the line deasserts and cannot
  re-fire. A handler that re-armed would be a policy
  (the scheduler tick), not this proof. Handler-run count
  is printed at the end and must read 1.
- C5 (what if the timer fires before DAIF unmask?): it
  cannot be taken before unmask — PSTATE.I stays masked
  from the EL-drop SPSR (0x3c5) until kido_vec_irq_enable().
  The arm happens AFTER unmask in the harness order
  (install -> GIC init -> handlers -> unmask -> arm), so
  the first taken IRQ is the timer's, by construction.
- C6 (order of the two proofs?): timer first, UART second,
  in one boot. The timer IRQ proves the vec+GIC+DAIF path
  with no external input; the UART IRQ then proves SPI
  delivery through a real device on the already-proven
  path. If the timer half fails, the UART half is not
  attempted in the same run — a broken path cannot carry
  a second proof.
- C7 (VBAR readback?): install is checked, not assumed.
  The harness reads VBAR_EL1 after kido_vec_install() and
  compares it to the table address; mismatch prints X and
  spins before any IRQ is enabled. An interrupt taken
  through a wrong VBAR would fault, and the proof would
  be diagnosing the harness instead of the modules.

## Convergence

Scratch harness (/tmp only) + committed vec .S + committed
gic/timer/serial-irq .c files, linked at 0x40080000 with the
scratch entry first (session-11 link lesson). Markers, all
printed by the main loop only: S start, V VBAR readback OK,
G GIC init OK, T timer init OK, R serial-irq init OK, I
DAIF unmask, READY, T1 timer IRQ observed (handler count
1), U + the drained bytes, DONE. Acceptance: every marker
in order, drained bytes == "KIDO", -d int log with exactly
two IRQ entries (timer + UART) and one clean return each,
zero fault-class entries, exit 124 (timeout in the designed
post-proof spin).

## Preserved dissent

- D1 (separate runs, overruled): timer and UART proofs in
  separate boots would isolate failures better. Overruled:
  they share the vec+GIC+DAIF path, and C6 orders them so
  a timer failure aborts before the UART half runs. One
  boot, two ordered proofs, one log.
- D2 (handler prints, overruled): a 'T' printed from the
  handler would timestamp the IRQ directly. Overruled (P3):
  interleaving risk outweighs it; the handler-run counter
  plus the main-loop flag observation is the same evidence
  without the garble.
- D3 (re-arming tick, overruled): a re-arming handler would
  prove the scheduler-tick shape. Overruled: that is a
  policy Gate item, not this proof's bar. One shot, one
  IRQ, disarm.

## Proof posture (stated before running)

- Hosted battery + full-tree cross-compile run FIRST. A
  QEMU proof on a tree whose hosted battery is red proves
  nothing.
- The harness is scratch: if it fails, the failure is
  diagnosed once as harness or module, fixed once in the
  harness if it is harness, and reported honestly if it is
  module. No silent retries, no claim from a partial log.
