diff --git a/share/man/man4/virtio.4 b/share/man/man4/virtio.4 --- a/share/man/man4/virtio.4 +++ b/share/man/man4/virtio.4 @@ -53,10 +53,8 @@ The .Nm module provides a shared memory transport called a virtqueue. -The -.Xr virtio_pci -device driver represents an emulated PCI device that the hypervisor makes -available to the VM. +The virtio_pci device driver represents an emulated PCI device that the +hypervisor makes available to the VM. This device provides the probing, configuration, and interrupt notifications needed to interact with the hypervisor. .Fx @@ -92,6 +90,21 @@ .Xr virtio_scsi 4 device driver. .El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width "xxxxxx" +.It Va hw.virtio.pci.disable_msix +If set to 1, disables MSI-X. +The default value is 0. +.It Va hw.virtio.pci.transitional +For a transitional VirtIO device, this tunable specifies whether to negotiate +modern mode and use the modern VirtIO driver (1) or to negotiate legacy mode and +use the legacy driver (0). +The default value is 1. +.El .Sh SEE ALSO .Xr virtio_balloon 4 , .Xr virtio_blk 4 , diff --git a/sys/dev/virtio/pci/virtio_pci.c b/sys/dev/virtio/pci/virtio_pci.c --- a/sys/dev/virtio/pci/virtio_pci.c +++ b/sys/dev/virtio/pci/virtio_pci.c @@ -97,8 +97,13 @@ MODULE_DEPEND(virtio_pci, pci, 1, 1, 1); MODULE_DEPEND(virtio_pci, virtio, 1, 1, 1); +SYSCTL_DECL(_hw_virtio); +SYSCTL_NODE(_hw_virtio, OID_AUTO, pci, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "VirtIO PCI driver parameters"); + int vtpci_disable_msix = 0; -TUNABLE_INT("hw.virtio.pci.disable_msix", &vtpci_disable_msix); +SYSCTL_INT(_hw_virtio_pci, OID_AUTO, disable_msix, CTLFLAG_RDTUN, + &vtpci_disable_msix, 0, "If set to 1, disables MSI-X."); static uint8_t vtpci_read_isr(struct vtpci_common *cn) diff --git a/sys/dev/virtio/pci/virtio_pci_modern.c b/sys/dev/virtio/pci/virtio_pci_modern.c --- a/sys/dev/virtio/pci/virtio_pci_modern.c +++ b/sys/dev/virtio/pci/virtio_pci_modern.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -188,8 +189,12 @@ bus_size_t, uint64_t); /* Tunables. */ +SYSCTL_DECL(_hw_virtio_pci); + static int vtpci_modern_transitional = 0; -TUNABLE_INT("hw.virtio.pci.transitional", &vtpci_modern_transitional); +SYSCTL_INT(_hw_virtio_pci, OID_AUTO, transitional, CTLFLAG_RDTUN, + &vtpci_modern_transitional, 0, + "For a transitional VirtIO device, this tunable specifies whether to negotiate modern mode and use the modern VirtIO driver (1) or to negotiate legacy mode and use the legacy driver (0)."); static device_method_t vtpci_modern_methods[] = { /* Device interface. */ diff --git a/sys/dev/virtio/virtio.c b/sys/dev/virtio/virtio.c --- a/sys/dev/virtio/virtio.c +++ b/sys/dev/virtio/virtio.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -90,6 +91,9 @@ { 0, NULL } }; +SYSCTL_NODE(_hw, OID_AUTO, virtio, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "VirtIO driver parameters"); + const char * virtio_device_name(uint16_t devid) {