Callback to get the estimated data length of the data that will be required to complete reading of the vfio device's internal state. It's mandatory for VFIO_DEVICE_FEATURE_MIGRATION migration support. The function pointer for this callback is specified via the 'migration_get_data_size' field of the 'vfio_migration_ops' structure which is stored with the VFIO device when the 'vfio_device' structure representing the mediated device is initialized. Signed-off-by: Anthony Krowiak --- drivers/s390/crypto/vfio_ap_migration.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/s390/crypto/vfio_ap_migration.c b/drivers/s390/crypto/vfio_ap_migration.c index 24955f70e13e..01933a62dab9 100644 --- a/drivers/s390/crypto/vfio_ap_migration.c +++ b/drivers/s390/crypto/vfio_ap_migration.c @@ -1636,7 +1636,15 @@ static int vfio_ap_get_state(struct vfio_device *vdev, static int vfio_ap_get_data_size(struct vfio_device *vdev, unsigned long *stop_copy_length) { - return -EOPNOTSUPP; + struct ap_matrix_mdev *matrix_mdev; + int num_queues; + + mutex_lock(&matrix_dev->mdevs_lock); + matrix_mdev = container_of(vdev, struct ap_matrix_mdev, vdev); + *stop_copy_length = vfio_ap_config_size(matrix_mdev, &num_queues); + mutex_unlock(&matrix_dev->mdevs_lock); + + return 0; } static const struct vfio_migration_ops vfio_ap_migration_ops = { -- 2.53.0