From: Jason Gunthorpe <jgg@nvidia.com>
To: Brett Creeley <bcreeley@amd.com>
Cc: Brett Creeley <brett.creeley@amd.com>,
kvm@vger.kernel.org, netdev@vger.kernel.org,
alex.williamson@redhat.com, yishaih@nvidia.com,
shameerali.kolothum.thodi@huawei.com, kevin.tian@intel.com,
simon.horman@corigine.com, shannon.nelson@amd.com
Subject: Re: [PATCH v13 vfio 3/7] vfio/pds: register with the pds_core PF
Date: Fri, 4 Aug 2023 19:42:43 -0300 [thread overview]
Message-ID: <ZM1+48h9EcqqXrZI@nvidia.com> (raw)
In-Reply-To: <afdd5231-cd7b-c940-7c51-c522b4cb5b90@amd.com>
On Fri, Aug 04, 2023 at 12:21:21PM -0700, Brett Creeley wrote:
> > > > +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.
>
> After taking another look this was intentional. I'm getting the PF pci_dev,
> not the PF's drvdata.
pds_client_register() gets the drvdata from the passed PCI function,
you have to use pci_iov_get_pf_drvdata() to do this. You can't
shortcut it like this.
This is all nonsensical, the existing callers start with aa pdsc:
int pdsc_auxbus_dev_add(struct pdsc *cf, struct pdsc *pf)
Then they call
client_id = pds_client_register(pf->pdev, devname);
Which then does
struct pdsc *pf;
pf = pci_get_drvdata(pf_pdev);
Just pass in the pdsc you already had
Add another wrapper to get the pdsc from a VF using
pci_iov_get_pf_drvdata() like you are supposed to.
Jason
next prev parent reply other threads:[~2023-08-04 22:43 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 21:40 [PATCH v13 vfio 0/7] pds-vfio-pci driver Brett Creeley
2023-07-25 21:40 ` [PATCH v13 vfio 1/7] vfio: Commonize combine_ranges for use in other VFIO drivers Brett Creeley
2023-08-04 16:51 ` Jason Gunthorpe
2023-07-25 21:40 ` [PATCH v13 vfio 2/7] vfio/pds: Initial support for pds VFIO driver Brett Creeley
2023-07-25 21:40 ` [PATCH v13 vfio 3/7] vfio/pds: register with the pds_core PF Brett Creeley
2023-07-31 20:57 ` Alex Williamson
2023-08-01 15:44 ` Brett Creeley
2023-08-04 17:03 ` Jason Gunthorpe
2023-08-04 17:23 ` Brett Creeley
2023-08-04 19:21 ` Brett Creeley
2023-08-04 22:42 ` Jason Gunthorpe [this message]
2023-08-07 17:28 ` Brett Creeley
2023-07-25 21:40 ` [PATCH v13 vfio 4/7] vfio/pds: Add VFIO live migration support Brett Creeley
2023-07-25 21:40 ` [PATCH v13 vfio 5/7] vfio/pds: Add support for dirty page tracking Brett Creeley
2023-08-03 12:43 ` Shameerali Kolothum Thodi
2023-08-03 19:53 ` Brett Creeley
2023-07-25 21:40 ` [PATCH v13 vfio 6/7] vfio/pds: Add support for firmware recovery Brett Creeley
2023-08-04 17:18 ` Jason Gunthorpe
2023-08-04 17:34 ` Brett Creeley
2023-08-04 18:03 ` Jason Gunthorpe
2023-08-04 18:50 ` Brett Creeley
2023-08-10 3:46 ` Tian, Kevin
2023-07-25 21:40 ` [PATCH v13 vfio 7/7] vfio/pds: Add Kconfig and documentation Brett Creeley
2023-07-26 13:35 ` [PATCH v13 vfio 0/7] pds-vfio-pci driver Jason Gunthorpe
2023-07-26 18:50 ` Alex Williamson
2023-07-26 19:05 ` Brett Creeley
2023-07-26 19:25 ` Alex Williamson
2023-08-03 8:28 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZM1+48h9EcqqXrZI@nvidia.com \
--to=jgg@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=bcreeley@amd.com \
--cc=brett.creeley@amd.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=shannon.nelson@amd.com \
--cc=simon.horman@corigine.com \
--cc=yishaih@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.