Expand description
This crate contains the Rust equivalents of the definitions from the Virtual I/O Device (VIRTIO) Specification. This crate aims to be unopinionated regarding actual VIRTIO drivers that are implemented on top of this crate.
§Usage
We recommend to rename this crate to virtio when adding the dependency.
This allows closely matching the specification when using definitions:
VIRTIO_NET_F_CSUMfrom the specification becomesvirtio::net::F::CSUMin this crate.virtio_net_configfrom the specification becomesvirtio::net::Configin this crate.
Either run
cargo add virtio-spec --rename virtioor manually edit your Cargo.toml:
[dependencies]
virtio = { package = "virtio-spec", version = "x.y.z" }§Features
This crate has the following Cargo features:
allocenables allocating unsized structs such asvirtq::Availandvirtq::Usedvia theallocator_api2crate.mmioenables themmiomodule for Virtio Over MMIO.nightlyenables nightly-only functionality.pcienables thepcimodule for Virtio Over PCI via thepci_typescrate.zerocopyderives the following traits for most structs:
§Implementation Status
This crate adds new modules by demand. If you need anything that is not available yet, please open an issue.
§Virtqueues
§Transport Options
§Device Types
| Device Type | Available | Module | 
|---|---|---|
| Network Device | ✅ | net | 
| Block Device | ❌ | |
| Console Device | ✅ | console | 
| Entropy Device | ❌ | |
| Traditional Memory Balloon Device | ✅ | balloon | 
| SCSI Host Device | ❌ | |
| GPU Device | ❌ | |
| Input Device | ❌ | |
| Crypto Device | ❌ | |
| Socket Device | ✅ | vsock | 
| File System Device | ✅ | fs | 
| RPMB Device | ❌ | |
| IOMMU Device | ❌ | |
| Sound Device | ❌ | |
| Memory Device | ❌ | |
| I2C Adapter Device | ❌ | |
| SCMI Device | ❌ | |
| GPIO Device | ❌ | |
| PMEM Device | ❌ | 
Modules§
- balloon
 - console
 - Console Device
 - fs
 - File System Device
 - mmio
 - Definitions for Virtio over MMIO.
 - net
 - Network Device
 - pci
 - Definitions for Virtio over PCI bus.
 - pvirtq
 - Packed virtqueue definitions
 - virtq
 - Virtqueue definitions
 - volatile
 - Volatile Pointer Types.
 - vsock
 - Socket Device
 
Structs§
- Be
 - An integer stored in big-endian byte order.
 - Device
Status  - Device Status Field
 - F
 - Device-independent Feature Bits
 - Le
 - An integer stored in little-endian byte order.
 
Enums§
- Id
 - Virtio Device IDs
 - Ring
Event Flags  - Descriptor Ring Change Event Flags
 
Traits§
- Device
Config Space  - Common device configuration space functionality.
 - Feature
Bits  - Feature Bits
 
Type Aliases§
- be16
 - A 16-bit unsigned integer stored in big-endian byte order.
 - be32
 - A 32-bit unsigned integer stored in big-endian byte order.
 - be64
 - A 64-bit unsigned integer stored in big-endian byte order.
 - be128
 - A 128-bit unsigned integer stored in big-endian byte order.
 - le16
 - A 16-bit unsigned integer stored in little-endian byte order.
 - le32
 - A 32-bit unsigned integer stored in little-endian byte order.
 - le64
 - A 64-bit unsigned integer stored in little-endian byte order.
 - le128
 - A 128-bit unsigned integer stored in little-endian byte order.