Re: [PATCH v10 vfio 3/7] vfio/pds: register with the pds_core PF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/16/2023 12:04 AM, Tian, Kevin wrote:
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


From: Brett Creeley <brett.creeley@xxxxxxx>
Sent: Saturday, June 3, 2023 6:03 AM

+
+int pds_vfio_register_client_cmd(struct pds_vfio_pci_device *pds_vfio)
+{
+     struct pci_dev *pdev = pds_vfio_to_pci_dev(pds_vfio);
+     char devname[PDS_DEVNAME_LEN];
+     int ci;
+
+     snprintf(devname, sizeof(devname), "%s.%d-%u",
PDS_LM_DEV_NAME,
+              pci_domain_nr(pdev->bus), pds_vfio->pci_id);
+
+     ci = pds_client_register(pci_physfn(pdev), devname);
+     if (ci <= 0)
+             return ci;

'ci' cannot be 0 since pds_client_register() already converts 0 into
-EIO.

Yeah, Shameer already mentioned this and I have already fixed this issue for the next revision. Thanks.


btw the description of pds_client_register() is wrong. It said return
0 on success. should be positive client_id on success.

Yeah, this was also mentioned by Shameer. I will submit a follow on patch that updates the documentation in pds_client_register(). Thanks.



+struct pci_dev *pds_vfio_to_pci_dev(struct pds_vfio_pci_device *pds_vfio)
+{
+     return pds_vfio->vfio_coredev.pdev;
+}

Does this wrapper actually save the length?o

It wasn't so much about length but encapsulating the multiple de-references and multiple uses into a function call.



+     dev_dbg(&pdev->dev,
+             "%s: PF %#04x VF %#04x (%d) vf_id %d domain %d
pds_vfio %p\n",
+             __func__, pci_dev_id(pdev->physfn), pds_vfio->pci_id,
+             pds_vfio->pci_id, pds_vfio->vf_id, pci_domain_nr(pdev->bus),
+             pds_vfio);

why printing pds_vfio->pci_id twice?

Will fix. Thanks.



+#define PDS_LM_DEV_NAME              PDS_CORE_DRV_NAME "."
PDS_DEV_TYPE_LM_STR
+

should this name include a 'vfio' string?

This aligns with what our DSC/firmware expects, so no it's not needed.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux