indicogniBuild a VMM

Lab

Virtio status handshake

Used in chapter 15.

Step through a driver bringing up a virtio-mmio device (status bits, feature negotiation, queue setup, the doorbell), then play drivers that misbehave and see what the device refuses.

Runs in browser
The virtio status handshake The driver writes Status 0 (reset), then 0x1 ACKNOWLEDGE, 0x3 adding DRIVER, accepts features (VERSION_1, bit 32), writes 0xb adding FEATURES_OK and reads it back, sets up queue 0 (size 16, three ring addresses, QueueReady 1), then writes 0xf adding DRIVER_OK. Bits only accumulate; writing 0 is the one way back. The device refuses FEATURES_OK if the driver accepted a bit it never offered or did not accept VERSION_1, ignores queue writes while a queue is ready (except a QueueReady 0 before DRIVER_OK, which unfreezes it) or once DRIVER_OK is set, and answers a ring outside RAM at DRIVER_OK with DEVICE_NEEDS_RESET (64) and a configuration interrupt. The probe's handshake, as traced on a real Mac 0x0 0x1 0x3 0xb 0xf reset ACKNOWLEDGE +DRIVER +FEATURES_OK +DRIVER_OK accept VERSION_1 set up queue 0 The device has the last word FEATURES_OK with an unoffered bit, or without VERSION_1: not latched a skipped step or a cleared bit: ignored (bits only accumulate) queue writes while the queue is ready, or after DRIVER_OK: ignored (before DRIVER_OK, writing QueueReady 0 still unfreezes the queue) a ring outside RAM at DRIVER_OK: DEVICE_NEEDS_RESET (64) + config interrupt narrow or misaligned control access: read as zero, write ignored Writing 0 to Status resets the device: the one way back.

All labs