On 2024/10/24 21:12, Shameerali Kolothum Thodi wrote: > > >> -----Original Message----- >> From: liulongfang <liulongfang@xxxxxxxxxx> >> Sent: Wednesday, October 16, 2024 2:23 AM >> To: alex.williamson@xxxxxxxxxx; jgg@xxxxxxxxxx; Shameerali Kolothum >> Thodi <shameerali.kolothum.thodi@xxxxxxxxxx>; Jonathan Cameron >> <jonathan.cameron@xxxxxxxxxx> >> Cc: kvm@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; >> linuxarm@xxxxxxxxxxxxx; liulongfang <liulongfang@xxxxxxxxxx> >> Subject: [PATCH v10 3/4] hisi_acc_vfio_pci: register debugfs for hisilicon >> migration driver > > [..] > >> @@ -1342,6 +1538,7 @@ static int hisi_acc_vfio_pci_migrn_init_dev(struct >> vfio_device *core_vdev) >> hisi_acc_vdev->pf_qm = pf_qm; >> hisi_acc_vdev->vf_dev = pdev; >> mutex_init(&hisi_acc_vdev->state_mutex); >> + mutex_init(&hisi_acc_vdev->open_mutex); >> >> core_vdev->migration_flags = VFIO_MIGRATION_STOP_COPY | >> VFIO_MIGRATION_PRE_COPY; >> core_vdev->mig_ops = &hisi_acc_vfio_pci_migrn_state_ops; >> @@ -1413,6 +1610,9 @@ static int hisi_acc_vfio_pci_probe(struct pci_dev >> *pdev, const struct pci_device >> ret = vfio_pci_core_register_device(&hisi_acc_vdev->core_device); >> if (ret) >> goto out_put_vdev; >> + >> + if (ops == &hisi_acc_vfio_pci_migrn_ops) >> + hisi_acc_vfio_debug_init(hisi_acc_vdev); > > As commented earlier, the ops check can be moved to the debug_init() function > and you can remove ops check for the debug_exit() below. You may have to > rearrange the functions to avoid the compiler error you mentioned in previous > version to do so. > OK, I'll put it into debug_init in the next version. >> return 0; >> >> out_put_vdev: >> @@ -1423,8 +1623,11 @@ static int hisi_acc_vfio_pci_probe(struct pci_dev >> *pdev, const struct pci_device >> static void hisi_acc_vfio_pci_remove(struct pci_dev *pdev) >> { >> struct hisi_acc_vf_core_device *hisi_acc_vdev = >> hisi_acc_drvdata(pdev); >> + struct vfio_device *vdev = &hisi_acc_vdev->core_device.vdev; >> >> vfio_pci_core_unregister_device(&hisi_acc_vdev->core_device); >> + if (vdev->ops == &hisi_acc_vfio_pci_migrn_ops) >> + hisi_acc_vf_debugfs_exit(hisi_acc_vdev); > > As mentioned above remove the ops check here. > OK. > With the above ones checked and fixed, > Reviewed-by: Shameer Kolothum <shameerali.kolothum.thodi@xxxxxxxxxx> > . > Thanks, Longfang.