git: 8bdc312dac55 - main - virtio: Accept VIRTIO_F_RING_RESET in the modern PCI transport

From: Enji Cooper <ngie_at_FreeBSD.org>
Date: Wed, 15 Jul 2026 06:57:45 UTC
The branch main has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=8bdc312dac550c292c58a6a3243b08bc8c944b74

commit 8bdc312dac550c292c58a6a3243b08bc8c944b74
Author:     Faraz Vahedi <kfv@kfv.io>
AuthorDate: 2026-07-09 20:01:44 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-07-15 06:57:40 +0000

    virtio: Accept VIRTIO_F_RING_RESET in the modern PCI transport
    
    Accept per-virtqueue reset when the device offers it, alongside
    the V1 flag.  Negotiating the feature merely permits the use of
    per-virtqueue reset and imposes no obligation on a driver that
    never uses it, while refusing capability-only transport features
    can make strict devices reject the feature set altogether.
    
    No functional change on hosts that do not offer RING_RESET.
    
    Signed-off-by: Faraz Vahedi <kfv@kfv.io>
    Reviewed-by: ngie
    Pull-Request: https://github.com/freebsd/freebsd-src/pull/2319
---
 sys/dev/virtio/pci/virtio_pci_modern.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys/dev/virtio/pci/virtio_pci_modern.c b/sys/dev/virtio/pci/virtio_pci_modern.c
index 4a4fedeb194d..6732f9ee610f 100644
--- a/sys/dev/virtio/pci/virtio_pci_modern.c
+++ b/sys/dev/virtio/pci/virtio_pci_modern.c
@@ -441,6 +441,14 @@ vtpci_modern_negotiate_features(device_t dev, uint64_t child_features)
 	 */
 	child_features |= VIRTIO_F_VERSION_1;
 
+	/*
+	 * Accept per-virtqueue reset if the device offers it: negotiating
+	 * the feature carries no obligation for a driver that never uses
+	 * it, while declining capability-only transport features can make
+	 * strict devices refuse the entire feature set.
+	 */
+	child_features |= host_features & VIRTIO_F_RING_RESET;
+
 	features = vtpci_negotiate_features(&sc->vtpci_common,
 	    child_features, host_features);
 	vtpci_modern_write_features(sc, features);