vfio/migration: Add Error** argument to .vfio_save_config() handler

Use vmstate_save_state_with_err() to improve error reporting in the
callers and store a reported error under the migration stream. Add
documentation while at it.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Avihai Horon <avihaih@nvidia.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Cédric Le Goater 2024-05-16 14:46:54 +02:00
parent fbd2469a66
commit 3783f814e7
3 changed files with 45 additions and 10 deletions

View file

@ -133,7 +133,30 @@ struct VFIODeviceOps {
int (*vfio_hot_reset_multi)(VFIODevice *vdev);
void (*vfio_eoi)(VFIODevice *vdev);
Object *(*vfio_get_object)(VFIODevice *vdev);
void (*vfio_save_config)(VFIODevice *vdev, QEMUFile *f);
/**
* @vfio_save_config
*
* Save device config state
*
* @vdev: #VFIODevice for which to save the config
* @f: #QEMUFile where to send the data
* @errp: pointer to Error*, to store an error if it happens.
*
* Returns zero to indicate success and negative for error
*/
int (*vfio_save_config)(VFIODevice *vdev, QEMUFile *f, Error **errp);
/**
* @vfio_load_config
*
* Load device config state
*
* @vdev: #VFIODevice for which to load the config
* @f: #QEMUFile where to get the data
*
* Returns zero to indicate success and negative for error
*/
int (*vfio_load_config)(VFIODevice *vdev, QEMUFile *f);
};