Fix some bugs and clean code issues
Longfang Liu
maintainerv2 cover Fix some bugs and clean code issues
Modify two code bugs inside the driver, update the format of the driver's log and comments, and delete an unused macro definition.
Longfang Liu (5):
hisi_acc_vfio_pci: Fixes error return code issue
hisi_acc_vfio_pci: Fix device data address combination problem
hisi_acc_vfio_pci: Remove useless function parameter
hisi_acc_vfio_pci: Remove useless macro definitions
hisi_acc_vfio_pci: Update some log and comment formats
.../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 36 ++++++++++--------- .../vfio/pci/hisilicon/hisi_acc_vfio_pci.h | 7 ++-- 2 files changed, 22 insertions(+), 21 deletions(-)
Signature · 1 line
2.33.0
Longfang Liu
maintainerPATCH v2 1/5 hisi_acc_vfio_pci: Fixes error return code issue
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.
--- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +1 -1
@@ -405,7 +405,7 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev,if (vf_data->que_iso_cfg != que_iso_state) {dev_err (dev,"failed to match isolation state\n" ); -return ret; +return -EINVAL ; } ret =qm_write_regs (vf_qm,QM_VF_STATE , &vf_data->vf_qm_state,1 );
Signature · 1 line
2.33.0
Longfang Liu
maintainerPATCH v2 2/5 hisi_acc_vfio_pci: Fix device data address combination problem
In reply to Longfang LiuThe 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.
--- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +4 -4
@@ -528,12 +528,12 @@ static int vf_qm_state_save(struct hisi_acc_vf_core_device *hisi_acc_vdev,return -EINVAL ;/* Every reg is 32 bit, the dma address is 64 bit. */ - vf_data->eqe_dma = vf_data->qm_eqc_dw[2 ]; + vf_data->eqe_dma = vf_data->qm_eqc_dw[1 ]; vf_data->eqe_dma <<=QM_XQC_ADDR_OFFSET ; - vf_data->eqe_dma |= vf_data->qm_eqc_dw[1 ]; - vf_data->aeqe_dma = vf_data->qm_aeqc_dw[2 ]; + vf_data->eqe_dma |= vf_data->qm_eqc_dw[0 ]; + vf_data->aeqe_dma = vf_data->qm_aeqc_dw[1 ]; vf_data->aeqe_dma <<=QM_XQC_ADDR_OFFSET ; - vf_data->aeqe_dma |= vf_data->qm_aeqc_dw[1 ]; + vf_data->aeqe_dma |= vf_data->qm_aeqc_dw[0 ];/* Through SQC_BT/CQC_BT to get sqc and cqc address */ ret =qm_get_sqc (vf_qm, &vf_data->sqc_dma);
Signature · 1 line
2.33.0
Longfang Liu
maintainerPATCH v2 3/5 hisi_acc_vfio_pci: Remove useless function parameter
In reply to Longfang LiuRemove unused function parameters for vf_qm_fun_reset() and ensure the device is enabled before the reset operation is performed.
--- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +5 -3
@@ -345,8 +345,7 @@ static struct hisi_acc_vf_core_device *hssi_acc_drvdata(struct pci_dev *pdev) core_device); } -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;
@@ -662,7 +661,10 @@ static void hisi_acc_vf_start_device(struct hisi_acc_vf_core_device *hisi_acc_vdif (hisi_acc_vdev->vf_qm_state !=QM_READY )return ; -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); }static int hisi_acc_vf_load_state (struct hisi_acc_vf_core_device *hisi_acc_vdev)
Signature · 1 line
2.33.0
RE: [PATCH v2 3/5] hisi_acc_vfio_pci: Remove useless function parameter
Quoted 12 lines
-----Original Message-----
From: liulongfang
Sent: 22 September 2022 09:39
To: [email protected]; [email protected]; Shameerali Kolothum Thodi <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; liulongfang <[email protected]>
Subject: [PATCH v2 3/5]hisi_acc_vfio_pci: Remove useless function parameter
Quoted 5 lines
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 <[email protected]>
Hi Longfang,
This one seems to have a merge conflict on top of vfio/next branch. May be better to rebase and send a v3 picking up Jason's R-by as well?
Thanks,
Shameer
Quoted 36 lines
--- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +1
-2@@ -345,8 +345,7 @@ static struct hisi_acc_vf_core_device *hssi_acc_drvdata(struct pci_dev *pdev) core_device); } -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;@@ -662,7 +661,10 @@ static void hisi_acc_vf_start_device(struct
hisi_acc_vf_core_device*hisi_acc_vddrivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +4
-1if (hisi_acc_vdev->vf_qm_state !=QM_READY )return ; -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); } static int hisi_acc_vf_load_state(struct hisi_acc_vf_core_device
*hisi_acc_vdev)
--
2.33.0
liulongfang
maintainerRe: [PATCH v2 3/5] hisi_acc_vfio_pci: Remove useless function parameter
Quoted 16 lines · Shameerali Kolothum Thodi
Quoted 16 lines
-----Original Message-----
From: liulongfang
Sent: 22 September 2022 09:39
To: [email protected]; [email protected]; Shameerali Kolothum Thodi <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; liulongfang <[email protected]>
Subject: [PATCH v2 3/5]hisi_acc_vfio_pci: Remove useless function parameterRemove unused function parameters for
vf_qm_fun_reset()and ensure the device is enabled before the reset operation is performed.
Quoted 7 lines
Quoted 1 line
Signed-off-by Longfang Liu <[email protected]>Hi Longfang,
This one seems to have a merge conflict on top of vfio/next branch. May be better to rebase and send a v3 picking up Jason's R-by as well?
I merged this patchset to the latest tag version vfio-v6.0-rc5 of the vfio/next branch, and there is no merge conflict.
Which patchset do you refer to as "Jason's R-by"? Can you provide the title of this patchset?
Quoted 42 lines
Thanks,
ShameerQuoted 33 lines
--- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +1
-2@@ -345,8 +345,7 @@ static struct hisi_acc_vf_core_device *hssi_acc_drvdata(struct pci_dev *pdev) core_device); } -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;@@ -662,7 +661,10 @@ static void hisi_acc_vf_start_device(struct
hisi_acc_vf_core_device*hisi_acc_vddrivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +4
-1if (hisi_acc_vdev->vf_qm_state !=QM_READY )return ; -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); } static int hisi_acc_vf_load_state(struct hisi_acc_vf_core_deviceQuoted 3 lines
*hisi_acc_vdev)
--
2.33.0.
liulongfang
maintainerRe: [PATCH v2 3/5] hisi_acc_vfio_pci: Remove useless function parameter
On 2022/9/24 9:45, liulongfang Wrote:
Quoted 25 lines · Shameerali Kolothum Thodi
Quoted 16 lines
Quoted 16 lines
-----Original Message-----
From: liulongfang
Sent: 22 September 2022 09:39
To: [email protected]; [email protected]; Shameerali Kolothum Thodi <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; liulongfang <[email protected]>
Subject: [PATCH v2 3/5]hisi_acc_vfio_pci: Remove useless function parameterRemove unused function parameters for
vf_qm_fun_reset()and ensure the device is enabled before the reset operation is performed.Quoted 7 lines
Quoted 1 line
Signed-off-by Longfang Liu <[email protected]>Hi Longfang,
This one seems to have a merge conflict on top of vfio/next branch. May be better to rebase and send a v3 picking up Jason's R-by as well?
Quoted 6 lines
I merged this patchset to the latest tag version vfio-v6.0-rc5 of the vfio/next branch, and there is no merge conflict.
Which patchset do you refer to as "Jason's R-by"? Can you provide the title of this patchset?
I saw Jason's reply, and I reposted a v3 version with Jason's R-by.
Quoted 3 lines
Quoted 3 lines
Thanks,
Shameer
Thansk,
Longfang
Quoted 39 lines
Quoted 39 lines
Quoted 33 lines
--- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +1
-2@@ -345,8 +345,7 @@ static struct hisi_acc_vf_core_device *hssi_acc_drvdata(struct pci_dev *pdev) core_device); } -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;@@ -662,7 +661,10 @@ static void hisi_acc_vf_start_device(struct
hisi_acc_vf_core_device*hisi_acc_vddrivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +4
-1if (hisi_acc_vdev->vf_qm_state !=QM_READY )return ; -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); } static int hisi_acc_vf_load_state(struct hisi_acc_vf_core_deviceQuoted 3 lines
*hisi_acc_vdev)
--
2.33.0.
Longfang Liu
maintainerPATCH v2 4/5 hisi_acc_vfio_pci: Remove useless macro definitions
In reply to Longfang LiuThe QM_QUE_ISO_CFG macro definition is no longer used and needs to be deleted from the current driver.
--- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h | 1 - 1 file changed, 1 deletion(-)
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h +0 -1
@@ -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#define QM_VFT_CFG_RDY 0x10006c#define QM_VFT_CFG_OP_WR 0x100058
Signature · 1 line
2.33.0
Longfang Liu
maintainerPATCH v2 5/5 hisi_acc_vfio_pci: Update some log and comment formats
In reply to Longfang Liu1. Modify some annotation information formats to keep the entire driver annotation format consistent.
2. Modify some log description formats to be consistent with the format of the entire driver log.
--- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 18 +++++++++--------- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +9 -9
@@ -16,7 +16,7 @@#include "hisi_acc_vfio_pci.h" -/* return 0 on VM acc device ready, -ETIMEDOUT hardware timeout */ +/* Return 0 on VM acc device ready, -ETIMEDOUT hardware timeout */ static int qm_wait_dev_not_ready (struct hisi_qm *qm) {u32 val;
@@ -189,7 +189,7 @@ static int qm_set_regs(struct hisi_qm *qm, struct acc_vf_data *vf_data)struct device *dev = &qm->pdev->dev;int ret; -/* check VF state */ +/* Check VF state */ if (unlikely (hisi_qm_wait_mb_ready (qm))) {dev_err (&qm->pdev->dev,"QM device is not ready to write\n" );return -EBUSY ;
@@ -381,7 +381,7 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev,return -EINVAL ; } -/* vf qp num check */ +/* VF qp num check */ ret =qm_get_vft (vf_qm, &vf_qm->qp_base);if (ret <=0 ) {dev_err (dev,"failed to get vft qp nums\n" );
@@ -395,7 +395,7 @@ static int vf_qm_check_match(struct hisi_acc_vf_core_device *hisi_acc_vdev, vf_qm->qp_num = ret; -/* vf isolation state check */ +/* VF isolation state check */ ret =qm_read_regs (pf_qm,QM_QUE_ISO_CFG_V , &que_iso_state,1 );if (ret) {dev_err (dev,"failed to read QM_QUE_ISO_CFG_V\n" );
@@ -426,10 +426,10 @@ static int vf_qm_get_match_data(struct hisi_acc_vf_core_device *hisi_acc_vdev,int ret; vf_data->acc_magic =ACC_DEV_MAGIC ; -/* save device id */ +/* Save device id */ vf_data->dev_id = hisi_acc_vdev->vf_dev->device; -/* vf qp num save from PF */ +/* VF qp num save from PF */ ret =pf_qm_get_qp_num (pf_qm, vf_id, &vf_data->qp_base);if (ret <=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_device *hisi_acc_vdev, ret =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; } ret =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; } ret =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; }
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h +3 -3
@@ -79,7 +79,7 @@ struct acc_vf_data {/* QM reserved 5 regs */ u32 qm_rsv_regs[5 ];u32 padding; -/* qm memory init information */ +/* QM memory init information */ u64 eqe_dma;u64 aeqe_dma;u64 sqc_dma;
@@ -98,7 +98,7 @@ struct hisi_acc_vf_migration_file {struct hisi_acc_vf_core_device {struct vfio_pci_core_device core_device;u8 deferred_reset:1 ; -/* for migration state */ +/* For migration state */ struct mutex state_mutex;enum vfio_device_mig_state mig_state;struct pci_dev *pf_dev;
@@ -107,7 +107,7 @@ struct hisi_acc_vf_core_device {struct hisi_qm vf_qm;u32 vf_qm_state;int vf_id; -/* for reset handler */ +/* For reset handler */ spinlock_t reset_lock;struct hisi_acc_vf_migration_file *resuming_migf;struct hisi_acc_vf_migration_file *saving_migf;
Signature · 1 line
2.33.0
Quoted 10 lines · Longfang Liu
Modify two code bugs inside the driver, update the format of the driver's log and comments, and delete an unused macro definition.
Longfang Liu (5):
hisi_acc_vfio_pci: Fixes error return code issue
hisi_acc_vfio_pci: Fix device data address combination problem
hisi_acc_vfio_pci: Remove useless function parameter
hisi_acc_vfio_pci: Remove useless macro definitions
hisi_acc_vfio_pci: Update some log and comment formats
Quoted 3 lines
.../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 36 ++++++++++--------- .../vfio/pci/hisilicon/hisi_acc_vfio_pci.h | 7 ++-- 2 files changed, 22 insertions(+), 21 deletions(-)
For the series
Jason