Skip to content

drivers: virtio: add VIRTIO MMIO transport driver #89460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 7, 2025

Conversation

soburi
Copy link
Member

@soburi soburi commented May 5, 2025

Adds a virtio-mmio driver that is based on the virtio-pci design from #83892.

This is worked with virtio-rng driver
#89439

And it works with the same API as virtio-pci.

@soburi soburi changed the title drivers: virtio: add VirtIO MMIO transport driver [DRAFT] drivers: virtio: add VirtIO MMIO transport driver May 5, 2025
@soburi soburi added area: Virtualization DNM This PR should not be merged (Do Not Merge) labels May 5, 2025
@soburi soburi marked this pull request as ready for review May 5, 2025 04:16
@soburi soburi requested review from fkokosinski and cfriedt May 5, 2025 04:20
@soburi soburi force-pushed the virtio-mmio branch 4 times, most recently from 9c59b55 to 7f6a6ba Compare May 5, 2025 21:36
@soburi soburi requested a review from Copilot May 6, 2025 00:48
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new VirtIO MMIO transport driver, mirroring the existing VirtIO PCI driver design and integrating it with the entropy (rng) driver.

  • Adds VirtIO API definitions and inline functions in include/zephyr/virtio/virtio.h
  • Introduces new DTS bindings for virtio, mmio and updates for virtio over PCI and entropy devices
  • Implements virtqueue handling in drivers/virtio/virtqueue.c and adds the virtio entropy driver in drivers/entropy/entropy_virtio.c

Reviewed Changes

Copilot reviewed 22 out of 35 changed files in this pull request and generated no comments.

Show a summary per file
File Description
include/zephyr/virtio/virtio.h Introduces the VirtIO API and inline helpers
dts/bindings/virtio/virtio,pci.yaml Adds DTS binding for VirtIO over PCI
dts/bindings/virtio/virtio,mmio.yaml Adds DTS binding for VirtIO over MMIO
dts/bindings/rng/virtio,entropy.yaml Adds DTS binding for VirtIO entropy device
drivers/virtio/virtqueue.c Implements virtqueue creation and management
drivers/entropy/entropy_virtio.c Implements the VirtIO entropy driver
MAINTAINERS.yml Updates maintainers and labels for VirtIO area
Files not reviewed (13)
  • boards/qemu/cortex_a53/board.cmake: Language not supported
  • boards/qemu/cortex_a53/qemu_cortex_a53.dts: Language not supported
  • boards/qemu/x86/board.cmake: Language not supported
  • doc/hardware/index.rst: Language not supported
  • doc/hardware/virtualization/index.rst: Language not supported
  • doc/hardware/virtualization/virtio.rst: Language not supported
  • drivers/CMakeLists.txt: Language not supported
  • drivers/Kconfig: Language not supported
  • drivers/entropy/CMakeLists.txt: Language not supported
  • drivers/entropy/Kconfig: Language not supported
  • drivers/entropy/Kconfig.virtio: Language not supported
  • drivers/virtio/CMakeLists.txt: Language not supported
  • drivers/virtio/Kconfig: Language not supported

@tomi-font tomi-font removed their request for review May 19, 2025 07:38
soburi added 2 commits June 5, 2025 17:29
Since `VirtIO` is not the official notation,
unify the name to `VIRTIO`.
In the text, `Virtio` and `virtio` can also be used
depending on the context.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Add virtio-mmio driver

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
@soburi soburi changed the title [DRAFT] drivers: virtio: add VirtIO MMIO transport driver drivers: virtio: add VIRTIO MMIO transport driver Jun 5, 2025
soburi added 3 commits June 5, 2025 17:42
Add `virtio-mmio` nodes that are retrieved from qemu internal
devicetree dump, to dts.

Also, enable the virtio-rng device on the command line.

Note: Ideally, it would be possible to dynamically generate the
command line by looking at the devicetree state,
but this PR is a fixed implementation to simplify it.
This will be addressed separately.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Add the `qemu_cortex_a53` configuration to run the build test
for the VIRTIO MMIO driver.
To add this test, we have split the virtio-pci and virtio-mmio test cases.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Add `qemu_cortex_a53` target which has the `virtio,entropy` device.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Copy link

sonarqubecloud bot commented Jun 5, 2025

@soburi soburi removed the DNM This PR should not be merged (Do Not Merge) label Jun 5, 2025
@soburi soburi requested a review from fkokosinski June 5, 2025 09:18
@soburi
Copy link
Member Author

soburi commented Jun 5, 2025

@fkokosinski @ceolin @cfriedt @kartben

Continuing from #89439, could you please review this PR?

Copy link
Member

@fkokosinski fkokosinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VIRTIO MMIO LGTM

Copy link
Member

@cfriedt cfriedt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fabiobaltieri fabiobaltieri merged commit 77d1276 into zephyrproject-rtos:main Jun 7, 2025
29 of 30 checks passed
@soburi soburi deleted the virtio-mmio branch June 7, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants