virtio-device

Implements virtio devices and both mmio and pci transports for a Rust VMM.

Updated Aug 18, 2026
One-click install
npx skills add https://github.com/doctorspider42/entangled-destop --skill virtio-device-doctorspider42
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: virtio-device
Source: https://github.com/doctorspider42/entangled-destop/tree/main/.agents/skills/virtio-device
Command: npx skills add https://github.com/doctorspider42/entangled-destop --skill virtio-device-doctorspider42

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Implementing virtio devices in a from-scratch virtual machine monitor requires strict adherence to the virtio specification, correct transport plumbing, and hardening against malicious guests; this Skill encodes the architecture contracts, transport details, and safety rules so device work stays consistent and secure. ## Core Features & Use Cases - Transport architecture guidance: Covers both virtio-mmio and virtio-pci transports, including BAR layout, capability records, MSI-X and INTx interrupt delivery, ioeventfd queue notification, and feature negotiation. - Untrusted-guest safety rules: Enforces bounded descriptor-chain walks, checked guest-memory access, validated status writes, and infallible reset paths so a malicious guest cannot crash or overrun the host. - Resource bounds catalog: Provides a complete table of named constants capping every guest-influenced allocation or iteration, each paired with its enforcing test. - Use Case: When adding a new virtio device crate (block, net, gpu, input, sound) or modifying the PCI config space model, load this Skill to follow the established VirtioDevice trait contract and extend the bounds table with enforcing tests. ## Quick Start Load the virtio-device skill before implementing or modifying any virtio device or transport code in the Entangled Desktop VMM.

Frequently Asked Questions about virtio-device

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a virtio device in a Rust VMM?

Implement the VirtioDevice trait from virtio-core so the device sees only queues, features, and config space, never transport registers. The transport owns registers, status, and queue plumbing, so a device that needs to know its transport indicates a design bug.

What is the difference between virtio-mmio and virtio-pci transports?

virtio-mmio uses one 4 KiB register slot per device with cmdline discovery and a single IRQ, while virtio-pci uses a 32 KiB BAR with capability records, MSI-X interrupts, and bus enumeration. Only virtio-pci works for UEFI ISO boots because EDK2 ships no virtio-mmio driver.

How do I protect a VMM from malicious virtio guests?

Guard every descriptor-chain walk with a bounded ChainWalkGuard, access guest memory only through vm-memory checked APIs, validate all guest-supplied geometry before allocating, and never panic on guest-controlled paths. Malformed input should fail the request or set DEVICE_NEEDS_RESET.

Does virtio-pci require MSI-X or can it use INTx interrupts?

Every function publishes both MSI-X and INTx, and the guest driver picks. One MsixInterrupt object serves both and decides per signal based on the message control register, since Linux drivers move between per-queue vectors, shared vectors, and INTx during their lifetime.

Why must virtio resource allocations be capped with named constants?

Every allocation or iteration a guest can influence is capped by a named constant with an enforcing test, preventing a malicious guest from exhausting host memory or CPU. A bound without an enforcing test is considered incomplete work.