Index | Thread | Search

From:
Leander Kohler <leander.kohler@cyberus-technology.de>
Subject:
[PATCH] vio: Restore device status after negotiation reset
To:
tech@openbsd.org
Cc:
Leander Kohler <leander.kohler@cyberus-technology.de>
Date:
Thu, 8 Oct 2026 12:06:47 +0200

Download raw body.

Thread
The TSO and MTU fallback paths reset the device before renegotiating
features. Reset clears all status bits, but these paths do not restore
ACKNOWLEDGE and DRIVER before setting FEATURES_OK and DRIVER_OK.
This violates the initialization sequence required by Virtio ยง3.1.1 [0].

We restore both bits after each fallback reset. This addresses one
incompatibility with the Cloud Hypervisor VMM, which requires the
complete initialization status before activating the device.

[0] https://docs.oasis-open.org/virtio/virtio/v1.4/cs01/virtio-v1.4-cs01.html

On-behalf-of: SAP leander.kohler@sap.com
Signed-off-by: Leander Kohler <leander.kohler@cyberus-technology.de>
---
 sys/dev/pv/if_vio.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git sys/dev/pv/if_vio.c sys/dev/pv/if_vio.c
index 8942b02857a..cb1dd8bf003 100644
--- sys/dev/pv/if_vio.c
+++ sys/dev/pv/if_vio.c
@@ -685,6 +685,8 @@ negotiate:
 		 */
 		want_tso = 0;
 		virtio_reset(vsc);
+		virtio_set_status(vsc, VIRTIO_CONFIG_DEVICE_STATUS_ACK);
+		virtio_set_status(vsc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER);
 		goto negotiate;
 	}
 
@@ -702,6 +704,8 @@ negotiate:
 			device_mtu = 0;
 			want_mtu = 0;
 			virtio_reset(vsc);
+			virtio_set_status(vsc, VIRTIO_CONFIG_DEVICE_STATUS_ACK);
+			virtio_set_status(vsc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER);
 			goto negotiate;
 		}
 	}