From 4106d89a18f8e2eccdd279a55dd8b14ec752fb16 Mon Sep 17 00:00:00 2001 From: Shahaf Shuler Date: Sun, 10 Mar 2019 10:27:58 +0200 Subject: [PATCH] vfio: allow DMA map to the default container Enable users the option to call rte_vfio_dma_map with request to map to the default vfio fd. Signed-off-by: Shahaf Shuler Acked-by: Anatoly Burakov Acked-by: Gaetan Rivet --- doc/guides/rel_notes/release_19_05.rst | 4 ++++ lib/librte_eal/common/include/rte_vfio.h | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst index 4e991180ed..86132821b1 100644 --- a/doc/guides/rel_notes/release_19_05.rst +++ b/doc/guides/rel_notes/release_19_05.rst @@ -147,6 +147,10 @@ API Changes ``rte_service_attr_get()`` has been changed from ``uint32_t *`` to ``uint64_t *``. +* vfio: Functions ``rte_vfio_container_dma_map`` and + ``rte_vfio_container_dma_unmap`` have been extended with an option to + request mapping or un-mapping to the default vfio container fd. + ABI Changes ----------- diff --git a/lib/librte_eal/common/include/rte_vfio.h b/lib/librte_eal/common/include/rte_vfio.h index 4b3a91e91e..247fa2f1e3 100644 --- a/lib/librte_eal/common/include/rte_vfio.h +++ b/lib/librte_eal/common/include/rte_vfio.h @@ -80,6 +80,8 @@ struct vfio_device_info; #endif /* VFIO_PRESENT */ +#define RTE_VFIO_DEFAULT_CONTAINER_FD (-1) + /** * Setup vfio_cfg for the device identified by its address. * It discovers the configured I/O MMU groups or sets a new one for the device. @@ -351,7 +353,8 @@ rte_vfio_container_group_unbind(int container_fd, int iommu_group_num); * Perform DMA mapping for devices in a container. * * @param container_fd - * the specified container fd + * the specified container fd. Use RTE_VFIO_DEFAULT_CONTAINER_FD to + * use the default container. * * @param vaddr * Starting virtual address of memory to be mapped. @@ -374,7 +377,8 @@ rte_vfio_container_dma_map(int container_fd, uint64_t vaddr, * Perform DMA unmapping for devices in a container. * * @param container_fd - * the specified container fd + * the specified container fd. Use RTE_VFIO_DEFAULT_CONTAINER_FD to + * use the default container. * * @param vaddr * Starting virtual address of memory to be unmapped. -- 2.20.1