On Thu, Aug 20, 2026 at 02:39:51PM +0300, Andrey Drobyshev wrote:
Split the first part of vhost_dev_init(): selecting the backend, calling
its .vhost_init() and reading the supported features - into a new
vhost_dev_init_backend() helper, and call it from vhost_dev_init().

This is in preparation for CPR restore of vhost-vsock, which needs to learn
the backend's features at realize time to negotiate them when loading the
incoming virtio state, but also must defer taking ownership of the device
to post_load.  vhost_dev_init_backend() does exactly the pre-ownership part.

As a result VHOST_SET_OWNER now follows the feature query rather than
precedes it.  This should be safe, as no backend requires ownership before
VHOST_GET_FEATURES - the kernel and vdpa backends do not check ownership
for it, and vhost-user already does query features from its .vhost_init()
before set_owner().

Signed-off-by: Andrey Drobyshev <[email protected]>
---
hw/virtio/vhost.c         | 33 +++++++++++++++++++++++----------
include/hw/virtio/vhost.h | 22 ++++++++++++++++++++++
2 files changed, 45 insertions(+), 10 deletions(-)

Reviewed-by: Stefano Garzarella <[email protected]>


Reply via email to