From: Yan Zhao <yan.y.zhao@intel.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"cohuck@redhat.com" <cohuck@redhat.com>,
"zhenyuw@linux.intel.com" <zhenyuw@linux.intel.com>,
"Wang, Zhi A" <zhi.a.wang@intel.com>,
"Tian, Kevin" <kevin.tian@intel.com>,
"He, Shaopeng" <shaopeng.he@intel.com>,
"Liu, Yi L" <yi.l.liu@intel.com>
Subject: Re: [RFC PATCH v3 1/9] vfio/pci: export vfio_pci_device public and add vfio_pci_device_private
Date: Fri, 21 Feb 2020 01:19:29 -0500 [thread overview]
Message-ID: <20200221061929.GC30338@joy-OptiPlex-7040> (raw)
In-Reply-To: <20200220140011.79621d7f@w520.home>
On Fri, Feb 21, 2020 at 05:00:11AM +0800, Alex Williamson wrote:
> On Tue, 11 Feb 2020 05:10:38 -0500
> Yan Zhao <yan.y.zhao@intel.com> wrote:
>
> > (1) make vfio_pci_device public, so it is accessible from external code.
> > (2) add a private struct vfio_pci_device_private, which is only accessible
> > from internal code. It extends struct vfio_pci_device.
> >
> > Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
> > ---
> > drivers/vfio/pci/vfio_pci.c | 256 +++++++++++++++-------------
> > drivers/vfio/pci/vfio_pci_config.c | 186 ++++++++++++--------
> > drivers/vfio/pci/vfio_pci_igd.c | 19 ++-
> > drivers/vfio/pci/vfio_pci_intrs.c | 186 +++++++++++---------
> > drivers/vfio/pci/vfio_pci_nvlink2.c | 22 +--
> > drivers/vfio/pci/vfio_pci_private.h | 7 +-
> > drivers/vfio/pci/vfio_pci_rdwr.c | 40 +++--
> > include/linux/vfio.h | 5 +
> > 8 files changed, 408 insertions(+), 313 deletions(-)
>
> [SNIP!]
>
> > diff --git a/include/linux/vfio.h b/include/linux/vfio.h
> > index e42a711a2800..70a2b8fb6179 100644
> > --- a/include/linux/vfio.h
> > +++ b/include/linux/vfio.h
> > @@ -195,4 +195,9 @@ extern int vfio_virqfd_enable(void *opaque,
> > void *data, struct virqfd **pvirqfd, int fd);
> > extern void vfio_virqfd_disable(struct virqfd **pvirqfd);
> >
> > +struct vfio_pci_device {
> > + struct pci_dev *pdev;
> > + int num_regions;
> > + int irq_type;
> > +};
> > #endif /* VFIO_H */
>
> Hi Yan,
>
> Sorry for the delay. I'm still not very happy with this result, I was
> hoping the changes could be done less intrusively. Maybe here's
> another suggestion, why can't the vendor driver use a struct
> vfio_pci_device* as an opaque pointer? If you only want these three
> things initially, I think this whole massive patch can be reduced to:
>
> struct pci_dev *vfio_pci_pdev(struct vfio_pci_device *vdev)
> {
> return vdev->pdev;
> }
> EXPORT_SYMBOL_GPL(vfio_pci_dev);
>
> int vfio_pci_num_regions(struct vfio_pci_device *vdev)
> {
> return vdev->num_regions;
> }
> EXPORT_SYMBOL_GPL(vfio_pci_num_region);
>
> int vfio_pci_irq_type(struct vfio_pci_device *vdev)
> {
> return vdev->irq_type;
> }
> EXPORT_SYMBOL_GPL(vfio_pci_irq_type);
>
> This is how vfio-pci works with vfio, we don't know a struct
> vfio_device as anything other than an opaque pointer and we have access
> function where we need to see some property of that object.
>
> Patch 5/9 would become a vfio_pci_set_vendor_regions() interface.
>
you are right!
I'll change it to this way. Thanks.
Yan
next prev parent reply other threads:[~2020-02-21 6:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-11 9:57 [RFC PATCH v3 0/9] Introduce vendor ops in vfio-pci Yan Zhao
2020-02-11 10:10 ` [RFC PATCH v3 1/9] vfio/pci: export vfio_pci_device public and add vfio_pci_device_private Yan Zhao
2020-02-20 21:00 ` Alex Williamson
2020-02-21 6:19 ` Yan Zhao [this message]
2020-02-11 10:11 ` [RFC PATCH v3 2/9] vfio/pci: export functions in vfio_pci_ops Yan Zhao
2020-02-11 10:11 ` [RFC PATCH v3 3/9] vfio/pci: register/unregister vfio_pci_vendor_driver_ops Yan Zhao
2020-02-11 10:12 ` [RFC PATCH v3 4/9] vfio/pci: macros to generate module_init and module_exit for vendor modules Yan Zhao
2020-02-11 10:13 ` [RFC PATCH v3 5/9] vfio/pci: let vfio_pci know how many vendor regions are registered Yan Zhao
2020-02-11 10:14 ` [RFC PATCH v3 6/9] vfio/pci: export vfio_pci_setup_barmap Yan Zhao
2020-02-20 21:00 ` Alex Williamson
2020-02-21 6:20 ` Yan Zhao
2020-02-11 10:14 ` [RFC PATCH v3 7/9] samples/vfio-pci: add a sample vendor module of vfio-pci for IGD devices Yan Zhao
2020-02-11 10:15 ` [RFC PATCH v3 8/9] vfio: header for vfio live migration region Yan Zhao
2020-02-11 10:15 ` [RFC PATCH v3 9/9] i40e/vf_migration: vfio-pci vendor driver for VF live migration Yan Zhao
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=20200221061929.GC30338@joy-OptiPlex-7040 \
--to=yan.y.zhao@intel.com \
--cc=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shaopeng.he@intel.com \
--cc=yi.l.liu@intel.com \
--cc=zhenyuw@linux.intel.com \
--cc=zhi.a.wang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox