Lines Matching refs:migf
354 struct hisi_acc_vf_migration_file *migf) in vf_qm_check_match() argument
356 struct acc_vf_data *vf_data = &migf->vf_data; in vf_qm_check_match()
363 if (migf->total_length < QM_MATCH_SIZE) in vf_qm_check_match()
444 struct hisi_acc_vf_migration_file *migf) in vf_qm_load_data() argument
448 struct acc_vf_data *vf_data = &migf->vf_data; in vf_qm_load_data()
452 if (migf->total_length == QM_MATCH_SIZE) in vf_qm_load_data()
455 if (migf->total_length < sizeof(struct acc_vf_data)) in vf_qm_load_data()
489 struct hisi_acc_vf_migration_file *migf) in vf_qm_state_save() argument
491 struct acc_vf_data *vf_data = &migf->vf_data; in vf_qm_state_save()
504 migf->total_length = QM_MATCH_SIZE; in vf_qm_state_save()
542 migf->total_length = sizeof(struct acc_vf_data); in vf_qm_state_save()
612 static void hisi_acc_vf_disable_fd(struct hisi_acc_vf_migration_file *migf) in hisi_acc_vf_disable_fd() argument
614 mutex_lock(&migf->lock); in hisi_acc_vf_disable_fd()
615 migf->disabled = true; in hisi_acc_vf_disable_fd()
616 migf->total_length = 0; in hisi_acc_vf_disable_fd()
617 migf->filp->f_pos = 0; in hisi_acc_vf_disable_fd()
618 mutex_unlock(&migf->lock); in hisi_acc_vf_disable_fd()
673 struct hisi_acc_vf_migration_file *migf = hisi_acc_vdev->resuming_migf; in hisi_acc_vf_load_state() local
677 ret = vf_qm_check_match(hisi_acc_vdev, migf); in hisi_acc_vf_load_state()
683 ret = vf_qm_load_data(hisi_acc_vdev, migf); in hisi_acc_vf_load_state()
694 struct hisi_acc_vf_migration_file *migf = filp->private_data; in hisi_acc_vf_release_file() local
696 hisi_acc_vf_disable_fd(migf); in hisi_acc_vf_release_file()
697 mutex_destroy(&migf->lock); in hisi_acc_vf_release_file()
698 kfree(migf); in hisi_acc_vf_release_file()
705 struct hisi_acc_vf_migration_file *migf = filp->private_data; in hisi_acc_vf_resume_write() local
721 mutex_lock(&migf->lock); in hisi_acc_vf_resume_write()
722 if (migf->disabled) { in hisi_acc_vf_resume_write()
727 ret = copy_from_user(&migf->vf_data, buf, len); in hisi_acc_vf_resume_write()
734 migf->total_length += len; in hisi_acc_vf_resume_write()
736 mutex_unlock(&migf->lock); in hisi_acc_vf_resume_write()
750 struct hisi_acc_vf_migration_file *migf; in hisi_acc_vf_pci_resume() local
752 migf = kzalloc(sizeof(*migf), GFP_KERNEL); in hisi_acc_vf_pci_resume()
753 if (!migf) in hisi_acc_vf_pci_resume()
756 migf->filp = anon_inode_getfile("hisi_acc_vf_mig", &hisi_acc_vf_resume_fops, migf, in hisi_acc_vf_pci_resume()
758 if (IS_ERR(migf->filp)) { in hisi_acc_vf_pci_resume()
759 int err = PTR_ERR(migf->filp); in hisi_acc_vf_pci_resume()
761 kfree(migf); in hisi_acc_vf_pci_resume()
765 stream_open(migf->filp->f_inode, migf->filp); in hisi_acc_vf_pci_resume()
766 mutex_init(&migf->lock); in hisi_acc_vf_pci_resume()
767 return migf; in hisi_acc_vf_pci_resume()
773 struct hisi_acc_vf_migration_file *migf = filp->private_data; in hisi_acc_vf_save_read() local
781 mutex_lock(&migf->lock); in hisi_acc_vf_save_read()
782 if (*pos > migf->total_length) { in hisi_acc_vf_save_read()
787 if (migf->disabled) { in hisi_acc_vf_save_read()
792 len = min_t(size_t, migf->total_length - *pos, len); in hisi_acc_vf_save_read()
794 ret = copy_to_user(buf, &migf->vf_data, len); in hisi_acc_vf_save_read()
803 mutex_unlock(&migf->lock); in hisi_acc_vf_save_read()
817 struct hisi_acc_vf_migration_file *migf; in hisi_acc_vf_stop_copy() local
820 migf = kzalloc(sizeof(*migf), GFP_KERNEL); in hisi_acc_vf_stop_copy()
821 if (!migf) in hisi_acc_vf_stop_copy()
824 migf->filp = anon_inode_getfile("hisi_acc_vf_mig", &hisi_acc_vf_save_fops, migf, in hisi_acc_vf_stop_copy()
826 if (IS_ERR(migf->filp)) { in hisi_acc_vf_stop_copy()
827 int err = PTR_ERR(migf->filp); in hisi_acc_vf_stop_copy()
829 kfree(migf); in hisi_acc_vf_stop_copy()
833 stream_open(migf->filp->f_inode, migf->filp); in hisi_acc_vf_stop_copy()
834 mutex_init(&migf->lock); in hisi_acc_vf_stop_copy()
836 ret = vf_qm_state_save(hisi_acc_vdev, migf); in hisi_acc_vf_stop_copy()
838 fput(migf->filp); in hisi_acc_vf_stop_copy()
842 return migf; in hisi_acc_vf_stop_copy()
880 struct hisi_acc_vf_migration_file *migf; in hisi_acc_vf_set_device_state() local
882 migf = hisi_acc_vf_stop_copy(hisi_acc_vdev); in hisi_acc_vf_set_device_state()
883 if (IS_ERR(migf)) in hisi_acc_vf_set_device_state()
884 return ERR_CAST(migf); in hisi_acc_vf_set_device_state()
885 get_file(migf->filp); in hisi_acc_vf_set_device_state()
886 hisi_acc_vdev->saving_migf = migf; in hisi_acc_vf_set_device_state()
887 return migf->filp; in hisi_acc_vf_set_device_state()
896 struct hisi_acc_vf_migration_file *migf; in hisi_acc_vf_set_device_state() local
898 migf = hisi_acc_vf_pci_resume(hisi_acc_vdev); in hisi_acc_vf_set_device_state()
899 if (IS_ERR(migf)) in hisi_acc_vf_set_device_state()
900 return ERR_CAST(migf); in hisi_acc_vf_set_device_state()
901 get_file(migf->filp); in hisi_acc_vf_set_device_state()
902 hisi_acc_vdev->resuming_migf = migf; in hisi_acc_vf_set_device_state()
903 return migf->filp; in hisi_acc_vf_set_device_state()