Skip to content

Commit 28683c8

Browse files
CopilotBernardXiong
andcommitted
[virtio] Add VirtIO specification references document
- Added SPECIFICATIONS.md with official VirtIO spec links - Documented v1.0, v1.1, and v1.2 specifications - Included QEMU documentation references - Added feature bits and status bits reference tables - Addresses issue comment requesting specification links Co-authored-by: BernardXiong <[email protected]>
1 parent 4c01059 commit 28683c8

File tree

1 file changed

+194
-0
lines changed

1 file changed

+194
-0
lines changed
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# VirtIO Specification References
2+
3+
## Official VirtIO Specifications
4+
5+
### Latest Version (v1.2)
6+
**VirtIO 1.2 Specification** (2022-07-14)
7+
- **Official Link**: https://docs.oasis-open.org/virtio/virtio/v1.2/virtio-v1.2.html
8+
- **PDF**: https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.pdf
9+
- **Status**: OASIS Committee Specification Draft 01
10+
- **Key Features**:
11+
- All features from v1.1
12+
- New devices: Audio, File System, PMEM, RPMB, Video Encoder/Decoder, SCMI, GPIO, RDMA
13+
- Enhanced device specifications
14+
- Better security and performance features
15+
16+
### VirtIO 1.1 Specification (2019-01-29)
17+
- **Official Link**: https://docs.oasis-open.org/virtio/virtio/v1.1/virtio-v1.1.html
18+
- **PDF**: https://docs.oasis-open.org/virtio/virtio/v1.1/csprd01/virtio-v1.1-csprd01.pdf
19+
- **Status**: OASIS Committee Specification Public Review Draft 01
20+
- **Key Features**:
21+
- All features from v1.0
22+
- Packed ring support (VIRTIO_F_RING_PACKED)
23+
- New devices: Socket, Crypto, Signal Distribution Module, IOMMU, Memory
24+
- Order-independent feature negotiation
25+
26+
### VirtIO 1.0 Specification (2016-03-08)
27+
- **Official Link**: https://docs.oasis-open.org/virtio/virtio/v1.0/virtio-v1.0.html
28+
- **PDF**: https://docs.oasis-open.org/virtio/virtio/v1.0/cs04/virtio-v1.0-cs04.pdf
29+
- **Status**: OASIS Committee Specification 04
30+
- **Key Features**:
31+
- Modern interface (version field = 0x2)
32+
- 64-bit feature negotiation
33+
- Separate queue descriptor/driver/device areas
34+
- FEATURES_OK status check
35+
- Better memory alignment requirements
36+
37+
### Legacy VirtIO (v0.95)
38+
- **Reference**: Part of Linux kernel documentation
39+
- **Link**: https://wiki.libvirt.org/VirtIO.html
40+
- **Status**: Legacy interface (version field = 0x1)
41+
- **Note**: Used by older QEMU versions and some embedded systems
42+
43+
## OASIS VirtIO Technical Committee
44+
45+
- **Website**: https://www.oasis-open.org/committees/virtio/
46+
- **Charter**: Defines standard interfaces for virtual I/O devices
47+
- **Mailing List**: [email protected]
48+
- **Git Repository**: https://github.com/oasis-tcs/virtio-spec
49+
50+
## Implementation in RT-Thread
51+
52+
RT-Thread now supports:
53+
-**Legacy VirtIO (v0.95)**: Version field 0x1, 32-bit features, legacy queue setup
54+
-**Modern VirtIO (v1.0+)**: Version field 0x2, 64-bit features, modern queue setup
55+
56+
The implementation follows the VirtIO 1.2 specification for modern devices while maintaining backward compatibility with legacy devices.
57+
58+
## Device-Specific Specifications
59+
60+
### VirtIO Block Device
61+
- **Section**: 5.2 in VirtIO 1.2 spec
62+
- **Features**: Basic block I/O, multiple queues, discard support
63+
- **Status**: Fully implemented in RT-Thread
64+
65+
### VirtIO Network Device
66+
- **Section**: 5.1 in VirtIO 1.2 spec
67+
- **Features**: Ethernet interface, checksum offload, multiple queues
68+
- **Status**: Fully implemented in RT-Thread
69+
70+
### VirtIO Console Device
71+
- **Section**: 5.3 in VirtIO 1.2 spec
72+
- **Features**: Serial console, multiple ports, control messages
73+
- **Status**: Fully implemented in RT-Thread
74+
75+
### VirtIO GPU Device
76+
- **Section**: 5.7 in VirtIO 1.2 spec
77+
- **Features**: 2D graphics, scanout, resource management
78+
- **Status**: Fully implemented in RT-Thread
79+
80+
### VirtIO Input Device
81+
- **Section**: 5.8 in VirtIO 1.2 spec
82+
- **Features**: Keyboard, mouse, tablet input events
83+
- **Status**: Fully implemented in RT-Thread
84+
85+
## QEMU VirtIO Implementation
86+
87+
### QEMU Documentation
88+
- **VirtIO Devices**: https://qemu.readthedocs.io/en/latest/system/devices/virtio-net.html
89+
- **MMIO Transport**: https://qemu.readthedocs.io/en/latest/specs/virtio-mmio.html
90+
91+
### QEMU Version Requirements
92+
- **Legacy VirtIO**: QEMU 1.0+
93+
- **Modern VirtIO**: QEMU 2.4+ (recommended 2.6+)
94+
95+
### QEMU Command Line Examples
96+
97+
**Legacy Mode:**
98+
```bash
99+
qemu-system-riscv64 -M virt \
100+
-device virtio-blk-device,disable-modern=on,drive=blk0
101+
```
102+
103+
**Modern Mode:**
104+
```bash
105+
qemu-system-riscv64 -M virt \
106+
-device virtio-blk-device,disable-legacy=on,drive=blk0
107+
```
108+
109+
**Auto-detect (Default):**
110+
```bash
111+
qemu-system-riscv64 -M virt \
112+
-device virtio-blk-device,drive=blk0
113+
```
114+
115+
## Feature Bits Reference
116+
117+
### Common Features (Section 6 in VirtIO 1.2 spec)
118+
119+
| Bit | Name | Description |
120+
|-----|------|-------------|
121+
| 24 | VIRTIO_F_NOTIFY_ON_EMPTY | Notify on empty available ring |
122+
| 27 | VIRTIO_F_ANY_LAYOUT | Flexible descriptor layout |
123+
| 28 | VIRTIO_F_RING_INDIRECT_DESC | Indirect descriptors |
124+
| 29 | VIRTIO_F_RING_EVENT_IDX | Event index for notifications |
125+
| 32 | VIRTIO_F_VERSION_1 | Compliance with VirtIO 1.0+ |
126+
| 34 | VIRTIO_F_RING_PACKED | Packed ring layout (1.1+) |
127+
128+
### Device-Specific Features
129+
130+
**Block Device:**
131+
- Bit 0: VIRTIO_BLK_F_BARRIER - Legacy barrier support
132+
- Bit 1: VIRTIO_BLK_F_SIZE_MAX - Maximum segment size
133+
- Bit 2: VIRTIO_BLK_F_SEG_MAX - Maximum segments
134+
- Bit 5: VIRTIO_BLK_F_RO - Read-only device
135+
- Bit 9: VIRTIO_BLK_F_FLUSH - Cache flush support
136+
137+
**Network Device:**
138+
- Bit 0: VIRTIO_NET_F_CSUM - Checksum offload
139+
- Bit 1: VIRTIO_NET_F_GUEST_CSUM - Guest checksum
140+
- Bit 5: VIRTIO_NET_F_MAC - MAC address
141+
- Bit 6: VIRTIO_NET_F_GSO - Generic segmentation offload
142+
143+
## Status Bits Reference
144+
145+
| Bit | Name | Description |
146+
|-----|------|-------------|
147+
| 0 | ACKNOWLEDGE | Driver has found the device |
148+
| 1 | DRIVER | Driver knows how to drive the device |
149+
| 2 | DRIVER_OK | Driver is set up and ready |
150+
| 3 | FEATURES_OK | Feature negotiation complete |
151+
| 6 | NEEDS_RESET | Device experienced unrecoverable error |
152+
| 7 | FAILED | Driver gave up on device |
153+
154+
## Additional Resources
155+
156+
### Linux Kernel VirtIO Implementation
157+
- **Source**: https://github.com/torvalds/linux/tree/master/drivers/virtio
158+
- **Documentation**: https://www.kernel.org/doc/Documentation/virtual/
159+
160+
### KVM/QEMU VirtIO
161+
- **KVM Forum**: https://www.linux-kvm.org/page/Virtio
162+
- **QEMU Wiki**: https://wiki.qemu.org/Features/VirtIO
163+
164+
### Books and Papers
165+
- **"Hardware Virtualization: Platforms and Applications"** - Covers VirtIO design
166+
- **"Virtual Machines: Versatile Platforms for Systems and Processes"** - Chapter on I/O virtualization
167+
168+
## RT-Thread Specific Documentation
169+
170+
- **[README.md](README.md)**: RT-Thread VirtIO usage guide
171+
- **[TESTING.md](TESTING.md)**: Testing procedures for both legacy and modern modes
172+
173+
## Version History
174+
175+
| Date | Version | RT-Thread Support | Notes |
176+
|------|---------|------------------|-------|
177+
| 2022-07-14 | 1.2 | ✅ Yes | Latest specification |
178+
| 2019-01-29 | 1.1 | ✅ Yes | Packed ring support |
179+
| 2016-03-08 | 1.0 | ✅ Yes | Modern interface |
180+
| ~2013 | 0.95 | ✅ Yes | Legacy interface (default) |
181+
182+
## Contact and Support
183+
184+
- **RT-Thread Forum**: https://club.rt-thread.io/
185+
- **GitHub Issues**: https://github.com/RT-Thread/rt-thread/issues
186+
- **VirtIO Mailing List**: [email protected]
187+
188+
## License
189+
190+
VirtIO specifications are licensed under:
191+
- OASIS Open Source License (VirtIO 1.0+)
192+
193+
RT-Thread VirtIO driver is licensed under:
194+
- Apache License 2.0

0 commit comments

Comments
 (0)