◈ Passerelle

Project

ADR-003 — write our own layer 1 instead of vendoring kodebooth/qnx-virtio

Context

kodebooth/qnx-virtio (April 2026, MIT, ~2 400 lines of transport plus a complete virtio-gpio resource manager) is a real library, not a sketch: the device abstraction is transport-agnostic and vtable-based, both virtqueue layouts are handled, and its interrupt path is the right one for QNX 8.0 (InterruptAttachThread() + InterruptWait()).

The specification's rule for D3 was: <em>evaluate it during week 1; write our own if adapting costs more than a day.</em> The evaluation was done by reading the tree line by line (it cannot be built here: it needs the SDP).

Decision

<strong>Do not vendor it. Write our own portable layer 1.</strong> Five findings drove the call, in order of weight:

  1. **It cannot be compiled or unit-tested off QNX.** `virtio.c` includes `<sys/neutrino.h>` and calls `InterruptAttachThread()`; `virtio_pci.c` calls `libpci` directly. That contradicts P9-10 and the design rule that layers 1 and 2 are tested on the host PC, in CI, with no SDP.
  2. **Modern-only PCI ids.** `VIRTIO_PCI_DID(type)` is `0x1040 + type` and the device is forced to `legacy = false`, so the transitional id `0x1009` that VIO-01 requires — and that stock QEMU configurations expose — is not recognised. (Our own PCI test sees `1af4/1009` reported by a real QNX 7.1 guest.)
  3. **No indirect descriptors, no `EVENT_IDX`.** Chains are allocated descriptor by descriptor; the rings reserve the event-index bytes without using them. VIO-08 would have to be written from scratch anyway.
  4. **Concurrency and reset shape.** One coarse `pthread_spinlock_t` for the transport, and a reset that polls in a `delay()` loop, which blocks the caller instead of fitting an asynchronous event loop.
  5. **Adaptation cost.** Splitting it into an OS-independent core plus OS bus accessors means rewriting roughly 80 % of `src/virtio/` and `src/virtio_pci/`, then maintaining a fork whose API has diverged.

The project is cited with gratitude in 0 — its use of the QNX 8.0 libpci MSI-X calls is what confirmed our own interrupt design.

Consequences