From nobody Sun Feb 8 09:13:20 2026 Received: from canpmsgout05.his.huawei.com (canpmsgout05.his.huawei.com [113.46.200.220]) (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 D81CC330668; Thu, 22 Jan 2026 02:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.220 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047372; cv=none; b=c8vWtunQr+Q2j7v99MTzzYcBjbL1u7+RfKMv5qmBNtnK8uA8dFTYpyLsVlBca8iGqrEdGSslJ2A3/kepk3HowiC7snz25IVJCqdHOq5Ohqy/S9VCT3jpnqTxJSwO4iV4rU2lFoQ8skDUs6BkrVKN13I71jMi8gga1ezdpEnfXRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047372; c=relaxed/simple; bh=3Yez/NvZXwlauKN6NjcvaE3NyiIZfdy6wPGh3mcBJ80=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PPDdbXfb9OS8u7y97kr2Zhh0rh3Ce8ddSrTMeFV4NmlbqMSrcVdN1jCia2w9Afhz/YHIiJOAxJFCfoUR/FSXpVxva1tqbfW2DTQ/OfiVS+rFnODGgBGtdJ9Bw5fzI6Bh9sYydKXd8NF76p0zvNNUz8yza6rkQd28R8owr5eQS+c= 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=P1ejIla0; arc=none smtp.client-ip=113.46.200.220 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="P1ejIla0" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=DESLk+/2MnfEhBhzIEX1R4Za2cJAYmV5Grdhor4/fBs=; b=P1ejIla0GN/dbKpYAEvWx18maL9n0bWP38cSeLRfYcIIovUrwikBjciIbRxilH2/D7e3zA+li A3oLmsXLrqtu3Fgapzbet/OB3lKtg2ZtYqrG/nl6FXBYvXsme4YbYviCI73BzTCqpftUyE1yJCc aD4Q/xqJBkF4gxWsv16HsaI= Received: from mail.maildlp.com (unknown [172.19.162.223]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4dxPNw3hBZz12LGl; Thu, 22 Jan 2026 09:58:40 +0800 (CST) Received: from dggpemf500015.china.huawei.com (unknown [7.185.36.143]) by mail.maildlp.com (Postfix) with ESMTPS id 77D4F40539; Thu, 22 Jan 2026 10:02: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; Thu, 22 Jan 2026 10:02:37 +0800 From: Longfang Liu To: , , CC: , , Subject: [PATCH v2 1/4] hisi_acc_vfio_pci: fix VF reset timeout issue Date: Thu, 22 Jan 2026 10:02:02 +0800 Message-ID: <20260122020205.2884497-2-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260122020205.2884497-1-liulongfang@huawei.com> References: <20260122020205.2884497-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: kwepems200002.china.huawei.com (7.221.188.68) 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 cf45f6370c36..d1e8053640a9 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -1188,9 +1188,32 @@ hisi_acc_vfio_pci_get_device_state(struct vfio_devic= e *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; + + if (hisi_acc_vdev->set_reset_flag) + clear_bit(QM_RESETTING, &qm->misc_ctl); =20 if (hisi_acc_vdev->core_device.vdev.migration_flags !=3D VFIO_MIGRATION_STOP_COPY) @@ -1734,6 +1757,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.33.0 From nobody Sun Feb 8 09:13:20 2026 Received: from canpmsgout04.his.huawei.com (canpmsgout04.his.huawei.com [113.46.200.219]) (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 4D57F22A7E4; Thu, 22 Jan 2026 02:03:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.219 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047395; cv=none; b=XBQTe86oRx4XRl0UyGH1ZcCHz3dBBgbd9yII4kaMc8quyqhjUP5FMtFa31+fEzV5d4hETj58VmP0t/eGlzG9hCE5PdOiLQOkHu5Pzuvx1uV/L9oUkk7S5mEY2Q1Xmuzpyw3Goj8gsNFna+Lq/N2AkKUDxhIeapY1HI4M3wxONC0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047395; c=relaxed/simple; bh=2xRimkzSn0A7i1JdGJrEEJqEm3LpS9E0IJWQysscSPM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f7moqyxiE9AJ7Trp0cPjikaoPnj2a83SkwUg8cMg9zVgAdZ8lVEphOMnnr2cu5YDCOxAN6dp13o6tHpd1WDrOGklF/5uBrsTQKdDIfWCAE7nVzya1BA85l0ax+CrAaYPPkIvo9qFUOGmJo+fl2Hy6RVStVnyUoNO3ffevS/OWkY= 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=pUPaEj7p; arc=none smtp.client-ip=113.46.200.219 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="pUPaEj7p" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=qC9EldMj8NO7SywXgi+osd3WYvH56InKn4LlSeQwKG0=; b=pUPaEj7pCIYHqpvdUyRgPgpo0aA8exoyLd/MRFhFRMxtE7t7NyAVyFWL520bD6msyre5ISgaY 9D7ChTWsb4mQ9WtFDq+8VE+254gnCqnsNbKmjwX0GyFaIlBhNhhp/nkoVf3BGT65jQqR6RHGT9o c7D2R7LkiCQX9g45zBHFRqo= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout04.his.huawei.com (SkyGuard) with ESMTPS id 4dxPQ74GpBz1prKl; Thu, 22 Jan 2026 09:59:43 +0800 (CST) Received: from dggpemf500015.china.huawei.com (unknown [7.185.36.143]) by mail.maildlp.com (Postfix) with ESMTPS id B95D240569; Thu, 22 Jan 2026 10:03:09 +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; Thu, 22 Jan 2026 10:03:09 +0800 From: Longfang Liu To: , , CC: , , Subject: [PATCH v2 2/4] hisi_acc_vfio_pci: update status after RAS error Date: Thu, 22 Jan 2026 10:02:03 +0800 Message-ID: <20260122020205.2884497-3-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260122020205.2884497-1-liulongfang@huawei.com> References: <20260122020205.2884497-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: kwepems200002.china.huawei.com (7.221.188.68) 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 d1e8053640a9..c69caef2e910 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -1215,8 +1215,7 @@ static void hisi_acc_vf_pci_aer_reset_done(struct pci= _dev *pdev) if (hisi_acc_vdev->set_reset_flag) clear_bit(QM_RESETTING, &qm->misc_ctl); =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 mutex_lock(&hisi_acc_vdev->state_mutex); --=20 2.33.0 From nobody Sun Feb 8 09:13:20 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 CFBFD3502B5; Thu, 22 Jan 2026 02:03: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=1769047430; cv=none; b=NzfHgkd2vkbUo+pw537EZsiFtzGafqpZn+4QFLu0ea1muXlet1SJ8HCfmOhiObKvKSx6K7UkoK67i86TvYqK1yDOKXjjeQGU9xIgHfQpODj3NLjq/kMby62WBfHwMA7mhquwtjz09EN9Ai2sBSNLKygzUjYFmo4qA3R+o0JdVQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047430; c=relaxed/simple; bh=+6hYcwpo6B/y0l1BV3A8yS1Gd0gu3SxEmB4U6t2O9U0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=k7sBDZSg3zm0ijh86wd4Ruyb1ch9EfFJcA9EecxAskxdHKPmvy06u/yHBgX/pEufG3k7kdZ/h7dCJ0c8wtGl1lU6mfd0E0hzYI97qKd/eFPc9nXo1deuSeTKlrHv6SJ3Gv+IU59EWUR0BMvRSx5Din6r1u9Rw1mTRKzsc0SUdWg= 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=X0XyR1yl; 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="X0XyR1yl" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=aFbb0Ff318wVp5lkg5op/8HHlyaW3gPAQEPWd3LLGEo=; b=X0XyR1ylL3KLFahh/e94CVClvO2oJ721xdd4V7aLxFB+Lb1q4UqipojwXncEh/CNGuomSDvwh LcwerNGl5YRk2egimHxgi8YbrriCagVctVC44G4hZkSztzVTM9Ks/hDotiMQq0NvObyqOawBXLH ajdwVNI2yk3fBCkyCo5kPJU= Received: from mail.maildlp.com (unknown [172.19.162.144]) by canpmsgout06.his.huawei.com (SkyGuard) with ESMTPS id 4dxPQm3c82zRhR4; Thu, 22 Jan 2026 10:00:16 +0800 (CST) Received: from dggpemf500015.china.huawei.com (unknown [7.185.36.143]) by mail.maildlp.com (Postfix) with ESMTPS id EE06A40567; Thu, 22 Jan 2026 10:03:40 +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; Thu, 22 Jan 2026 10:03:40 +0800 From: Longfang Liu To: , , CC: , , Subject: [PATCH v2 3/4] hisi_acc_vfio_pci: resolve duplicate migration states Date: Thu, 22 Jan 2026 10:02:04 +0800 Message-ID: <20260122020205.2884497-4-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260122020205.2884497-1-liulongfang@huawei.com> References: <20260122020205.2884497-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: kwepems200002.china.huawei.com (7.221.188.68) 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 c69caef2e910..483381189579 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -1569,6 +1569,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.33.0 From nobody Sun Feb 8 09:13:20 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 D5A0327E045; Thu, 22 Jan 2026 02:04:19 +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=1769047461; cv=none; b=bjEacR0JEQ6AyMQPm56h3XCRHKlH1Xgpa4srG4DEH12sFGjOzCUeDWuKpNQus0BfaI8NG8m+phKGojwlECYhq6IO65CSj+YsfvvTg2XJAHkUtrE263ocUlItn5J0xGj+uP/wqhZpCX6LEwubkbBqRQ2rFGMsB/J5GuDIpBehi6Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769047461; c=relaxed/simple; bh=xqzP7gAB/INyvRS6jUS+n5deBZbgLYREzvQIcAOfv+0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C0dypvVCOaEH68XbOs/wZOSc6QwSDdJGLco0YksHs5oaXxk+N8QKgfthgXbGj+EohQyr5MeA8Q4L8qC3vl/ydJb5P8eD7AuiWhmbtpiu78yy6/fy2/ZC4M0ObNuvV7q1VTDrMGnsyf2wmrSzmGQhAdCtUFy0jxYpI1ESy24BnU0= 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=H5t3NMSy; 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="H5t3NMSy" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=A/y88TE+BcSK9wV70vu1iD14mtgz2MdDmaDBOt2ZnNo=; b=H5t3NMSyHkBrBZKjyApUXjpIsORx9qJuJLnBZpthkwH8xzprM+t/ftWyChQAuywh+rGLcbAvH e4AGXDmYxO1YTMTfOw/xxVJvc181HfEfD94bOOMf2Gru64yTaGyoq5rIaObtHYHVEQeCTia369/ gARgBh0Jq04GIWlYHQwMCZc= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout01.his.huawei.com (SkyGuard) with ESMTPS id 4dxPQc3mhRz1T4hP; Thu, 22 Jan 2026 10:00:08 +0800 (CST) Received: from dggpemf500015.china.huawei.com (unknown [7.185.36.143]) by mail.maildlp.com (Postfix) with ESMTPS id 3345140569; Thu, 22 Jan 2026 10:04: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; Thu, 22 Jan 2026 10:04:11 +0800 From: Longfang Liu To: , , CC: , , Subject: [PATCH v2 4/4] hisi_acc_vfio_pci: fix the queue parameter anomaly issue Date: Thu, 22 Jan 2026 10:02:05 +0800 Message-ID: <20260122020205.2884497-5-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260122020205.2884497-1-liulongfang@huawei.com> References: <20260122020205.2884497-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: kwepems200002.china.huawei.com (7.221.188.68) 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/= pci/hisilicon/hisi_acc_vfio_pci.c index 483381189579..e61df3fe0db9 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -426,7 +426,7 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_de= vice *hisi_acc_vdev, ret =3D qm_get_vft(vf_qm, &vf_qm->qp_base); if (ret <=3D 0) { dev_err(dev, "failed to get vft qp nums\n"); - return ret; + return ret < 0 ? ret : -EINVAL; } =20 if (ret !=3D vf_data->qp_num) { --=20 2.33.0