Skip to content

Commit 3495cec

Browse files
Longfang Liuawilliam
authored andcommitted
hisi_acc_vfio_pci: add eq and aeq interruption restore
In order to ensure that the task packets of the accelerator device are not lost during the migration process, it is necessary to send an EQ and AEQ command to the device after the live migration is completed and to update the completion position of the task queue. Let the device recheck the completed tasks data and if there are uncollected packets, device resend a task completion interrupt to the software. 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-3-liulongfang@huawei.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 8bb7170 commit 3495cec

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,19 @@ static int vf_qm_get_match_data(struct hisi_acc_vf_core_device *hisi_acc_vdev,
470470
return 0;
471471
}
472472

473+
static void vf_qm_xeqc_save(struct hisi_qm *qm,
474+
struct hisi_acc_vf_migration_file *migf)
475+
{
476+
struct acc_vf_data *vf_data = &migf->vf_data;
477+
u16 eq_head, aeq_head;
478+
479+
eq_head = vf_data->qm_eqc_dw[0] & 0xFFFF;
480+
qm_db(qm, 0, QM_DOORBELL_CMD_EQ, eq_head, 0);
481+
482+
aeq_head = vf_data->qm_aeqc_dw[0] & 0xFFFF;
483+
qm_db(qm, 0, QM_DOORBELL_CMD_AEQ, aeq_head, 0);
484+
}
485+
473486
static int vf_qm_load_data(struct hisi_acc_vf_core_device *hisi_acc_vdev,
474487
struct hisi_acc_vf_migration_file *migf)
475488
{
@@ -578,6 +591,9 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev,
578591
return -EINVAL;
579592

580593
migf->total_length = sizeof(struct acc_vf_data);
594+
/* Save eqc and aeqc interrupt information */
595+
vf_qm_xeqc_save(vf_qm, migf);
596+
581597
return 0;
582598
}
583599

0 commit comments

Comments
 (0)