Lines Matching refs:migf

82 static void qat_vf_disable_fd(struct qat_vf_migration_file *migf)  in qat_vf_disable_fd()  argument
84 mutex_lock(&migf->lock); in qat_vf_disable_fd()
85 migf->disabled = true; in qat_vf_disable_fd()
86 migf->filp->f_pos = 0; in qat_vf_disable_fd()
87 migf->filled_size = 0; in qat_vf_disable_fd()
88 mutex_unlock(&migf->lock); in qat_vf_disable_fd()
119 struct qat_vf_migration_file *migf = filp->private_data; in qat_vf_precopy_ioctl() local
120 struct qat_vf_core_device *qat_vdev = migf->qat_vdev; in qat_vf_precopy_ioctl()
144 mutex_lock(&migf->lock); in qat_vf_precopy_ioctl()
145 if (migf->disabled) { in qat_vf_precopy_ioctl()
159 mutex_unlock(&migf->lock); in qat_vf_precopy_ioctl()
169 struct qat_vf_migration_file *migf = filp->private_data; in qat_vf_save_read() local
170 struct qat_mig_dev *mig_dev = migf->qat_vdev->mdev; in qat_vf_save_read()
179 mutex_lock(&migf->lock); in qat_vf_save_read()
180 if (*offs > migf->filled_size || *offs < 0) { in qat_vf_save_read()
185 if (migf->disabled) { in qat_vf_save_read()
190 len = min_t(size_t, migf->filled_size - *offs, len); in qat_vf_save_read()
202 mutex_unlock(&migf->lock); in qat_vf_save_read()
208 struct qat_vf_migration_file *migf = filp->private_data; in qat_vf_release_file() local
210 qat_vf_disable_fd(migf); in qat_vf_release_file()
211 mutex_destroy(&migf->lock); in qat_vf_release_file()
212 kfree(migf); in qat_vf_release_file()
226 struct qat_vf_migration_file *migf) in qat_vf_save_state() argument
233 migf->filled_size = qat_vdev->mdev->state_size; in qat_vf_save_state()
239 struct qat_vf_migration_file *migf) in qat_vf_save_setup() argument
246 migf->filled_size = qat_vdev->mdev->setup_size; in qat_vf_save_setup()
261 struct qat_vf_migration_file *migf; in qat_vf_save_device_data() local
264 migf = kzalloc(sizeof(*migf), GFP_KERNEL); in qat_vf_save_device_data()
265 if (!migf) in qat_vf_save_device_data()
268 migf->filp = anon_inode_getfile("qat_vf_mig", &qat_vf_save_fops, in qat_vf_save_device_data()
269 migf, O_RDONLY); in qat_vf_save_device_data()
270 ret = PTR_ERR_OR_ZERO(migf->filp); in qat_vf_save_device_data()
272 kfree(migf); in qat_vf_save_device_data()
276 stream_open(migf->filp->f_inode, migf->filp); in qat_vf_save_device_data()
277 mutex_init(&migf->lock); in qat_vf_save_device_data()
280 ret = qat_vf_save_setup(qat_vdev, migf); in qat_vf_save_device_data()
282 ret = qat_vf_save_state(qat_vdev, migf); in qat_vf_save_device_data()
284 fput(migf->filp); in qat_vf_save_device_data()
288 migf->qat_vdev = qat_vdev; in qat_vf_save_device_data()
290 return migf; in qat_vf_save_device_data()
296 struct qat_vf_migration_file *migf = filp->private_data; in qat_vf_resume_write() local
297 struct qat_mig_dev *mig_dev = migf->qat_vdev->mdev; in qat_vf_resume_write()
313 mutex_lock(&migf->lock); in qat_vf_resume_write()
314 if (migf->disabled) { in qat_vf_resume_write()
325 migf->filled_size += len; in qat_vf_resume_write()
331 ret = qat_vfmig_load_setup(mig_dev, migf->filled_size); in qat_vf_resume_write()
339 mutex_unlock(&migf->lock); in qat_vf_resume_write()
352 struct qat_vf_migration_file *migf; in qat_vf_resume_device_data() local
355 migf = kzalloc(sizeof(*migf), GFP_KERNEL); in qat_vf_resume_device_data()
356 if (!migf) in qat_vf_resume_device_data()
359 migf->filp = anon_inode_getfile("qat_vf_mig", &qat_vf_resume_fops, migf, O_WRONLY); in qat_vf_resume_device_data()
360 ret = PTR_ERR_OR_ZERO(migf->filp); in qat_vf_resume_device_data()
362 kfree(migf); in qat_vf_resume_device_data()
366 migf->qat_vdev = qat_vdev; in qat_vf_resume_device_data()
367 migf->filled_size = 0; in qat_vf_resume_device_data()
368 stream_open(migf->filp->f_inode, migf->filp); in qat_vf_resume_device_data()
369 mutex_init(&migf->lock); in qat_vf_resume_device_data()
371 return migf; in qat_vf_resume_device_data()
412 struct qat_vf_migration_file *migf; in qat_vf_pci_step_device_state() local
414 migf = qat_vf_save_device_data(qat_vdev, false); in qat_vf_pci_step_device_state()
415 if (IS_ERR(migf)) in qat_vf_pci_step_device_state()
416 return ERR_CAST(migf); in qat_vf_pci_step_device_state()
417 get_file(migf->filp); in qat_vf_pci_step_device_state()
418 qat_vdev->saving_migf = migf; in qat_vf_pci_step_device_state()
419 return migf->filp; in qat_vf_pci_step_device_state()
423 struct qat_vf_migration_file *migf; in qat_vf_pci_step_device_state() local
425 migf = qat_vf_resume_device_data(qat_vdev); in qat_vf_pci_step_device_state()
426 if (IS_ERR(migf)) in qat_vf_pci_step_device_state()
427 return ERR_CAST(migf); in qat_vf_pci_step_device_state()
428 get_file(migf->filp); in qat_vf_pci_step_device_state()
429 qat_vdev->resuming_migf = migf; in qat_vf_pci_step_device_state()
430 return migf->filp; in qat_vf_pci_step_device_state()
442 struct qat_vf_migration_file *migf; in qat_vf_pci_step_device_state() local
444 migf = qat_vf_save_device_data(qat_vdev, true); in qat_vf_pci_step_device_state()
445 if (IS_ERR(migf)) in qat_vf_pci_step_device_state()
446 return ERR_CAST(migf); in qat_vf_pci_step_device_state()
447 get_file(migf->filp); in qat_vf_pci_step_device_state()
448 qat_vdev->saving_migf = migf; in qat_vf_pci_step_device_state()
449 return migf->filp; in qat_vf_pci_step_device_state()
453 struct qat_vf_migration_file *migf = qat_vdev->saving_migf; in qat_vf_pci_step_device_state() local
455 if (!migf) in qat_vf_pci_step_device_state()
457 ret = qat_vf_save_state(qat_vdev, migf); in qat_vf_pci_step_device_state()