Re: [RFC PATCH v2 1/9] vfio/pci: split vfio_pci_device into public and private parts

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

 



On Thu, 30 Jan 2020 21:09:56 -0500
Yan Zhao <yan.y.zhao@xxxxxxxxx> wrote:

> split vfio_pci_device into two parts:
> (1) a public part,
>     including pdev, num_region, irq_type which are accessible from
>     outside of vfio.
> (2) a private part,
>     a pointer to vfio_pci_device_private, only accessible within vfio
> 
> Cc: Kevin Tian <kevin.tian@xxxxxxxxx>
> Signed-off-by: Yan Zhao <yan.y.zhao@xxxxxxxxx>
> ---
>  drivers/vfio/pci/vfio_pci.c         | 209 +++++++++++++++-------------
>  drivers/vfio/pci/vfio_pci_config.c  | 157 +++++++++++----------
>  drivers/vfio/pci/vfio_pci_igd.c     |  16 +--
>  drivers/vfio/pci/vfio_pci_intrs.c   | 171 ++++++++++++-----------
>  drivers/vfio/pci/vfio_pci_nvlink2.c |  16 +--
>  drivers/vfio/pci/vfio_pci_private.h |   5 +-
>  drivers/vfio/pci/vfio_pci_rdwr.c    |  36 ++---
>  include/linux/vfio.h                |   7 +
>  8 files changed, 321 insertions(+), 296 deletions(-)

I think the typical solution to something like this would be...

struct vfio_pci_device {
	...
};

struct vfio_pci_device_private {
	struct vfio_pci_device vdev;
	...
};

External code would be able to work with the vfio_pci_device and
internal code would do a container_of() to get access to the private
fields.  What's done here is pretty ugly and not very cache friendly.
Thanks,

Alex




[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