mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
hisi_acc_vfio_pci: Move the dev compatibility tests for early check
Instead of waiting till data transfer is complete to perform dev compatibility, do it as soon as we have enough data to perform the check. This will be useful when we enable the support for PRE_COPY. Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> Link: https://lore.kernel.org/r/20221123113236.896-4-shameerali.kolothum.thodi@huawei.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
d9a871e4a1
commit
190125adca
2 changed files with 8 additions and 12 deletions
|
@ -360,8 +360,8 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev,
|
|||
u32 que_iso_state;
|
||||
int ret;
|
||||
|
||||
if (migf->total_length < QM_MATCH_SIZE)
|
||||
return -EINVAL;
|
||||
if (migf->total_length < QM_MATCH_SIZE || hisi_acc_vdev->match_done)
|
||||
return 0;
|
||||
|
||||
if (vf_data->acc_magic != ACC_DEV_MAGIC) {
|
||||
dev_err(dev, "failed to match ACC_DEV_MAGIC\n");
|
||||
|
@ -406,6 +406,7 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev,
|
|||
}
|
||||
|
||||
hisi_acc_vdev->vf_qm_state = vf_data->vf_qm_state;
|
||||
hisi_acc_vdev->match_done = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -493,10 +494,6 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev,
|
|||
struct device *dev = &vf_qm->pdev->dev;
|
||||
int ret;
|
||||
|
||||
ret = vf_qm_get_match_data(hisi_acc_vdev, vf_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (unlikely(qm_wait_dev_not_ready(vf_qm))) {
|
||||
/* Update state and return with match data */
|
||||
vf_data->vf_qm_state = QM_NOT_READY;
|
||||
|
@ -673,12 +670,6 @@ static int hisi_acc_vf_load_state(struct hisi_acc_vf_core_device *hisi_acc_vdev)
|
|||
struct hisi_acc_vf_migration_file *migf = hisi_acc_vdev->resuming_migf;
|
||||
int ret;
|
||||
|
||||
/* Check dev compatibility */
|
||||
ret = vf_qm_check_match(hisi_acc_vdev, migf);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to match the VF!\n");
|
||||
return ret;
|
||||
}
|
||||
/* Recover data to VF */
|
||||
ret = vf_qm_load_data(hisi_acc_vdev, migf);
|
||||
if (ret) {
|
||||
|
@ -732,6 +723,10 @@ static ssize_t hisi_acc_vf_resume_write(struct file *filp, const char __user *bu
|
|||
*pos += len;
|
||||
done = len;
|
||||
migf->total_length += len;
|
||||
|
||||
ret = vf_qm_check_match(migf->hisi_acc_vdev, migf);
|
||||
if (ret)
|
||||
done = -EFAULT;
|
||||
out_unlock:
|
||||
mutex_unlock(&migf->lock);
|
||||
return done;
|
||||
|
|
|
@ -98,6 +98,7 @@ struct hisi_acc_vf_migration_file {
|
|||
|
||||
struct hisi_acc_vf_core_device {
|
||||
struct vfio_pci_core_device core_device;
|
||||
u8 match_done:1;
|
||||
u8 deferred_reset:1;
|
||||
/* For migration state */
|
||||
struct mutex state_mutex;
|
||||
|
|
Loading…
Reference in a new issue