Documentation
¶
Overview ¶
Headless go-virtio vsock validate harness: boots tamago/amd64 under QEMU, drives a real virtio-vsock device through the go-virtio/vsock driver, and attempts a packet round-trip with the host. The guest reports VSOCK-VALIDATE: PASS/FAIL on the serial console; run-vsock.sh parses it.
IMPORTANT — HOST WALL: virtio-vsock's PCI front-end on QEMU is `vhost-vsock-pci`, which is backed by the HOST kernel's vhost_vsock module (AF_VSOCK / /dev/vhost-vsock). That kernel facility is Linux-only; macOS has no host vsock and the Homebrew macOS QEMU build does not even compile the device in. On this host run-vsock.sh therefore never reaches the guest — it maps the wall at the QEMU device-instantiation layer. This main() is the guest side that WOULD run on a Linux KVM host with vhost_vsock loaded; it is kept (and kept compiling) so the harness is complete and portable.
What the guest would prove on a Linux host (any failure => FAIL):
- INIT: OpenVirtioVsock binds DID 0x1053, negotiates VERSION_1, reads the assigned guest_cid from device config, and sets up rx/tx/event queues with rx + event pre-posted.
- GUEST_CID: the assigned CID is a real, non-reserved value (== the guest-cid passed to vhost-vsock-pci on the host).
- SEND: a TypeStream OpRequest (connection request) to (CIDHost, port) marshals and transmits off the tx queue without ErrTransmitTimeout — the device consumed the descriptor.
- RECEIVE: the host side (run-vsock.sh's AF_VSOCK listener) accepts and replies; the guest receives a packet whose dst_cid == its own guest_cid (the packet round-tripped back to us). This is the "packet actually round-tripped" proof.