Expand description
s9vm : virtio split-queue core (pure).
A virtio device exchanges buffers with its driver through a split virtqueue: a descriptor table, an available ring (driver → device) and a used ring (device → driver). The layout is transport-independent, which is why this module is a pure model: it only needs guest-physical memory access, and the transport layer (MMIO page or PCI BAR) is a thin register file on top.
Implemented here:
- descriptor encoding/decoding (16 bytes:
addr,len,flags,next); - available-ring consumption (
idxandring[]) with wrap-around; - chain walking, including one level of indirect descriptor tables;
- used-ring completion (
id+ written length), with wrap-around; - modern feature negotiation (
DeviceFeatures), device-status transitions (apply_status) and queue-programming validation (QueueState,QueueNotify); - used-ring event suppression (
VIRTQ_AVAIL_F_NO_INTERRUPT).
The transport layer (MMIO page or PCI BAR) remains a thin register file on top of these primitives.
Re-exports§
use alloc::vec::Vec;🔒
Modules§
- status
- Device-status bits (virtio specification, transport independent).
Structs§
- Descriptor
- One split-queue descriptor.
- Device
Features - Modern feature negotiation state: device offer, driver request and the
mask committed when the driver writes
FEATURES_OK. - Queue
Notify - Validated value written to
QUEUE_NOTIFY. - Queue
State - Queue-programming state as written by the driver through the transport.
- Split
Queue - One split virtqueue.
Enums§
- Feature
Error - Feature-negotiation failure.
- Queue
Error - Queue configuration or access error.
Constants§
- DESCRIPTOR_
SIZE - Size of one descriptor in the table.
- DESC_
F_ INDIRECT - Descriptor flag:
addrpoints to an indirect descriptor table. - DESC_
F_ NEXT - Descriptor flag: the chain continues in
next. - DESC_
F_ WRITE - Descriptor flag: the buffer is written by the device.
- MAX_
QUEUE_ SIZE - Highest queue size accepted by the legacy interface.
- STATUS_
KNOWN - Mask of every status bit the models understand.
- VERSION_
1_ 🔒MASK - 64-bit mask of
VIRTIO_F_VERSION_1. - VIRTIO_
F_ VERSION_ 1 - Feature bit
VIRTIO_F_VERSION_1(modern interface), bit 32 of the device/driver feature space. - VIRTQ_
AVAIL_ F_ NO_ INTERRUPT - Available-ring flag: the driver does not want used-ring interrupts.
Traits§
- Queue
Memory - Guest physical memory access for the queue.
Functions§
- apply_
status - Applies one guest write to the device-status register.
- feature_
word 🔒 - One 32-bit half of a 64-bit feature mask.