[virtio] Add modern VirtIO (v1.0-1.2) support with backward compatibility#11021
[virtio] Add modern VirtIO (v1.0-1.2) support with backward compatibility#11021
Conversation
|
|
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
- Updated Kconfig to support both legacy and modern versions - Added version field to virtio_device structure - Implemented 64-bit feature negotiation for modern virtio - Updated queue initialization for modern virtio (separate desc/driver/device areas) - Added FEATURES_OK check for modern virtio - Updated all device drivers (blk, net, console, gpu, input) to use new APIs - Updated BSP drivers to accept both version 1 (legacy) and version 2 (modern) Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com>
…ibility - Added README.md with usage guide and migration instructions - Updated Kconfig to keep RT_USING_VIRTIO10 as alias for backward compatibility - Documented key differences between legacy and modern VirtIO - Added troubleshooting and contributing guidelines Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com>
📌 Code Review Assignment🏷️ Tag: componentsReviewers: Maihuanyi Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2025-12-05 06:45 CST)
📝 Review Instructions
|
- Added TESTING.md with test procedures for legacy and modern VirtIO - Documented QEMU command lines for both modes - Included device-specific testing instructions - Added debugging tips and common issues section Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com>
- 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 <1241087+BernardXiong@users.noreply.github.com>
[cpp_check.py 80 INFO] bsp/qemu-virt64-aarch64/drivers/drv_virtio.c:83:12: error: Syntax Error: AST broken, 'if' doesn't have two operands. [internalAstError]
if (mmio_config->version != 1 && mmio_config->version != 2)
^
[cpp_check.py 80 INFO] bsp/qemu-virt64-riscv/driver/drv_virtio.c:89:12: error: Syntax Error: AST broken, 'if' doesn't have two operands. [internalAstError]
if (mmio_config->version != 1 && mmio_config->version != 2)
^ |
…check - Removed TESTING.md and SPECIFICATIONS.md as requested - Simplified README.md with essential information only - Added Chinese version README_zh.md with language links - Fixed cppcheck AST error by rewriting version check condition - Changed from (version != 1 && version != 2) to ((version < 1) || (version > 2)) Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com>
All requested changes completed in commit a45ccc6:
The documentation is now simplified with only essential information, and both English and Chinese versions are available. |
你好,请签一下协议 |
|
virtio DM 已经重构了 |
请给出更多的信息,例如PR号,issue或代码的链接,谢谢 |
|
由于 qemu-virt64-riscv 依赖 virtio,而 riscv 的 dm 支持尚不完善,目前 virtio dm 暂没有 pr,主要更新内容如下:
如果当前 PR 是需要对 virtio 版本进行升级,可以考虑等等。 |
是的,这份PR是由github copilot根据 #11001 的情况来对virtio进行升级(并保留对原virtio的支持)。也可以针对这份PR进行review,并给指令 at copilot 进行调整。 |
拉取/合并请求描述:(PR description)
为什么提交这份PR (why to submit this PR)
Current VirtIO driver only supports legacy v0.95 (version field 0x1). Modern QEMU defaults to VirtIO 1.0+ (version field 0x2) which uses 64-bit feature negotiation, separate queue areas, and enhanced status checks. Without modern support, devices fail to initialize on recent QEMU versions.
你的解决方案是什么 (what is your solution)
Core Changes:
device_features_sel/driver_features_selregistersVIRTIO_F_VERSION_1feature when version==2Key Implementation:
Backward Compatibility:
Affected Drivers:
Configuration:
Documentation:
README.md: Simplified usage guide with essential information (English)README_zh.md: Chinese version with language switching linksCode Quality Fixes:
(version != 1 && version != 2)to((version < 1) || (version > 2))请提供验证的bsp和config (provide the config and bsp)
BSP:
bsp/qemu-virt64-riscv,bsp/qemu-virt64-aarch64.config:
QEMU Test Commands:
Files Changed: 13 files
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned upOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.