From nobody Fri Apr 3 06:44:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3279FECAAD3 for ; Thu, 15 Sep 2022 01:35:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbiIOBfO (ORCPT ); Wed, 14 Sep 2022 21:35:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229701AbiIOBfL (ORCPT ); Wed, 14 Sep 2022 21:35:11 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC9522980C for ; Wed, 14 Sep 2022 18:35:10 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MSfmp5ZD0zmVNH; Thu, 15 Sep 2022 09:31:22 +0800 (CST) Received: from kwepemm600005.china.huawei.com (7.193.23.191) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 15 Sep 2022 09:35:08 +0800 Received: from huawei.com (10.69.192.56) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 15 Sep 2022 09:35:08 +0800 From: Longfang Liu To: , , CC: , , , Subject: [PATCH 1/5] hisi_acc_vfio_pci: Fixes a memory leak bug Date: Thu, 15 Sep 2022 09:31:53 +0800 Message-ID: <20220915013157.60771-2-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220915013157.60771-1-liulongfang@huawei.com> References: <20220915013157.60771-1-liulongfang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600005.china.huawei.com (7.193.23.191) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" During the stop copy phase of live migration, the driver allocates a memory for the migrated data to save the data. When an exception occurs when the driver reads device data, the driver will report an error to qemu and exit the current migration state. But this memory is not released, which will lead to a memory leak problem. So we need to add a memory release operation. Reviewed-by: Shameer Kolothum Signed-off-by: Longfang Liu --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/= pci/hisilicon/hisi_acc_vfio_pci.c index ea762e28c1cc..8fd68af2ed5f 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -828,15 +828,15 @@ hisi_acc_vf_stop_copy(struct hisi_acc_vf_core_device = *hisi_acc_vdev) return ERR_PTR(err); } =20 - stream_open(migf->filp->f_inode, migf->filp); - mutex_init(&migf->lock); - ret =3D vf_qm_state_save(hisi_acc_vdev, migf); if (ret) { - fput(migf->filp); + kfree(migf); return ERR_PTR(ret); } =20 + stream_open(migf->filp->f_inode, migf->filp); + mutex_init(&migf->lock); + return migf; } =20 --=20 2.33.0 From nobody Fri Apr 3 06:44:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3CA3ECAAD3 for ; Thu, 15 Sep 2022 01:35:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229951AbiIOBfp (ORCPT ); Wed, 14 Sep 2022 21:35:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229701AbiIOBfm (ORCPT ); Wed, 14 Sep 2022 21:35:42 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0D5D6AA3A for ; Wed, 14 Sep 2022 18:35:41 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MSfn943ntz14QNT; Thu, 15 Sep 2022 09:31:41 +0800 (CST) Received: from kwepemm600005.china.huawei.com (7.193.23.191) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 15 Sep 2022 09:35:39 +0800 Received: from huawei.com (10.69.192.56) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 15 Sep 2022 09:35:39 +0800 From: Longfang Liu To: , , CC: , , , Subject: [PATCH 2/5] hisi_acc_vfio_pci: Fixes error return code issue Date: Thu, 15 Sep 2022 09:31:54 +0800 Message-ID: <20220915013157.60771-3-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220915013157.60771-1-liulongfang@huawei.com> References: <20220915013157.60771-1-liulongfang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600005.china.huawei.com (7.193.23.191) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" During the process of compatibility and matching of live migration device information, if the isolation status of the two devices is inconsistent, the live migration needs to be exited. The current driver does not return the error code correctly and needs to be fixed. Reviewed-by: Shameer Kolothum 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 8fd68af2ed5f..3790b76a578e 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -405,7 +405,7 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_de= vice *hisi_acc_vdev, =20 if (vf_data->que_iso_cfg !=3D que_iso_state) { dev_err(dev, "failed to match isolation state\n"); - return ret; + return -EINVAL; } =20 ret =3D qm_write_regs(vf_qm, QM_VF_STATE, &vf_data->vf_qm_state, 1); --=20 2.33.0 From nobody Fri Apr 3 06:44:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92853C6FA82 for ; Thu, 15 Sep 2022 01:36:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230000AbiIOBgR (ORCPT ); Wed, 14 Sep 2022 21:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229761AbiIOBgN (ORCPT ); Wed, 14 Sep 2022 21:36:13 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A30958C478 for ; Wed, 14 Sep 2022 18:36:12 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MSfnm4Gfmz14QNR; Thu, 15 Sep 2022 09:32:12 +0800 (CST) Received: from kwepemm600005.china.huawei.com (7.193.23.191) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 15 Sep 2022 09:36:10 +0800 Received: from huawei.com (10.69.192.56) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 15 Sep 2022 09:36:10 +0800 From: Longfang Liu To: , , CC: , , , Subject: [PATCH 3/5] hisi_acc_vfio_pci: Remove useless function parameter Date: Thu, 15 Sep 2022 09:31:55 +0800 Message-ID: <20220915013157.60771-4-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220915013157.60771-1-liulongfang@huawei.com> References: <20220915013157.60771-1-liulongfang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600005.china.huawei.com (7.193.23.191) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Remove unused function parameters for vf_qm_fun_reset() and ensure the device is enabled before the reset operation is performed. Signed-off-by: Longfang Liu --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/= pci/hisilicon/hisi_acc_vfio_pci.c index 3790b76a578e..c172a52088b7 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -345,8 +345,7 @@ static struct hisi_acc_vf_core_device *hssi_acc_drvdata= (struct pci_dev *pdev) core_device); } =20 -static void vf_qm_fun_reset(struct hisi_acc_vf_core_device *hisi_acc_vdev, - struct hisi_qm *qm) +static void vf_qm_fun_reset(struct hisi_qm *qm) { int i; =20 @@ -662,7 +661,10 @@ static void hisi_acc_vf_start_device(struct hisi_acc_v= f_core_device *hisi_acc_vd if (hisi_acc_vdev->vf_qm_state !=3D QM_READY) return; =20 - vf_qm_fun_reset(hisi_acc_vdev, vf_qm); + /* Make sure the device is enabled */ + qm_dev_cmd_init(vf_qm); + + vf_qm_fun_reset(vf_qm); } =20 static int hisi_acc_vf_load_state(struct hisi_acc_vf_core_device *hisi_acc= _vdev) --=20 2.33.0 From nobody Fri Apr 3 06:44:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A58F8ECAAD3 for ; Thu, 15 Sep 2022 01:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230018AbiIOBgs (ORCPT ); Wed, 14 Sep 2022 21:36:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbiIOBgo (ORCPT ); Wed, 14 Sep 2022 21:36:44 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07D7F8C46B for ; Wed, 14 Sep 2022 18:36:43 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MSfpb4P5vzmVCC; Thu, 15 Sep 2022 09:32:55 +0800 (CST) Received: from kwepemm600005.china.huawei.com (7.193.23.191) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 15 Sep 2022 09:36:41 +0800 Received: from huawei.com (10.69.192.56) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 15 Sep 2022 09:36:41 +0800 From: Longfang Liu To: , , CC: , , , Subject: [PATCH 4/5] hisi_acc_vfio_pci: Fix device data address combination problem Date: Thu, 15 Sep 2022 09:31:56 +0800 Message-ID: <20220915013157.60771-5-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220915013157.60771-1-liulongfang@huawei.com> References: <20220915013157.60771-1-liulongfang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600005.china.huawei.com (7.193.23.191) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The queue address of the accelerator device should be combined into a dma address in a way of combining the low and high bits. The previous combination is wrong and needs to be modified. Signed-off-by: Longfang Liu --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/= pci/hisilicon/hisi_acc_vfio_pci.c index c172a52088b7..fce49c7f5db8 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -527,12 +527,12 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_d= evice *hisi_acc_vdev, return -EINVAL; =20 /* Every reg is 32 bit, the dma address is 64 bit. */ - vf_data->eqe_dma =3D vf_data->qm_eqc_dw[2]; + vf_data->eqe_dma =3D vf_data->qm_eqc_dw[1]; vf_data->eqe_dma <<=3D QM_XQC_ADDR_OFFSET; - vf_data->eqe_dma |=3D vf_data->qm_eqc_dw[1]; - vf_data->aeqe_dma =3D vf_data->qm_aeqc_dw[2]; + vf_data->eqe_dma |=3D vf_data->qm_eqc_dw[0]; + vf_data->aeqe_dma =3D vf_data->qm_aeqc_dw[1]; vf_data->aeqe_dma <<=3D QM_XQC_ADDR_OFFSET; - vf_data->aeqe_dma |=3D vf_data->qm_aeqc_dw[1]; + vf_data->aeqe_dma |=3D vf_data->qm_aeqc_dw[0]; =20 /* Through SQC_BT/CQC_BT to get sqc and cqc address */ ret =3D qm_get_sqc(vf_qm, &vf_data->sqc_dma); --=20 2.33.0 From nobody Fri Apr 3 06:44:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3317C6FA82 for ; Thu, 15 Sep 2022 01:37:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbiIOBhT (ORCPT ); Wed, 14 Sep 2022 21:37:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbiIOBhP (ORCPT ); Wed, 14 Sep 2022 21:37:15 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 895A98C460 for ; Wed, 14 Sep 2022 18:37:14 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MSfpD4RmtzNmGP; Thu, 15 Sep 2022 09:32:36 +0800 (CST) Received: from kwepemm600005.china.huawei.com (7.193.23.191) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 15 Sep 2022 09:37:12 +0800 Received: from huawei.com (10.69.192.56) by kwepemm600005.china.huawei.com (7.193.23.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 15 Sep 2022 09:37:12 +0800 From: Longfang Liu To: , , CC: , , , Subject: [PATCH 5/5] hisi_acc_vfio_pci: Fix some clean code issues Date: Thu, 15 Sep 2022 09:31:57 +0800 Message-ID: <20220915013157.60771-6-liulongfang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220915013157.60771-1-liulongfang@huawei.com> References: <20220915013157.60771-1-liulongfang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600005.china.huawei.com (7.193.23.191) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 1.Fix some code comments 2.Fix some code style issues 3.Delete an unused macro definition Signed-off-by: Longfang Liu --- .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 40 +++++++++---------- .../vfio/pci/hisilicon/hisi_acc_vfio_pci.h | 1 - 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/= pci/hisilicon/hisi_acc_vfio_pci.c index fce49c7f5db8..c4857e171da9 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -426,10 +426,10 @@ static int vf_qm_get_match_data(struct hisi_acc_vf_co= re_device *hisi_acc_vdev, int ret; =20 vf_data->acc_magic =3D ACC_DEV_MAGIC; - /* save device id */ + /* Save device id */ vf_data->dev_id =3D hisi_acc_vdev->vf_dev->device; =20 - /* vf qp num save from PF */ + /* VF qp num save from PF */ ret =3D pf_qm_get_qp_num(pf_qm, vf_id, &vf_data->qp_base); if (ret <=3D 0) { dev_err(dev, "failed to get vft qp nums!\n"); @@ -473,19 +473,19 @@ static int vf_qm_load_data(struct hisi_acc_vf_core_de= vice *hisi_acc_vdev, =20 ret =3D qm_set_regs(qm, vf_data); if (ret) { - dev_err(dev, "Set VF regs failed\n"); + dev_err(dev, "set VF regs failed\n"); return ret; } =20 ret =3D hisi_qm_mb(qm, QM_MB_CMD_SQC_BT, qm->sqc_dma, 0, 0); if (ret) { - dev_err(dev, "Set sqc failed\n"); + dev_err(dev, "set sqc failed\n"); return ret; } =20 ret =3D hisi_qm_mb(qm, QM_MB_CMD_CQC_BT, qm->cqc_dma, 0, 0); if (ret) { - dev_err(dev, "Set cqc failed\n"); + dev_err(dev, "set cqc failed\n"); return ret; } =20 @@ -640,15 +640,16 @@ static void hisi_acc_vf_disable_fds(struct hisi_acc_v= f_core_device *hisi_acc_vde static void hisi_acc_vf_state_mutex_unlock(struct hisi_acc_vf_core_device *hisi_acc_vd= ev) { -again: - spin_lock(&hisi_acc_vdev->reset_lock); - if (hisi_acc_vdev->deferred_reset) { + while (true) { + spin_lock(&hisi_acc_vdev->reset_lock); + if (!hisi_acc_vdev->deferred_reset) + break; + hisi_acc_vdev->deferred_reset =3D false; spin_unlock(&hisi_acc_vdev->reset_lock); hisi_acc_vdev->vf_qm_state =3D QM_NOT_READY; hisi_acc_vdev->mig_state =3D VFIO_DEVICE_STATE_RUNNING; hisi_acc_vf_disable_fds(hisi_acc_vdev); - goto again; } mutex_unlock(&hisi_acc_vdev->state_mutex); spin_unlock(&hisi_acc_vdev->reset_lock); @@ -709,10 +710,9 @@ static ssize_t hisi_acc_vf_resume_write(struct file *f= ilp, const char __user *bu =20 if (pos) return -ESPIPE; - pos =3D &filp->f_pos; =20 - if (*pos < 0 || - check_add_overflow((loff_t)len, *pos, &requested_length)) + if (filp->f_pos < 0 || + check_add_overflow((loff_t)len, filp->f_pos, &requested_length)) return -EINVAL; =20 if (requested_length > sizeof(struct acc_vf_data)) @@ -729,7 +729,7 @@ static ssize_t hisi_acc_vf_resume_write(struct file *fi= lp, const char __user *bu done =3D -EFAULT; goto out_unlock; } - *pos +=3D len; + filp->f_pos +=3D len; done =3D len; migf->total_length +=3D len; out_unlock: @@ -772,14 +772,14 @@ static ssize_t hisi_acc_vf_save_read(struct file *fil= p, char __user *buf, size_t { struct hisi_acc_vf_migration_file *migf =3D filp->private_data; ssize_t done =3D 0; + size_t min_len; int ret; =20 if (pos) return -ESPIPE; - pos =3D &filp->f_pos; =20 mutex_lock(&migf->lock); - if (*pos > migf->total_length) { + if (filp->f_pos > migf->total_length) { done =3D -EINVAL; goto out_unlock; } @@ -789,15 +789,15 @@ static ssize_t hisi_acc_vf_save_read(struct file *fil= p, char __user *buf, size_t goto out_unlock; } =20 - len =3D min_t(size_t, migf->total_length - *pos, len); - if (len) { - ret =3D copy_to_user(buf, &migf->vf_data, len); + min_len =3D min_t(size_t, migf->total_length - filp->f_pos, len); + if (min_len) { + ret =3D copy_to_user(buf, &migf->vf_data, min_len); if (ret) { done =3D -EFAULT; goto out_unlock; } - *pos +=3D len; - done =3D len; + filp->f_pos +=3D min_len; + done =3D min_len; } out_unlock: mutex_unlock(&migf->lock); diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h b/drivers/vfio/= pci/hisilicon/hisi_acc_vfio_pci.h index 5494f4983bbe..8e4bf21deae1 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h @@ -16,7 +16,6 @@ #define SEC_CORE_INT_STATUS 0x301008 #define HPRE_HAC_INT_STATUS 0x301800 #define HZIP_CORE_INT_STATUS 0x3010AC -#define QM_QUE_ISO_CFG 0x301154 =20 #define QM_VFT_CFG_RDY 0x10006c #define QM_VFT_CFG_OP_WR 0x100058 --=20 2.33.0