VirtIO: Difference between revisions

From FriendOS Wiki
Jump to navigation Jump to search
No edit summary
m (Actually, 1.3 is latest, not 1.2)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
VirtIO is a standard for performant virtualized hardware for use within virtual machines, created and managed by the [https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=virtio OASIS Open Virtual I/O Device TC]. VirtIO supports a variety of devices, such as, but not limited to: block (e.g. hard drive), network card, GPU, etc. Each of these devices have their own specific configuration and features, but all use the same underlying VirtIO queue structure for relaying data and commands to & from the device.
VirtIO is a standard for performant virtualized hardware for use within virtual machines, created and managed by the [https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=virtio OASIS Open Virtual I/O Device TC]. VirtIO supports a variety of devices, such as, but not limited to: block (e.g. hard drive), network card, GPU, etc. Each of these devices have their own specific configuration and features, but all use the same underlying VirtIO queue structure for relaying data and commands to & from the device.
The latest specification, 1.3, is available at https://docs.oasis-open.org/virtio/virtio/v1.3/csd01/virtio-v1.3-csd01.html.
VirtIO provides a common framework for devices to be identified and for communicating between the device implementation and the driver.
Communication for is handled through so-called ''virtqueues''.
Certain implementations extend the features available.
For example, here is the list of virtio-gpu capsets in Mesa, at <code>src/gfxstream/guest/platform/include/virtgpu_gfxstream_protocol.h</code>:
<pre>
#define VIRTGPU_CAPSET_VIRGL 1
#define VIRTGPU_CAPSET_VIRGL2 2
#define VIRTGPU_CAPSET_GFXSTREAM_VULKAN 3
#define VIRTGPU_CAPSET_VENUS 4
#define VIRTGPU_CAPSET_CROSS_DOMAIN 5
#define VIRTGPU_CAPSET_DRM 6
#define VIRTGPU_CAPSET_GFXSTREAM_MAGMA 7
#define VIRTGPU_CAPSET_GFXSTREAM_GLES 8
#define VIRTGPU_CAPSET_GFXSTREAM_COMPOSER 9
</pre>
virtio-gpu can be used to forward various things to Linux hosts, such as native Wayland surfaces, or Linux drm ioctls. Commonly this is used with Linux guests, but there's nothing preventing usage in any other OS running as guest.


=== Device Types ===
=== Device Types ===
{| class="wikitable sortable mw-collapsible"
{| class="wikitable sortable mw-collapsible"
|+VirtIO Device Types
|+VirtIO Device Types
!Device ID
!Device Name
!Device Name
!Device ID
!Description
!Description
|-
|-
|Network Card
|0
|reserved (invalid)
| TODO
|-
|1
|1
|Ethernet network interface
|network card
| TODO
|-
|-
|Block Device
|2
|2
|Block storage capabilities, e.g. hard drive, for storing files and other information
|block device
| TODO
|-
|-
|Console
|3
|3
|Serial console device for simple I/O communication
|console
| TODO
|-
|-
|Entropy Source
|4
|4
|A source of entropy for cryptographically secure [[PRNG]]<nowiki/>s
|entropy source
| TODO
|-
|-
|Memory Ballooning (Traditional)
|5
|5
|[TODO]
|memory ballooning (traditional)
| TODO
|-
|-
|6
|ioMemory
|ioMemory
|6
| TODO
|[TODO]
|-
|-
|7
|rpmsg
|rpmsg
|7
| TODO
|[TODO]
|-
|-
|SCSI Host
|8
|8
|Grouping of one or more virtual logical units (e.g. disks) that can be managed via the SCSI protocol
|SCSI host
| TODO
|-
|-
|9P Transport
|9
|9
|[TODO]
|9P transport
| TODO
|-
|-
|MAC80211 WLAN
|10
|10
|802.11 WLAN interface for wireless [[LAN]] communication
|mac80211 wlan
| TODO
|-
|-
|rproc Serial
|11
|11
|[TODO]
|rproc serial
| TODO
|-
|-
|VirtIO CAIF
|12
|12
|[TODO]
|virtio CAIF
| TODO
|-
|-
|Memory Balloon
|13
|13
|[TODO]
|memory balloon
| TODO
|-
|-
|GPU
|16
|16
|2D & 3D GPU device, requires a 3D GPU on the host machine for 3D mode, as well as negotiating specific features
|GPU device
| TODO
|-
|17
|Timer/Clock device
| TODO
|-
|18
|Input device
| TODO
|-
|19
|Socket device
| TODO
|-
|20
|Crypto device
| TODO
|-
|21
|Signal Distribution Module
| TODO
|-
|22
|pstore device
| TODO
|-
|23
|IOMMU device
| TODO
|-
|24
|Memory device
| TODO
|-
|25
|Audio device
| TODO
|-
|26
|file system device
| TODO
|-
|27
|PMEM device
| TODO
|-
|28
|RPMB device
| TODO
|-
|29
|mac80211 hwsim wireless simulation device
| TODO
|-
|30
|Video encoder device
| TODO
|-
|31
|Video decoder device
| TODO
|-
|32
|SCMI device
| TODO
|-
|33
|NitroSecureModule
| TODO
|-
|34
|I2C adapter
| TODO
|-
|35
|Watchdog
| TODO
|-
|36
|CAN device
| TODO
|-
|38
|Parameter Server
| TODO
|-
|39
|Audio policy device
| TODO
|-
|40
|Bluetooth device
| TODO
|-
|-
|
|41
|
|GPIO device
|
| TODO
|-
|-
|
|42
|
|RDMA device
|
| TODO
|-
|-
|
 
|
 
|
|}
|}


=== Device Transports ===
=== Device Transports ===
VirtIO supports three different types of device transports: [[PCI|PCI Bus]], [[MMIO]], and [[Channel I/O]]. The PCIe transport is configured via the normal PCIe configuration mechanisms, while the MMIO transport is configured strictly via MMIO reads and writes.
VirtIO supports three different types of device transports: [[PCI|PCI Bus]], [[MMIO]], and [[Channel I/O]]. The PCIe transport is configured via the normal PCIe configuration mechanisms, while the MMIO transport is configured strictly via MMIO reads and writes.

Latest revision as of 01:39, 19 December 2024

VirtIO is a standard for performant virtualized hardware for use within virtual machines, created and managed by the OASIS Open Virtual I/O Device TC. VirtIO supports a variety of devices, such as, but not limited to: block (e.g. hard drive), network card, GPU, etc. Each of these devices have their own specific configuration and features, but all use the same underlying VirtIO queue structure for relaying data and commands to & from the device.

The latest specification, 1.3, is available at https://docs.oasis-open.org/virtio/virtio/v1.3/csd01/virtio-v1.3-csd01.html.

VirtIO provides a common framework for devices to be identified and for communicating between the device implementation and the driver. Communication for is handled through so-called virtqueues.

Certain implementations extend the features available.

For example, here is the list of virtio-gpu capsets in Mesa, at src/gfxstream/guest/platform/include/virtgpu_gfxstream_protocol.h:

#define VIRTGPU_CAPSET_VIRGL 1
#define VIRTGPU_CAPSET_VIRGL2 2
#define VIRTGPU_CAPSET_GFXSTREAM_VULKAN 3
#define VIRTGPU_CAPSET_VENUS 4
#define VIRTGPU_CAPSET_CROSS_DOMAIN 5
#define VIRTGPU_CAPSET_DRM 6
#define VIRTGPU_CAPSET_GFXSTREAM_MAGMA 7
#define VIRTGPU_CAPSET_GFXSTREAM_GLES 8
#define VIRTGPU_CAPSET_GFXSTREAM_COMPOSER 9

virtio-gpu can be used to forward various things to Linux hosts, such as native Wayland surfaces, or Linux drm ioctls. Commonly this is used with Linux guests, but there's nothing preventing usage in any other OS running as guest.

Device Types

VirtIO Device Types
Device ID Device Name Description
0 reserved (invalid) TODO
1 network card TODO
2 block device TODO
3 console TODO
4 entropy source TODO
5 memory ballooning (traditional) TODO
6 ioMemory TODO
7 rpmsg TODO
8 SCSI host TODO
9 9P transport TODO
10 mac80211 wlan TODO
11 rproc serial TODO
12 virtio CAIF TODO
13 memory balloon TODO
16 GPU device TODO
17 Timer/Clock device TODO
18 Input device TODO
19 Socket device TODO
20 Crypto device TODO
21 Signal Distribution Module TODO
22 pstore device TODO
23 IOMMU device TODO
24 Memory device TODO
25 Audio device TODO
26 file system device TODO
27 PMEM device TODO
28 RPMB device TODO
29 mac80211 hwsim wireless simulation device TODO
30 Video encoder device TODO
31 Video decoder device TODO
32 SCMI device TODO
33 NitroSecureModule TODO
34 I2C adapter TODO
35 Watchdog TODO
36 CAN device TODO
38 Parameter Server TODO
39 Audio policy device TODO
40 Bluetooth device TODO
41 GPIO device TODO
42 RDMA device TODO

Device Transports

VirtIO supports three different types of device transports: PCI Bus, MMIO, and Channel I/O. The PCIe transport is configured via the normal PCIe configuration mechanisms, while the MMIO transport is configured strictly via MMIO reads and writes.