From 8a7b4721a1bb424d507ae72b75941e97133ff83f Mon Sep 17 00:00:00 2001 From: Jakub Michalski Date: Tue, 22 Apr 2025 11:07:20 +0200 Subject: [PATCH] docs: virtio: add section about available drivers and samples This commit adds sections to the virtio docs with the currently supported transfer methods, drivers and samples Signed-off-by: Jakub Michalski --- doc/hardware/virtualization/virtio.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/hardware/virtualization/virtio.rst b/doc/hardware/virtualization/virtio.rst index 9c67ad26e3f..12f35c3700d 100644 --- a/doc/hardware/virtualization/virtio.rst +++ b/doc/hardware/virtualization/virtio.rst @@ -123,6 +123,31 @@ virtqueue has to be acquired using :c:func:`virtio_get_virtqueue`. To send data will be invoked once the device returns the given descriptor chain. After that, the virtqueue has to be notified using :c:func:`virtio_notify_virtqueue` from the Virtio API. +Guest-side Virtio drivers +************************* +Currently Zephyr provides drivers for Virtio over PCI and Virtio over MMIO and drivers for two devices using virtio - virtiofs, used +to access the filesystem of the host and virtio-entropy, used as an entropy source. + +Virtiofs +========= +This driver provides support for `virtiofs `_ - a filesystem allowing a virtual machine guest to access +a directory on the host. It uses FUSE messages to communicate between the host and the guest in order to perform filesystem operations such as +opening and reading files. Every time the guest wants to perform some filesystem operation it places in the virtqueue a descriptor chain +starting with the device readable part, containing the FUSE input header and input data, and ending it with the device writeable part, with place +for the FUSE output header and output data. + +Virtio-entropy +============== +This driver allows using virtio-entropy as an entropy source in Zephyr. The operation of this device is simple - the driver places a +buffer in the virtqueue and receives it back, filled with random data. + +Virtio samples +************** +A sample showcasing the use of a driver relying on Virtio is provided in :zephyr:code-sample:`virtiofs`. If you wish +to check code interfacing directly with the Virtio driver, you can check the virtiofs driver, especially :c:func:`virtiofs_init` +for initialization and :c:func:`virtiofs_send_receive` with the :c:func:`virtiofs_recv_cb` for data transfer to/from +the Virtio device. + API Reference *************