DPDK
18.02.2
Main Page
Related Pages
Data Structures
Files
Examples
File List
Globals
lib
librte_eal
common
include
rte_vfio.h
1
/* SPDX-License-Identifier: BSD-3-Clause
2
* Copyright(c) 2017 6WIND S.A.
3
*/
4
5
#ifndef _RTE_VFIO_H_
6
#define _RTE_VFIO_H_
7
8
#ifdef __cplusplus
9
extern
"C"
{
10
#endif
11
12
/*
13
* determine if VFIO is present on the system
14
*/
15
#if !defined(VFIO_PRESENT) && defined(RTE_EAL_VFIO)
16
#include <linux/version.h>
17
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
18
#define VFIO_PRESENT
19
#endif
/* kernel version >= 3.6.0 */
20
#endif
/* RTE_EAL_VFIO */
21
22
#ifdef VFIO_PRESENT
23
24
#include <linux/vfio.h>
25
26
#define VFIO_DIR "/dev/vfio"
27
#define VFIO_CONTAINER_PATH "/dev/vfio/vfio"
28
#define VFIO_GROUP_FMT "/dev/vfio/%u"
29
#define VFIO_NOIOMMU_GROUP_FMT "/dev/vfio/noiommu-%u"
30
#define VFIO_GET_REGION_ADDR(x) ((uint64_t) x << 40ULL)
31
#define VFIO_GET_REGION_IDX(x) (x >> 40)
32
#define VFIO_NOIOMMU_MODE \
33
"/sys/module/vfio/parameters/enable_unsafe_noiommu_mode"
34
35
#else
/* not VFIO_PRESENT */
36
37
/* we don't need an actual definition, only pointer is used */
38
struct
vfio_device_info;
39
40
#endif
/* VFIO_PRESENT */
41
67
int
rte_vfio_setup_device(
const
char
*sysfs_base,
const
char
*dev_addr,
68
int
*vfio_dev_fd,
struct
vfio_device_info *device_info);
69
89
int
rte_vfio_release_device(
const
char
*sysfs_base,
const
char
*dev_addr,
int
fd);
90
104
int
rte_vfio_enable(
const
char
*modname);
105
119
int
rte_vfio_is_enabled(
const
char
*modname);
120
131
int
rte_vfio_noiommu_is_enabled(
void
);
132
133
/* remove group fd from internal VFIO group fd array */
134
int
135
rte_vfio_clear_group(
int
vfio_group_fd);
136
137
#ifdef __cplusplus
138
}
139
#endif
140
141
#endif
/* _RTE_VFIO_H_ */
Generated by
1.8.1.2