Skip to content

Commit e63c466

Browse files
Longfang Liuawilliam
authored andcommitted
hisi_acc_vfio_pci: bugfix cache write-back issue
At present, cache write-back is placed in the device data copy stage after stopping the device operation. Writing back to the cache at this stage will cause the data obtained by the cache to be written back to be empty. In order to ensure that the cache data is written back successfully, the data needs to be written back into the stop device stage. Fixes: b0eed08 ("hisi_acc_vfio_pci: Add support for VFIO live migration") Signed-off-by: Longfang Liu <liulongfang@huawei.com> Reviewed-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> Link: https://lore.kernel.org/r/20250510081155.55840-4-liulongfang@huawei.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 3495cec commit e63c466

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,6 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev,
566566
{
567567
struct acc_vf_data *vf_data = &migf->vf_data;
568568
struct hisi_qm *vf_qm = &hisi_acc_vdev->vf_qm;
569-
struct device *dev = &vf_qm->pdev->dev;
570569
int ret;
571570

572571
if (unlikely(qm_wait_dev_not_ready(vf_qm))) {
@@ -580,12 +579,6 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev,
580579
vf_data->vf_qm_state = QM_READY;
581580
hisi_acc_vdev->vf_qm_state = vf_data->vf_qm_state;
582581

583-
ret = vf_qm_cache_wb(vf_qm);
584-
if (ret) {
585-
dev_err(dev, "failed to writeback QM Cache!\n");
586-
return ret;
587-
}
588-
589582
ret = vf_qm_read_data(vf_qm, vf_data);
590583
if (ret)
591584
return -EINVAL;
@@ -1012,6 +1005,13 @@ static int hisi_acc_vf_stop_device(struct hisi_acc_vf_core_device *hisi_acc_vdev
10121005
dev_err(dev, "failed to check QM INT state!\n");
10131006
return ret;
10141007
}
1008+
1009+
ret = vf_qm_cache_wb(vf_qm);
1010+
if (ret) {
1011+
dev_err(dev, "failed to writeback QM cache!\n");
1012+
return ret;
1013+
}
1014+
10151015
return 0;
10161016
}
10171017

0 commit comments

Comments
 (0)