|
|
3 ヶ月 前 | |
|---|---|---|
| .. | ||
| Kconfig | 3 ヶ月 前 | |
| README.md | 3 ヶ月 前 | |
| SConscript | 3 年 前 | |
| SPECIFICATIONS.md | 3 ヶ月 前 | |
| TESTING.md | 3 ヶ月 前 | |
| virtio.c | 3 ヶ月 前 | |
| virtio.h | 3 ヶ月 前 | |
| virtio_blk.c | 3 ヶ月 前 | |
| virtio_blk.h | 2 年 前 | |
| virtio_console.c | 3 ヶ月 前 | |
| virtio_console.h | 2 年 前 | |
| virtio_gpu.c | 3 ヶ月 前 | |
| virtio_gpu.h | 2 年 前 | |
| virtio_input.c | 3 ヶ月 前 | |
| virtio_input.h | 2 年 前 | |
| virtio_input_event_codes.h | 2 年 前 | |
| virtio_mmio.h | 2 年 前 | |
| virtio_net.c | 3 ヶ月 前 | |
| virtio_net.h | 2 年 前 | |
| virtio_queue.h | 2 年 前 | |
The VirtIO driver provides support for virtual I/O devices in RT-Thread, primarily used in virtualized environments like QEMU.
The driver now supports both legacy and modern VirtIO specifications:
Use menuconfig to configure VirtIO support:
RT-Thread Components → Device Drivers → Using VirtIO device drivers
Choose between legacy and modern VirtIO:
RT-Thread Components → Device Drivers → Using VirtIO device drivers → VirtIO Version
Options:
Enable individual VirtIO devices:
RT-Thread Components → Device Drivers → Using VirtIO device drivers
RT_USING_VIRTIO_BLK: VirtIO block device supportRT_USING_VIRTIO_NET: VirtIO network device supportRT_USING_VIRTIO_CONSOLE: VirtIO console device supportRT_USING_VIRTIO_GPU: VirtIO GPU device supportRT_USING_VIRTIO_INPUT: VirtIO input device supportChange the VirtIO version in menuconfig:
RT-Thread Components → Device Drivers → Using VirtIO device drivers → VirtIO Version
→ Select "VirtIO Modern (v1.0+)"
Rebuild your application
The driver will automatically negotiate the VERSION_1 feature with the device
The driver automatically detects the device version from the MMIO config and adapts its behavior accordingly. Both legacy (version 0x1) and modern (version 0x2) devices are supported in the same build.
The following BSPs have been updated to support both legacy and modern VirtIO:
qemu-virt64-riscv: QEMU RISC-V 64-bitqemu-virt64-aarch64: QEMU ARM64 (AArch64)Modern VirtIO uses 64-bit feature negotiation:
device_features register (selected by device_features_sel)driver_features register (selected by driver_features_sel)VIRTIO_F_VERSION_1 (feature bit 32)Legacy VirtIO:
queue_pfn register pointing to the start of the queue areaguest_page_sizeModern VirtIO:
queue_desc_low/queue_desc_high: Descriptor table addressqueue_driver_low/queue_driver_high: Available ring addressqueue_device_low/queue_device_high: Used ring addressqueue_ready registerModern VirtIO adds FEATURES_OK check:
Check that:
Ensure:
BSP_USING_VIRTIO)Debug tips:
When adding new VirtIO devices or features:
virtio_get_features, virtio_set_features)dev->version) for version-specific codeApache-2.0