/* * The migration data of each Intel QAT VF device is encapsulated into a * 4096 bytes block. The data consists of two parts. * The first is a pre-configured set of attributes of the VF being migrated, * which are only set when it is created. This can be migrated during pre-copy * stage and used for a device compatibility check. * The second is the VF state. This includes the required MMIO regions and * the shadow states maintained by the QAT PF driver. This part can only be * saved when the VF is fully quiesced and be migrated during stop-copy stage. * Both these 2 parts of data are saved in hierarchical structures including * a preamble section and several raw state sections. * When the pre-configured part of the migration data is fully retrieved from * user space, the preamble section are used to validate the correctness of * the data blocks and check the version compatibility. The raw state sections * are then used to do a device compatibility check. * When the device transits from RESUMING state, the VF states are extracted * from the raw state sections of the VF state part of the migration data and * then loaded into the device.
*/
staticint qat_vf_save_state(struct qat_vf_core_device *qat_vdev, struct qat_vf_migration_file *migf)
{ int ret;
ret = qat_vfmig_save_state(qat_vdev->mdev); if (ret) return ret;
migf->filled_size = qat_vdev->mdev->state_size;
return0;
}
staticint qat_vf_save_setup(struct qat_vf_core_device *qat_vdev, struct qat_vf_migration_file *migf)
{ int ret;
ret = qat_vfmig_save_setup(qat_vdev->mdev); if (ret) return ret;
migf->filled_size = qat_vdev->mdev->setup_size;
return0;
}
/* * Allocate a file handler for user space and then save the migration data for * the device being migrated. If this is called in the pre-copy stage, save the * pre-configured device data. Otherwise, if this is called in the stop-copy * stage, save the device state. In both cases, update the data size which can * then be read from user space.
*/ staticstruct qat_vf_migration_file *
qat_vf_save_device_data(struct qat_vf_core_device *qat_vdev, bool pre_copy)
{ struct qat_vf_migration_file *migf; int ret;
migf = kzalloc(sizeof(*migf), GFP_KERNEL); if (!migf) return ERR_PTR(-ENOMEM);
migf->filp = anon_inode_getfile("qat_vf_mig", &qat_vf_save_fops,
migf, O_RDONLY);
ret = PTR_ERR_OR_ZERO(migf->filp); if (ret) {
kfree(migf); return ERR_PTR(ret);
}
if (pre_copy)
ret = qat_vf_save_setup(qat_vdev, migf); else
ret = qat_vf_save_state(qat_vdev, migf); if (ret) {
fput(migf->filp); return ERR_PTR(ret);
}
/* * Load the pre-configured device data first to check if the target * device is compatible with the source device.
*/
ret = qat_vfmig_load_setup(mig_dev, migf->filled_size); if (ret && ret != -EAGAIN) {
done = ret; goto out_unlock;
}
done = len;
staticstruct file *qat_vf_pci_step_device_state(struct qat_vf_core_device *qat_vdev, u32 new)
{
u32 cur = qat_vdev->mig_state; int ret;
/* * As the device is not capable of just stopping P2P DMAs, suspend the * device completely once any of the P2P states are reached. * When it is suspended, all its MMIO registers can still be operated * correctly, jobs submitted through ring are queued while no jobs are * processed by the device. The MMIO states can be safely migrated to * the target VF during stop-copy stage and restored correctly in the * target VF. All queued jobs can be resumed then.
*/ if ((cur == VFIO_DEVICE_STATE_RUNNING && new == VFIO_DEVICE_STATE_RUNNING_P2P) ||
(cur == VFIO_DEVICE_STATE_PRE_COPY && new == VFIO_DEVICE_STATE_PRE_COPY_P2P)) {
ret = qat_vfmig_suspend(qat_vdev->mdev); if (ret) return ERR_PTR(ret); return NULL;
}
if ((cur == VFIO_DEVICE_STATE_RUNNING_P2P && new == VFIO_DEVICE_STATE_RUNNING) ||
(cur == VFIO_DEVICE_STATE_PRE_COPY_P2P && new == VFIO_DEVICE_STATE_PRE_COPY)) {
qat_vfmig_resume(qat_vdev->mdev); return NULL;
}
if ((cur == VFIO_DEVICE_STATE_RUNNING_P2P && new == VFIO_DEVICE_STATE_STOP) ||
(cur == VFIO_DEVICE_STATE_STOP && new == VFIO_DEVICE_STATE_RUNNING_P2P)) return NULL;
if (cur == VFIO_DEVICE_STATE_STOP && new == VFIO_DEVICE_STATE_STOP_COPY) { struct qat_vf_migration_file *migf;
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Xin Zeng <xin.zeng@intel.com>");
MODULE_DESCRIPTION("QAT VFIO PCI - VFIO PCI driver with live migration support for Intel(R) QAT device family");
MODULE_IMPORT_NS("CRYPTO_QAT");
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.3Bemerkung:
(vorverarbeitet am 2026-06-07)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.