Reviewed-by: Raphael Norwitz <[email protected]>
On Thu, Oct 16, 2025 at 7:49 AM Vladimir Sementsov-Ogievskiy <[email protected]> wrote: > > For vhost user backend migration we'll need to disable memory > logging on the device. Let's prepare a corresponding handler for > the device. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]> > --- > hw/virtio/vhost.c | 10 ++++++++++ > include/hw/virtio/virtio.h | 2 ++ > 2 files changed, 12 insertions(+) > > diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c > index 09d00e4d98..3e5192ec23 100644 > --- a/hw/virtio/vhost.c > +++ b/hw/virtio/vhost.c > @@ -1138,6 +1138,16 @@ static int vhost_migration_log(MemoryListener > *listener, bool enable) > struct vhost_dev *dev = container_of(listener, struct vhost_dev, > memory_listener); > int r; > + > + if (dev->vdev) { > + VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(dev->vdev); > + > + if (vdc->skip_vhost_migration_log && > + vdc->skip_vhost_migration_log(dev->vdev)) { > + return 0; > + } > + } > + > if (enable == dev->log_enabled) { > return 0; > } > diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h > index 7db8046766..620ee4e389 100644 > --- a/include/hw/virtio/virtio.h > +++ b/include/hw/virtio/virtio.h > @@ -238,6 +238,8 @@ struct VirtioDeviceClass { > /* May be called even when vdev->vhost_started is false */ > struct vhost_dev *(*get_vhost)(VirtIODevice *vdev); > void (*toggle_device_iotlb)(VirtIODevice *vdev); > + > + bool (*skip_vhost_migration_log)(VirtIODevice *vdev); > }; > > void virtio_instance_init_common(Object *proxy_obj, void *data, > -- > 2.48.1 > >
