Skip to main content

Module split_queue

Module split_queue 

Source
Expand description

Unified split-virtqueue over guest physical memory.

SplitQueue is the single queue abstraction every ArcBox VirtIO device and worker uses to walk the available ring, parse descriptor chains, publish to the used ring, and decide whether to interrupt the guest. It replaces the previously-duplicated implementations (queue::VirtQueue local rings, queue_guest::GuestMemoryVirtQueue raw pointers, the per-device inline GPA walks, arcbox-vmm::virtqueue_util, and the net-TX inline used-ring write).

All addresses are guest physical addresses (GPAs); the backing GuestMemWriter performs the single gpa_base translation, so devices never subtract gpa_base themselves.

Three correctness properties live here exactly once:

  • Cycle-safe chain walk — bounded by size, so a malformed/malicious next cycle cannot spin the host thread.
  • Acquire on consume — the Acquire fence is placed after reading avail.idx and before reading the ring/descriptors, pairing with the guest’s Release on avail.idx.
  • Spec-correct notification suppression — a full SeqCst fence between publishing used.idx and reading used_event closes the StoreLoad race that otherwise lets the device read a stale used_event, suppress a needed IRQ, and leave the guest asleep in WFI forever.

Structs§

ChainIter
Allocation-free walk of a descriptor chain (see SplitQueue::chain_iter).
DescChain
A popped descriptor chain: the head index (used as the used-ring id) and the descriptors walked from it.
SplitQueue
A VirtIO split virtqueue backed by guest physical memory.
VirtqDesc
A single descriptor read from the descriptor table. addr is a GPA.