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

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

 



On 8/4/2023 10:03 AM, Jason Gunthorpe wrote:
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


On Tue, Jul 25, 2023 at 02:40:21PM -0700, Brett Creeley wrote:

diff --git a/drivers/vfio/pci/pds/cmds.c b/drivers/vfio/pci/pds/cmds.c
new file mode 100644
index 000000000000..198e8e2ed002
--- /dev/null
+++ b/drivers/vfio/pci/pds/cmds.c
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright(c) 2023 Advanced Micro Devices, Inc. */
+
+#include <linux/io.h>
+#include <linux/types.h>
+
+#include <linux/pds/pds_common.h>
+#include <linux/pds/pds_core_if.h>
+#include <linux/pds/pds_adminq.h>
+
+#include "vfio_dev.h"
+#include "cmds.h"
+
+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_VFIO_LM_DEV_NAME,
+              pci_domain_nr(pdev->bus),
+              PCI_DEVID(pdev->bus->number, pdev->devfn));
+
+     ci = pds_client_register(pci_physfn(pdev), devname);
+     if (ci < 0)
+             return ci;

This is not the right way to get the drvdata of a PCI PF from a VF,
you must call pci_iov_get_pf_drvdata().

Jason

Okay, I will look at this and fix it up on the next version.

Thanks,

Brett



[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