[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260104070706.4107994-5-liulongfang@huawei.com>
Date: Sun, 4 Jan 2026 15:07:06 +0800
From: Longfang Liu <liulongfang@...wei.com>
To: <alex.williamson@...hat.com>, <jgg@...dia.com>,
<jonathan.cameron@...wei.com>
CC: <kvm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<liulongfang@...wei.com>
Subject: [PATCH 4/4] hisi_acc_vfio_pci: fix the queue parameter anomaly issue
When the number of QPs initialized by the device, as read via vft, is zero,
it indicates either an abnormal device configuration or an abnormal read
result.
Returning 0 directly in this case would allow the live migration operation
to complete successfully, leading to incorrect parameter configuration after
migration and preventing the service from recovering normal functionality.
Therefore, in such situations, an error should be returned to roll back the
live migration operation.
Signed-off-by: Longfang Liu <liulongfang@...wei.com>
---
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
index 394f1952a7ed..e0cc20f5f38b 100644
--- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
+++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
@@ -406,7 +406,7 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev,
struct hisi_qm *pf_qm = hisi_acc_vdev->pf_qm;
struct device *dev = &vf_qm->pdev->dev;
u32 que_iso_state;
- int ret;
+ int qp_num, ret;
if (migf->total_length < QM_MATCH_SIZE || hisi_acc_vdev->match_done)
return 0;
@@ -423,18 +423,18 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev,
}
/* VF qp num check */
- ret = qm_get_vft(vf_qm, &vf_qm->qp_base);
- if (ret <= 0) {
+ qp_num = qm_get_vft(vf_qm, &vf_qm->qp_base);
+ if (qp_num <= 0) {
dev_err(dev, "failed to get vft qp nums\n");
- return ret;
+ return -EINVAL;
}
- if (ret != vf_data->qp_num) {
+ if (qp_num != vf_data->qp_num) {
dev_err(dev, "failed to match VF qp num\n");
return -EINVAL;
}
- vf_qm->qp_num = ret;
+ vf_qm->qp_num = qp_num;
/* VF isolation state check */
ret = qm_read_regs(pf_qm, QM_QUE_ISO_CFG_V, &que_iso_state, 1);
--
2.24.0
Powered by blists - more mailing lists