From nobody Sun Feb 8 07:22:23 2026 Received: from canpmsgout10.his.huawei.com (canpmsgout10.his.huawei.com [113.46.200.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 951C72E6CDF; Sun, 4 Jan 2026 07:07:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.225 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767510464; cv=none; b=MJwkNom0jLty7b8kgENd82++FtrMb84fRlZRiqEYT4SB1swAlAbXqJTudNOKXkFBGaIK18AEhm2ja4QRZAIzSwYE8tQdVGf2uqohxd7zt6NGpK313PQpSyNcN+gCugcOLEvU31o+XH8X8Ja6opZA8YrWFLJVlWsmfcScLbkdUM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767510464; c=relaxed/simple; bh=1I9fiQQKn/r6ZMl9tMlG08CeECkvMyeglzDaCBSNhZA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lOiCTeBA54MgnjGYAViibIFUhNbhCLs9yYMo6I9kOHJlSsOQZefgcebj6UMTCq0qeiWMC82cc+07mIxRiB78cB8j7wfh845YrdrAIh+ncploVibur0ddbr/n0zLbxGqLPnG1IzwsWVfQSYZq2fDsCYWBHLdZux4RItJB7sbGi7g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=d2SZgZZN; arc=none smtp.client-ip=113.46.200.225 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="d2SZgZZN" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=MY21NmVmBerMnxMn0j8Xq/Okw5AfIrPkLBbQSpUUHJk=; b=d2SZgZZNxZGChycuecwcXRguPDdTUHICmsEq8W7t8/YYhMqJqN/XSg9uCj5HG6cMks/Va4MxS Vccl+tFx4jCco/CA+nss2+SK/CEk/RuyFK7z3pJHktsptZNxd8bhvZmicBQCGkrE1aabYAZjrF6 aGvQllv64GyyF57FsjQ4RNw= Received: from mail.maildlp.com (unknown [172.19.163.15]) by canpmsgout10.his.huawei.com (SkyGuard) with ESMTPS id 4dkT233CDjz1K97Q; Sun, 4 Jan 2026 15:04:27 +0800 (CST) Received: from dggpemf500015.china.huawei.com (unknown [7.185.36.143]) by mail.maildlp.com (Postfix) with ESMTPS id EC34C40565; Sun, 4 Jan 2026 15:07:38 +0800 (CST) Received: from huawei.com (10.90.31.46) by dggpemf500015.china.huawei.com (7.185.36.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sun, 4 Jan 2026 15:07:38 +0800 From: Longfang Liu To: , , CC: , , Subject: [PATCH 1/4] hisi_acc_vfio_pci: fix VF reset timeout issue Date: Sun, 4 Jan 2026 15:07:03 +0800 Message-ID: <20260104070706.4107994-2-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260104070706.4107994-1-liulongfang@huawei.com> References: <20260104070706.4107994-1-liulongfang@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To dggpemf500015.china.huawei.com (7.185.36.143) Content-Type: text/plain; charset="utf-8" From: Weili Qian If device error occurs during live migration, qemu will reset the VF. At this time, VF reset and device reset are performed simultaneously. The VF reset will timeout. Therefore, the QM_RESETTING flag is used to ensure that VF reset and device reset are performed serially. Fixes: b0eed085903e ("hisi_acc_vfio_pci: Add support for VFIO live migratio= n") Signed-off-by: Weili Qian --- .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 24 +++++++++++++++++++ .../vfio/pci/hisilicon/hisi_acc_vfio_pci.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/= pci/hisilicon/hisi_acc_vfio_pci.c index fe2ffcd00d6e..d55365b21f78 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -1188,14 +1188,37 @@ hisi_acc_vfio_pci_get_device_state(struct vfio_devi= ce *vdev, return 0; } =20 +static void hisi_acc_vf_pci_reset_prepare(struct pci_dev *pdev) +{ + struct hisi_acc_vf_core_device *hisi_acc_vdev =3D hisi_acc_drvdata(pdev); + struct hisi_qm *qm =3D hisi_acc_vdev->pf_qm; + struct device *dev =3D &qm->pdev->dev; + u32 delay =3D 0; + + /* All reset requests need to be queued for processing */ + while (test_and_set_bit(QM_RESETTING, &qm->misc_ctl)) { + msleep(1); + if (++delay > QM_RESET_WAIT_TIMEOUT) { + dev_err(dev, "reset prepare failed\n"); + return; + } + } + + hisi_acc_vdev->set_reset_flag =3D true; +} + static void hisi_acc_vf_pci_aer_reset_done(struct pci_dev *pdev) { struct hisi_acc_vf_core_device *hisi_acc_vdev =3D hisi_acc_drvdata(pdev); + struct hisi_qm *qm =3D hisi_acc_vdev->pf_qm; =20 if (hisi_acc_vdev->core_device.vdev.migration_flags !=3D VFIO_MIGRATION_STOP_COPY) return; =20 + if (hisi_acc_vdev->set_reset_flag) + clear_bit(QM_RESETTING, &qm->misc_ctl); + mutex_lock(&hisi_acc_vdev->state_mutex); hisi_acc_vf_reset(hisi_acc_vdev); mutex_unlock(&hisi_acc_vdev->state_mutex); @@ -1746,6 +1769,7 @@ static const struct pci_device_id hisi_acc_vfio_pci_t= able[] =3D { MODULE_DEVICE_TABLE(pci, hisi_acc_vfio_pci_table); =20 static const struct pci_error_handlers hisi_acc_vf_err_handlers =3D { + .reset_prepare =3D hisi_acc_vf_pci_reset_prepare, .reset_done =3D hisi_acc_vf_pci_aer_reset_done, .error_detected =3D vfio_pci_core_aer_err_detected, }; diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h b/drivers/vfio/= pci/hisilicon/hisi_acc_vfio_pci.h index cd55eba64dfb..a3d91a31e3d8 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h @@ -27,6 +27,7 @@ =20 #define ERROR_CHECK_TIMEOUT 100 #define CHECK_DELAY_TIME 100 +#define QM_RESET_WAIT_TIMEOUT 60000 =20 #define QM_SQC_VFT_BASE_SHIFT_V2 28 #define QM_SQC_VFT_BASE_MASK_V2 GENMASK(15, 0) @@ -128,6 +129,7 @@ struct hisi_acc_vf_migration_file { struct hisi_acc_vf_core_device { struct vfio_pci_core_device core_device; u8 match_done; + bool set_reset_flag; /* * io_base is only valid when dev_opened is true, * which is protected by open_mutex. --=20 2.24.0 From nobody Sun Feb 8 07:22:23 2026 Received: from canpmsgout01.his.huawei.com (canpmsgout01.his.huawei.com [113.46.200.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E17611EEA55; Sun, 4 Jan 2026 07:08:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.216 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767510496; cv=none; b=P44aeYR9d3+g0EDbDwrUxdWvGF3qnykMKo9OQRcJmaOouxbkpk+YcDYlOdBlsWDgrDcP7fPhKqjYiyDw51NbT9lc50QyGp9hIORlJ1jE5+nPfGUv2Yp1p9zXfsJ85d3d6Tc9yeAERNL36j8PKaIJ1Ygr6f2eETXSLiisq2oLeAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767510496; c=relaxed/simple; bh=WBwnOcUl/xssJGTTP8exQMaj2WD7Lg4rRSYxjmvd9/g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ewFRrgYNiVyHhUm4mC3Vt/sGan275wm1yQEFA+S204DDwX7iM8cVCXvY9t2CwG8X+pRCSPIBPmzbUylM/Iop7RNz+HyvMdrPIlKxuGwaZ8HrA5qbeOWrKgt29zj0aLf876C0RCj95A3CZZbIRbTQGawpNR2FjLfApasIvS2n38Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=DyG6dOt1; arc=none smtp.client-ip=113.46.200.216 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="DyG6dOt1" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=I/ZN+17KSILnRKc9JdIcWXQNtNFNMtaQKhkBwwLWLZ0=; b=DyG6dOt1xo/sEZO/KBD62S2p3iuSYzuD2+fYy1UHVXmPrt+DTv/IPgj+uz73/58sLMx45TEHm RUZPYTL65Mcz7XMoQk+RkcK7mykeHMoWTbCcnLHUNlrIEprEdP9OLS7Q25kf+STfiV3OKTU3/L+ FDR47Xze0aZrDlFWQZ9dheQ= Received: from mail.maildlp.com (unknown [172.19.162.144]) by canpmsgout01.his.huawei.com (SkyGuard) with ESMTPS id 4dkT3J63qTz1T4Gh; Sun, 4 Jan 2026 15:05:32 +0800 (CST) Received: from dggpemf500015.china.huawei.com (unknown [7.185.36.143]) by mail.maildlp.com (Postfix) with ESMTPS id 2BEC140538; Sun, 4 Jan 2026 15:08:10 +0800 (CST) Received: from huawei.com (10.90.31.46) by dggpemf500015.china.huawei.com (7.185.36.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sun, 4 Jan 2026 15:08:09 +0800 From: Longfang Liu To: , , CC: , , Subject: [PATCH 2/4] hisi_acc_vfio_pci: update status after RAS error Date: Sun, 4 Jan 2026 15:07:04 +0800 Message-ID: <20260104070706.4107994-3-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260104070706.4107994-1-liulongfang@huawei.com> References: <20260104070706.4107994-1-liulongfang@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To dggpemf500015.china.huawei.com (7.185.36.143) Content-Type: text/plain; charset="utf-8" After a RAS error occurs on the accelerator device, the accelerator device will be reset. The live migration state will be abnormal after reset, and the original state needs to be restored during the reset process. Therefore, reset processing needs to be performed in a live migration scenario. Signed-off-by: Longfang Liu --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/= pci/hisilicon/hisi_acc_vfio_pci.c index d55365b21f78..e782c2274871 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -1212,8 +1212,7 @@ static void hisi_acc_vf_pci_aer_reset_done(struct pci= _dev *pdev) struct hisi_acc_vf_core_device *hisi_acc_vdev =3D hisi_acc_drvdata(pdev); struct hisi_qm *qm =3D hisi_acc_vdev->pf_qm; =20 - if (hisi_acc_vdev->core_device.vdev.migration_flags !=3D - VFIO_MIGRATION_STOP_COPY) + if (!hisi_acc_vdev->core_device.vdev.mig_ops) return; =20 if (hisi_acc_vdev->set_reset_flag) --=20 2.24.0 From nobody Sun Feb 8 07:22:23 2026 Received: from canpmsgout06.his.huawei.com (canpmsgout06.his.huawei.com [113.46.200.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A84262E3387; Sun, 4 Jan 2026 07:08:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.221 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767510525; cv=none; b=P4YSQ1dDNCOjn/qruwbjXakVK71kQ2RSx2wUVWO0Yr78ITGcP13yHbLnfgfE+ygTuOJEsAsF2kgFMbpSRE4L1R8CO0+i/b2eD46y926zQKaRCMoPhCWn/SlMbWf2TPhiaNnGl0Dg7EDcmuHsXGn/DPOluMlfOyXb2uCi12Rswxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767510525; c=relaxed/simple; bh=JoxFw5TFuh4buXBOcI2mMUGwcOmU9+r4ndtF1cb07l8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Lpjl8dHUSneIKVB/upczdjPSeChwzzzXDRkiqXhL5mK9YUtezjSwz9jPPAXRCzWma1Gmp8+D0QGJAsTCCAiUMzidGR6CrC3w4d8yVIINIIF70puPX9nVi7tnOPekP5Phgy0LlBDCe5bOh3j/xHYMWFuvbw/Q09OlYd9ncVfpIEk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=V46jC0tb; arc=none smtp.client-ip=113.46.200.221 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="V46jC0tb" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=mJA4sbXf/bjLcZSjxOe5Xvex+B0nnqAwSKeicW7m7vo=; b=V46jC0tbhsONdmCSB+Bth2ZlmJdDpNyR8ELRXv4X3UgqtBcO+rLks1JUtoyXmNMx1mmpRrkbn kNIQHOrFjC9JwLSjTMvAhRl7s2GnAzEpx8UkQaM6F1hqIeJ0tHpWRQ2w7bKmNk6s6cpL6jXHJxT KE1lyDjVYKi/pixN+qHRTGk= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout06.his.huawei.com (SkyGuard) with ESMTPS id 4dkT3C3Mb7zRhs9; Sun, 4 Jan 2026 15:05:27 +0800 (CST) Received: from dggpemf500015.china.huawei.com (unknown [7.185.36.143]) by mail.maildlp.com (Postfix) with ESMTPS id 4BDDA40569; Sun, 4 Jan 2026 15:08:41 +0800 (CST) Received: from huawei.com (10.90.31.46) by dggpemf500015.china.huawei.com (7.185.36.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sun, 4 Jan 2026 15:08:40 +0800 From: Longfang Liu To: , , CC: , , Subject: [PATCH 3/4] hisi_acc_vfio_pci: resolve duplicate migration states Date: Sun, 4 Jan 2026 15:07:05 +0800 Message-ID: <20260104070706.4107994-4-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260104070706.4107994-1-liulongfang@huawei.com> References: <20260104070706.4107994-1-liulongfang@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To dggpemf500015.china.huawei.com (7.185.36.143) Content-Type: text/plain; charset="utf-8" In special scenarios involving duplicate migrations, after the first migration is completed, if the original VF device is used again and then migrated to another destination, the state indicating data migration completion for the VF device is not reset. This results in the second migration to the destination being skipped without performing data migration. After the modification, it ensures that a complete data migration is performed after the subsequent migration. Signed-off-by: Longfang Liu --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/= pci/hisilicon/hisi_acc_vfio_pci.c index e782c2274871..394f1952a7ed 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -1583,6 +1583,7 @@ static int hisi_acc_vfio_pci_open_device(struct vfio_= device *core_vdev) } hisi_acc_vdev->mig_state =3D VFIO_DEVICE_STATE_RUNNING; hisi_acc_vdev->dev_opened =3D true; + hisi_acc_vdev->match_done =3D 0; mutex_unlock(&hisi_acc_vdev->open_mutex); } =20 --=20 2.24.0 From nobody Sun Feb 8 07:22:23 2026 Received: from canpmsgout02.his.huawei.com (canpmsgout02.his.huawei.com [113.46.200.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC8261EEA55; Sun, 4 Jan 2026 07:09:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.217 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767510564; cv=none; b=pcQVLQ/4K02XLJWgWqGw1qx2LCS6e/UVsZ1pu0v6sCIjHxfKGnxLCW/6VHL6qSHp02JjZi67YeyZ4KUPDKDyNVx9MbhroA3Dg7qZuRLEPjQqTVPfuHx2U9XkGmHuiYljhGK+KJWFwbfIqG88r5ZjzR34rZTYHEm7+fGfxW1Lcgk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767510564; c=relaxed/simple; bh=yo4s7tNHJPYzEeNHy5USwxfrEjAlLe8Wyca+9lI7Sqw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eZ6Wm/XdsDJ9jSk23jwgN8o7UbU6DmFwDBSoUpq/tzQbpxMeroSHRS2S7Vp+hAfZgnopP3nb+aLkZ5YYbIfxeVdD0WhlurSnTL0LxkgWmUnf47jTgdcZB8G4cawQxXUAim9fgAT4rZANFy/msei1ibptYRw8GbO2qlRpN9lbXzg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=mnh0jAwI; arc=none smtp.client-ip=113.46.200.217 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="mnh0jAwI" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=K2Rn//20dzEeCrYi224axDNWkg8lyp1rwlU1LUEqigs=; b=mnh0jAwINorMSexBIwFFbSXeqPdFInVDb361qn3sdmeEYOD6BVMfbYkoKTgME86dMxHac8148 GxkRD8lHUM8KtrN0S29mzljWtv4Iu6l4f+UWiMa/6w5Bkkh0YFV6iRS+Qpq6bRTDM98lqcJQkV6 M+3j7MBTci0cnfCFRO12EmE= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4dkT3Z40r9zcZxv; Sun, 4 Jan 2026 15:05:46 +0800 (CST) Received: from dggpemf500015.china.huawei.com (unknown [7.185.36.143]) by mail.maildlp.com (Postfix) with ESMTPS id B9C0540569; Sun, 4 Jan 2026 15:09:12 +0800 (CST) Received: from huawei.com (10.90.31.46) by dggpemf500015.china.huawei.com (7.185.36.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sun, 4 Jan 2026 15:09:11 +0800 From: Longfang Liu To: , , CC: , , Subject: [PATCH 4/4] hisi_acc_vfio_pci: fix the queue parameter anomaly issue Date: Sun, 4 Jan 2026 15:07:06 +0800 Message-ID: <20260104070706.4107994-5-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260104070706.4107994-1-liulongfang@huawei.com> References: <20260104070706.4107994-1-liulongfang@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To dggpemf500015.china.huawei.com (7.185.36.143) Content-Type: text/plain; charset="utf-8" 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 --- 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_de= vice *hisi_acc_vdev, struct hisi_qm *pf_qm =3D hisi_acc_vdev->pf_qm; struct device *dev =3D &vf_qm->pdev->dev; u32 que_iso_state; - int ret; + int qp_num, ret; =20 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, } =20 /* VF qp num check */ - ret =3D qm_get_vft(vf_qm, &vf_qm->qp_base); - if (ret <=3D 0) { + qp_num =3D qm_get_vft(vf_qm, &vf_qm->qp_base); + if (qp_num <=3D 0) { dev_err(dev, "failed to get vft qp nums\n"); - return ret; + return -EINVAL; } =20 - if (ret !=3D vf_data->qp_num) { + if (qp_num !=3D vf_data->qp_num) { dev_err(dev, "failed to match VF qp num\n"); return -EINVAL; } =20 - vf_qm->qp_num =3D ret; + vf_qm->qp_num =3D qp_num; =20 /* VF isolation state check */ ret =3D qm_read_regs(pf_qm, QM_QUE_ISO_CFG_V, &que_iso_state, 1); --=20 2.24.0