From nobody Sun Apr 26 09:22:10 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4g3LnN0Tw8z6bLw1 for ; Sun, 26 Apr 2026 09:22:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g3LnM6DcSz4KMZ for ; Sun, 26 Apr 2026 09:22:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777195335; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uxl7P+qbqwyarUlfAFp/M8ptsPulgvYUocJegbSShVc=; b=EMk/odLWx9P4aZRhlLCmeWsQBNWXfluavX8kYKdqNZji3vQ2MQr3jbGIFZRIGaJUSOMEqN /exB2iN+cY5HMSGzr72jAxvKs+ICeqYmYf2Nj3YAlxpi4rVOZY5V2PhFuskO7wmKAucQGW 26YgUJQPr9LUEFWVti/Tf5uIvMB/+v6cx6yJg+ivNB86vdmZMpZCIeP26eo6yIsygio90l snQma07jOlbMonXKjjzk5YgfRZJhO8oJ6i3x8N4FmfQJL2pdJZ6lN0A58FCOBE8O7rGI+L 0qGsrHpNe0TKO7/BmagOE7TmFXFW4VWxzQM1J6xTQCb+DYn4UBbBM2M+wJN0hQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777195335; a=rsa-sha256; cv=none; b=cFQbWMyxsC1UYuKukp7jiJNN50xbxSwCenB1qBQ+oIB/GLgEZahLPOHKJltDp2PI0NHwWX zfWc+F+5Uo95GDaOvhoNmq1HTvhnXlncB4We1Sr5+fyJ912sJLr8eWCFHINGyhXD1sOXKZ xq4vV2Ij5fjxziW4MIJ1tZ5bwL2MKc/sR+xYO++O3LFWY1avHWQN/vQi9BOr4mhpgLnAgJ PwpIPg/0Qz8UZhPX8dRM+9VQt3RcorkIuXZHxYIEzucUSaSjWsysJFPedWxIoB1NrcvSZc H2NYCbsaAwfdQIFggjGagYm92mGO8e5j3eelB46xaHnbJ2hJD9SnLq4lDLGudA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777195335; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uxl7P+qbqwyarUlfAFp/M8ptsPulgvYUocJegbSShVc=; b=NXQHlwWq2uH+fjttzvx3P/eG+0awzG2mVAhsG1uIMTfGdmgvOQVzPkfJc3TiRR7ejHsBCt CO9nWQyRg6ZY+pEXtE0alJpwPhUiWdGX1srr8y5hhVJOiVN7pZ1tTvQfcQnjIpdMdu5RCf HfcKjfXDR684NHmYfO4uzwexp1fse3cW/QSoIgpzqrHPHgwqAT1cZdCViPFSMNBWjuG5U7 kb0VCDelJxSV1bwuxkRsqytojSZzDt3J5mA5uuPOSXLNG/aYWg/8F/lliXal8rdlhCKuHA c2wJWixqhctKpn2SRO/9XHGlMk9kbiimBILdRUjY7K3TK7/G9gu/tiRE+bk/cQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g3LnM46hKz1Cr1 for ; Sun, 26 Apr 2026 09:22:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 38c08 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 26 Apr 2026 09:22:10 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Timo =?utf-8?Q?V=C3=B6lker?= From: Michael Tuexen Subject: git: 32f8c7821394 - stable/14 - virtio: add loader tunables to sysctl List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 32f8c7821394b3be2d97641dbe8bf8962e2bb90a Auto-Submitted: auto-generated Date: Sun, 26 Apr 2026 09:22:10 +0000 Message-Id: <69edd942.38c08.5c5d6f7@gitrepo.freebsd.org> The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=32f8c7821394b3be2d97641dbe8bf8962e2bb90a commit 32f8c7821394b3be2d97641dbe8bf8962e2bb90a Author: Timo Völker AuthorDate: 2026-03-02 18:15:37 +0000 Commit: Michael Tuexen CommitDate: 2026-04-26 07:20:41 +0000 virtio: add loader tunables to sysctl virtio_pci uses two loader tunables that should be more visible. This patch adds these loader tunables to sysctl and describes them in the virtio(4) man page. Reviewed by: imp (erlier version), tuexen Differential Revision: https://reviews.freebsd.org/D55533 Event: Wiesbaden Hackathon 2026 (cherry picked from commit c70755bc0d8f703dbaa1520c15e8213a95847dd5) --- share/man/man4/virtio.4 | 28 ++++++++++++++++++++++++++-- sys/dev/virtio/pci/virtio_pci.c | 7 ++++++- sys/dev/virtio/pci/virtio_pci_modern.c | 7 ++++++- sys/dev/virtio/virtio.c | 4 ++++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/share/man/man4/virtio.4 b/share/man/man4/virtio.4 index 1e5ea0e4a7da..0598d5d8621d 100644 --- a/share/man/man4/virtio.4 +++ b/share/man/man4/virtio.4 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 26, 2019 +.Dd March 2, 2026 .Dt VIRTIO 4 .Os .Sh NAME @@ -54,7 +54,7 @@ The .Nm module provides a shared memory transport called a virtqueue. The -.Xr virtio_pci +.Sy virtio_pci device driver represents an emulated PCI device that the hypervisor makes available to the VM. This device provides the probing, configuration, and @@ -92,6 +92,30 @@ An emulated SCSI HBA is provided by the .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 "hw.virtio.pci.transitional" +.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 +.Nm +device, this tunable specifies whether to negotiate +modern mode and use the modern +.Nm +driver +.Pq 1 +or to negotiate legacy mode and +use the legacy +.Nm +driver +.Pq 1 . +The default value is 0. +.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 index 4849affae58c..451a93d11759 100644 --- a/sys/dev/virtio/pci/virtio_pci.c +++ b/sys/dev/virtio/pci/virtio_pci.c @@ -98,8 +98,13 @@ MODULE_VERSION(virtio_pci, 1); 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 index 2e59448b4b5e..2c54288aefba 100644 --- a/sys/dev/virtio/pci/virtio_pci_modern.c +++ b/sys/dev/virtio/pci/virtio_pci_modern.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -189,8 +190,12 @@ static void vtpci_modern_write_device_8(struct vtpci_modern_softc *, 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, + "If 0, a transitional VirtIO device is used in legacy mode; otherwise, in modern mode."); static device_method_t vtpci_modern_methods[] = { /* Device interface. */ diff --git a/sys/dev/virtio/virtio.c b/sys/dev/virtio/virtio.c index 0637e0299333..14dad88b3f6d 100644 --- a/sys/dev/virtio/virtio.c +++ b/sys/dev/virtio/virtio.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -84,6 +85,9 @@ static struct virtio_feature_desc virtio_common_feature_desc[] = { { 0, NULL } }; +SYSCTL_NODE(_hw, OID_AUTO, virtio, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "VirtIO driver parameters"); + const char * virtio_device_name(uint16_t devid) {