DPDK 22.11.5
|
#include <stdbool.h>
#include <stdint.h>
#include <linux/vfio.h>
Go to the source code of this file.
Functions | |
int | rte_vfio_setup_device (const char *sysfs_base, const char *dev_addr, int *vfio_dev_fd, struct vfio_device_info *device_info) |
int | rte_vfio_release_device (const char *sysfs_base, const char *dev_addr, int fd) |
int | rte_vfio_enable (const char *modname) |
int | rte_vfio_is_enabled (const char *modname) |
int | rte_vfio_noiommu_is_enabled (void) |
int | rte_vfio_clear_group (int vfio_group_fd) |
int | rte_vfio_get_group_num (const char *sysfs_base, const char *dev_addr, int *iommu_group_num) |
int | rte_vfio_get_container_fd (void) |
int | rte_vfio_get_group_fd (int iommu_group_num) |
int | rte_vfio_container_create (void) |
int | rte_vfio_container_destroy (int container_fd) |
int | rte_vfio_container_group_bind (int container_fd, int iommu_group_num) |
int | rte_vfio_container_group_unbind (int container_fd, int iommu_group_num) |
int | rte_vfio_container_dma_map (int container_fd, uint64_t vaddr, uint64_t iova, uint64_t len) |
int | rte_vfio_container_dma_unmap (int container_fd, uint64_t vaddr, uint64_t iova, uint64_t len) |
RTE VFIO. This library provides various VFIO related utility functions.
Definition in file rte_vfio.h.
int rte_vfio_setup_device | ( | const char * | sysfs_base, |
const char * | dev_addr, | ||
int * | vfio_dev_fd, | ||
struct vfio_device_info * | device_info | ||
) |
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. If a new groups is assigned, the DMA mapping is performed.
This function is only relevant to linux and will return an error on BSD.
sysfs_base | sysfs path prefix. |
dev_addr | device location. |
vfio_dev_fd | VFIO fd. |
device_info | Device information. |
int rte_vfio_release_device | ( | const char * | sysfs_base, |
const char * | dev_addr, | ||
int | fd | ||
) |
Release a device mapped to a VFIO-managed I/O MMU group.
This function is only relevant to linux and will return an error on BSD.
sysfs_base | sysfs path prefix. |
dev_addr | device location. |
fd | VFIO fd. |
int rte_vfio_enable | ( | const char * | modname | ) |
Enable a VFIO-related kmod.
This function is only relevant to linux and will return an error on BSD.
modname | kernel module name. |
int rte_vfio_is_enabled | ( | const char * | modname | ) |
Check whether a VFIO-related kmod is enabled.
This function is only relevant to Linux.
modname | kernel module name. |
int rte_vfio_noiommu_is_enabled | ( | void | ) |
Whether VFIO NOIOMMU mode is enabled.
This function is only relevant to Linux.
int rte_vfio_clear_group | ( | int | vfio_group_fd | ) |
Remove group fd from internal VFIO group fd array/
This function is only relevant to linux and will return an error on BSD.
vfio_group_fd | VFIO Group FD. |
int rte_vfio_get_group_num | ( | const char * | sysfs_base, |
const char * | dev_addr, | ||
int * | iommu_group_num | ||
) |
Parse IOMMU group number for a device
This function is only relevant to linux and will return an error on BSD.
sysfs_base | sysfs path prefix. |
dev_addr | device location. |
iommu_group_num | iommu group number |
int rte_vfio_get_container_fd | ( | void | ) |
Open a new VFIO container fd
This function is only relevant to linux and will return an error on BSD.
0 container fd < 0 for errors
int rte_vfio_get_group_fd | ( | int | iommu_group_num | ) |
Open VFIO group fd or get an existing one
This function is only relevant to linux and will return an error on BSD.
iommu_group_num | iommu group number |
0 group fd < 0 for errors
int rte_vfio_container_create | ( | void | ) |
Create a new container for device binding.
int rte_vfio_container_destroy | ( | int | container_fd | ) |
Destroy the container, unbind all vfio groups within it.
container_fd | the container fd to destroy |
int rte_vfio_container_group_bind | ( | int | container_fd, |
int | iommu_group_num | ||
) |
Bind a IOMMU group to a container.
container_fd | the container's fd |
iommu_group_num | the iommu group number to bind to container |
int rte_vfio_container_group_unbind | ( | int | container_fd, |
int | iommu_group_num | ||
) |
Unbind a IOMMU group from a container.
container_fd | the container fd of container |
iommu_group_num | the iommu group number to delete from container |
int rte_vfio_container_dma_map | ( | int | container_fd, |
uint64_t | vaddr, | ||
uint64_t | iova, | ||
uint64_t | len | ||
) |
Perform DMA mapping for devices in a container.
container_fd | the specified container fd. Use RTE_VFIO_DEFAULT_CONTAINER_FD to use the default container. |
vaddr | Starting virtual address of memory to be mapped. |
iova | Starting IOVA address of memory to be mapped. |
len | Length of memory segment being mapped. |
int rte_vfio_container_dma_unmap | ( | int | container_fd, |
uint64_t | vaddr, | ||
uint64_t | iova, | ||
uint64_t | len | ||
) |
Perform DMA unmapping for devices in a container.
container_fd | the specified container fd. Use RTE_VFIO_DEFAULT_CONTAINER_FD to use the default container. |
vaddr | Starting virtual address of memory to be unmapped. |
iova | Starting IOVA address of memory to be unmapped. |
len | Length of memory segment being unmapped. |