From 4efb8b7951dbc7e9462fe0d43a62baf328b33457 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 13 May 2026 10:14:50 +0200 Subject: [PATCH] virtio-devices: ack requests from backends Quoting the spec: > If VHOST_USER_PROTOCOL_F_REPLY_ACK is negotiated, and the back-end > sets the VHOST_USER_NEED_REPLY flag, the front-end must respond with > zero when operation is successfully completed, or non-zero > otherwise. cloud-hypervisor would previously not send a response to a VHOST_USER_BACKEND_CONFIG_CHANGE_MSG message, even if VHOST_USER_PROTOCOL_F_REPLY_ACK had been negotiated and VHOST_USER_NEED_REPLY was set, in violation of the spec. Link: https://qemu-project.gitlab.io/qemu/interop/vhost-user.html#back-end-message-types Fixes: 8d6213338 ("virtio-devices: generic-vhost-user: Config change notification") Signed-off-by: Alyssa Ross --- virtio-devices/src/vhost_user/generic_vhost_user.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/virtio-devices/src/vhost_user/generic_vhost_user.rs b/virtio-devices/src/vhost_user/generic_vhost_user.rs index cd53f9269..5a302dc55 100644 --- a/virtio-devices/src/vhost_user/generic_vhost_user.rs +++ b/virtio-devices/src/vhost_user/generic_vhost_user.rs @@ -297,12 +297,21 @@ impl VirtioDevice for GenericVhostUser { let backend_req_handler = has_backend_req .then(|| { - FrontendReqHandler::new(Arc::new(BackendReqHandler { + let mut handler = FrontendReqHandler::new(Arc::new(BackendReqHandler { interrupt_cb: interrupt_cb.clone(), })) .map_err(|e| { crate::ActivateError::VhostUserSetup(Error::FrontendReqHandlerCreation(e)) - }) + })?; + + if self.vu_common.acked_protocol_features + & VhostUserProtocolFeatures::REPLY_ACK.bits() + != 0 + { + handler.set_reply_ack_flag(true); + } + + Ok(handler) }) // Return inner Err early, keep Option of `Ok` value .transpose()?;