qapi: introduce device-sync-config

Add command to sync config from vhost-user backend to the device. It
may be helpful when VHOST_USER_SLAVE_CONFIG_CHANGE_MSG failed or not
triggered interrupt to the guest or just not available (not supported
by vhost-user server).

Command result is racy if allow it during migration. Let's not allow
that.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Raphael Norwitz <raphael@enfabrica.net>
Message-Id: <20240920094936.450987-4-vsementsov@yandex-team.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Vladimir Sementsov-Ogievskiy 2024-09-20 12:49:36 +03:00 committed by Michael S. Tsirkin
parent 4dfa127314
commit 3f98408e2e
5 changed files with 78 additions and 0 deletions

View file

@ -2385,6 +2385,14 @@ static void virtio_pci_dc_realize(DeviceState *qdev, Error **errp)
vpciklass->parent_dc_realize(qdev, errp);
}
static int virtio_pci_sync_config(DeviceState *dev, Error **errp)
{
VirtIOPCIProxy *proxy = VIRTIO_PCI(dev);
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
return qdev_sync_config(DEVICE(vdev), errp);
}
static void virtio_pci_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@ -2401,6 +2409,7 @@ static void virtio_pci_class_init(ObjectClass *klass, void *data)
device_class_set_parent_realize(dc, virtio_pci_dc_realize,
&vpciklass->parent_dc_realize);
rc->phases.hold = virtio_pci_bus_reset_hold;
dc->sync_config = virtio_pci_sync_config;
}
static const TypeInfo virtio_pci_info = {