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_CSUM
from the specification becomesvirtio::net::F::CSUM
in this crate.virtio_net_config
from the specification becomesvirtio::net::Config
in this crate.
Either run
cargo add virtio-spec --rename virtio
or manually edit your Cargo.toml
:
[dependencies]
virtio = { package = "virtio-spec", version = "x.y.z" }
§Features
This crate has the following Cargo features:
alloc
enables allocating unsized structs such asvirtq::Avail
andvirtq::Used
via theallocator_api2
crate.mmio
enables themmio
module for Virtio Over MMIO.nightly
enables nightly-only functionality.pci
enables thepci
module for Virtio Over PCI via thepci_types
crate.zerocopy
derives 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 | ❌ | |
Entropy Device | ❌ | |
Traditional Memory Balloon Device | ❌ | |
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§
- fs
- File System Device
- mmio
mmio
- Definitions for Virtio over MMIO.
- net
- Network Device
- pci
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.