Implements the callback that returns the current vfio device migration state during live migration of guests with pass-through access to AP devices. The function pointer for this callback is specified via the 'migration_get_state' 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 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/s390/crypto/vfio_ap_migration.c b/drivers/s390/crypto/vfio_ap_migration.c index 28209d8476d9..f9b219083e0f 100644 --- a/drivers/s390/crypto/vfio_ap_migration.c +++ b/drivers/s390/crypto/vfio_ap_migration.c @@ -1016,7 +1016,18 @@ static struct file *vfio_ap_set_state(struct vfio_device *vdev, static int vfio_ap_get_state(struct vfio_device *vdev, enum vfio_device_mig_state *current_state) { - return -EOPNOTSUPP; + struct ap_matrix_mdev *matrix_mdev; + struct vfio_ap_migration_data *mig_data; + + mutex_lock(&matrix_dev->mdevs_lock); + + matrix_mdev = container_of(vdev, struct ap_matrix_mdev, vdev); + mig_data = matrix_mdev->mig_data; + *current_state = mig_data->mig_state; + + mutex_unlock(&matrix_dev->mdevs_lock); + + return 0; } static int vfio_ap_get_data_size(struct vfio_device *vdev, -- 2.52.0