Merge tag 'vfio-v4.21-rc1' of git://github.com/awilliam/linux-vfio
[sfrench/cifs-2.6.git] / drivers / vfio / pci / vfio_pci_private.h
index 86aab05d3d46b848ae4576d5aca5694da8ac1cfe..8c0009f008186cc1e6bfbc26965e8df60555a693 100644 (file)
@@ -62,6 +62,9 @@ struct vfio_pci_regops {
        int     (*mmap)(struct vfio_pci_device *vdev,
                        struct vfio_pci_region *region,
                        struct vm_area_struct *vma);
+       int     (*add_capability)(struct vfio_pci_device *vdev,
+                                 struct vfio_pci_region *region,
+                                 struct vfio_info_cap *caps);
 };
 
 struct vfio_pci_region {
@@ -79,6 +82,11 @@ struct vfio_pci_dummy_resource {
        struct list_head        res_next;
 };
 
+struct vfio_pci_reflck {
+       struct kref             kref;
+       struct mutex            lock;
+};
+
 struct vfio_pci_device {
        struct pci_dev          *pdev;
        void __iomem            *barmap[PCI_STD_RESOURCE_END + 1];
@@ -107,6 +115,7 @@ struct vfio_pci_device {
        bool                    needs_reset;
        bool                    nointx;
        struct pci_saved_state  *pci_saved_state;
+       struct vfio_pci_reflck  *reflck;
        int                     refcnt;
        int                     ioeventfds_nr;
        struct eventfd_ctx      *err_trigger;
@@ -160,4 +169,18 @@ static inline int vfio_pci_igd_init(struct vfio_pci_device *vdev)
        return -ENODEV;
 }
 #endif
+#ifdef CONFIG_VFIO_PCI_NVLINK2
+extern int vfio_pci_nvdia_v100_nvlink2_init(struct vfio_pci_device *vdev);
+extern int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev);
+#else
+static inline int vfio_pci_nvdia_v100_nvlink2_init(struct vfio_pci_device *vdev)
+{
+       return -ENODEV;
+}
+
+static inline int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
+{
+       return -ENODEV;
+}
+#endif
 #endif /* VFIO_PCI_PRIVATE_H */