[PATCH v1 17/24] s390/vfio-ap: Transition device migration state from RESUMING to STOP

Anthony Krowiak
2026-03-25T21:02:17Z

Leaving the RESUMING state terminates a data transfer of the internal
state of the vfio-ap device on the source host to the vfio-ap device on the
target host. This state transition indicates the vfio_ap driver should
complete the incorporation of data written to the data transfer FD into the
into the vfio-ap device. Since a vfio-ap device does not virtualize a
physical device, there is no internal device state to
incorporate; so, the only thing left to do is release the migration files
used to help facilitate the migration process.

Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com>
---
drivers/s390/crypto/vfio_ap_migration.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/crypto/vfio_ap_migration.c b/drivers/s390/crypto/vfio_ap_migration.c
index d9b6dba53181..71cae26eab96 100644
--- a/drivers/s390/crypto/vfio_ap_migration.c
+++ b/drivers/s390/crypto/vfio_ap_migration.c
@@ -921,10 +921,20 @@ vfio_ap_transition_to_state(struct ap_matrix_mdev *matrix_mdev,
return migf->filp;
}

+ /*
+ * Terminates the data transfer session of the vfio-ap device state
+ * between the source and target hosts. Since the vfio-ap device does
+ * not virtualize a DMA device, there is no internal device state to
+ * incorporate into the vfio-ap device on the target; so, the only
+ * thing left to do is release the migration files used to process
+ * the vfio device migration. Note that this state transition is for
+ * the vfio-ap device on the target host.
+ */
if (cur_state == VFIO_DEVICE_STATE_RESUMING &&
new_state == VFIO_DEVICE_STATE_STOP) {
- /* TODO */
- return ERR_PTR(-EOPNOTSUPP);
+ vfio_ap_release_mig_files(matrix_mdev);
+
+ return NULL;
}

if (cur_state == VFIO_DEVICE_STATE_STOP_COPY &&
--
2.52.0