summaryrefslogtreecommitdiff
path: root/drivers/vfio/vfio.h
diff options
context:
space:
mode:
authorYi Liu <yi.l.liu@intel.com>2022-11-11 05:57:01 +0300
committerJason Gunthorpe <jgg@nvidia.com>2022-12-05 15:56:01 +0300
commit8da7a0e79f9b15330ae68d8532425399f4c27045 (patch)
treed08374512e4b256f706c14db3157a10744a78996 /drivers/vfio/vfio.h
parent1334e47ee798ac4715330a6ade0afc929cd54aff (diff)
downloadlinux-8da7a0e79f9b15330ae68d8532425399f4c27045.tar.xz
vfio: Refactor dma APIs for emulated devices
To use group helpers instead of opening group related code in the API. This prepares moving group specific code out of vfio_main.c. Link: https://lore.kernel.org/r/20221201145535.589687-10-yi.l.liu@intel.com Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Tested-by: Lixiao Yang <lixiao.yang@intel.com> Tested-by: Yu He <yu.he@intel.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/vfio/vfio.h')
-rw-r--r--drivers/vfio/vfio.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h
index ce5fe3fc493b..a112e8f2b291 100644
--- a/drivers/vfio/vfio.h
+++ b/drivers/vfio/vfio.h
@@ -122,13 +122,14 @@ int vfio_container_attach_group(struct vfio_container *container,
void vfio_group_detach_container(struct vfio_group *group);
void vfio_device_container_register(struct vfio_device *device);
void vfio_device_container_unregister(struct vfio_device *device);
-int vfio_container_pin_pages(struct vfio_container *container,
- struct iommu_group *iommu_group, dma_addr_t iova,
- int npage, int prot, struct page **pages);
-void vfio_container_unpin_pages(struct vfio_container *container,
- dma_addr_t iova, int npage);
-int vfio_container_dma_rw(struct vfio_container *container, dma_addr_t iova,
- void *data, size_t len, bool write);
+int vfio_device_container_pin_pages(struct vfio_device *device,
+ dma_addr_t iova, int npage,
+ int prot, struct page **pages);
+void vfio_device_container_unpin_pages(struct vfio_device *device,
+ dma_addr_t iova, int npage);
+int vfio_device_container_dma_rw(struct vfio_device *device,
+ dma_addr_t iova, void *data,
+ size_t len, bool write);
int __init vfio_container_init(void);
void vfio_container_cleanup(void);
@@ -166,22 +167,21 @@ static inline void vfio_device_container_unregister(struct vfio_device *device)
{
}
-static inline int vfio_container_pin_pages(struct vfio_container *container,
- struct iommu_group *iommu_group,
- dma_addr_t iova, int npage, int prot,
- struct page **pages)
+static inline int vfio_device_container_pin_pages(struct vfio_device *device,
+ dma_addr_t iova, int npage,
+ int prot, struct page **pages)
{
return -EOPNOTSUPP;
}
-static inline void vfio_container_unpin_pages(struct vfio_container *container,
- dma_addr_t iova, int npage)
+static inline void vfio_device_container_unpin_pages(struct vfio_device *device,
+ dma_addr_t iova, int npage)
{
}
-static inline int vfio_container_dma_rw(struct vfio_container *container,
- dma_addr_t iova, void *data, size_t len,
- bool write)
+static inline int vfio_device_container_dma_rw(struct vfio_device *device,
+ dma_addr_t iova, void *data,
+ size_t len, bool write)
{
return -EOPNOTSUPP;
}