Documentation/driver-api/virtio/virtio.rst

Source file repositories/reference/linux-study-clean/Documentation/driver-api/virtio/virtio.rst

File Facts

System
Linux kernel
Corpus path
Documentation/driver-api/virtio/virtio.rst
Extension
.rst
Size
5364 bytes
Lines
146
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

if (force_legacy) {
			rc = virtio_pci_legacy_probe(vp_dev);
			/* Also try modern mode if we can't map BAR0 (no IO space). */
			if (rc == -ENODEV || rc == -ENOMEM)
				rc = virtio_pci_modern_probe(vp_dev);
			if (rc)
				goto err_probe;
		} else {
			rc = virtio_pci_modern_probe(vp_dev);
			if (rc == -ENODEV)
				rc = virtio_pci_legacy_probe(vp_dev);
			if (rc)
				goto err_probe;
		}

		...

		rc = register_virtio_device(&vp_dev->vdev);

When the device is registered to the virtio bus the kernel will look
for a driver in the bus that can handle the device and call that
driver's ``probe`` method.

At this point, the virtqueues will be allocated and configured by
calling the appropriate ``virtio_find`` helper function, such as
virtio_find_single_vq() or virtio_find_vqs(), which will end up calling
a transport-specific ``find_vqs`` method.


References
==========

_`[1]` Virtio Spec v1.2:
https://docs.oasis-open.org/virtio/virtio/v1.2/virtio-v1.2.html

.. Check for later versions of the spec as well.

_`[2]` Virtqueues and virtio ring: How the data travels
https://www.redhat.com/en/blog/virtqueues-and-virtio-ring-how-data-travels

.. rubric:: Footnotes

.. [#f1] that's why they may be also referred to as virtrings.

Annotation

Implementation Notes