4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #include <linux/pci_regs.h>
37 #include <sys/eventfd.h>
38 #include <sys/socket.h>
39 #include <sys/ioctl.h>
44 #include <rte_tailq.h>
45 #include <rte_eal_memconfig.h>
46 #include <rte_malloc.h>
48 #include "eal_filesystem.h"
49 #include "eal_pci_init.h"
54 * PCI probing under linux (VFIO version)
56 * This code tries to determine if the PCI device is bound to VFIO driver,
57 * and initialize it (map BARs, set up interrupts) if that's the case.
59 * This file is only compiled if CONFIG_RTE_EAL_VFIO is set to "y".
64 #define VFIO_DIR "/dev/vfio"
65 #define VFIO_CONTAINER_PATH "/dev/vfio/vfio"
66 #define VFIO_GROUP_FMT "/dev/vfio/%u"
67 #define VFIO_GET_REGION_ADDR(x) ((uint64_t) x << 40ULL)
69 /* per-process VFIO config */
70 static struct vfio_config vfio_cfg;
72 /* get PCI BAR number where MSI-X interrupts are */
74 pci_vfio_get_msix_bar(int fd, int *msix_bar)
78 uint8_t cap_id, cap_offset;
80 /* read PCI capability pointer from config space */
81 ret = pread64(fd, ®, sizeof(reg),
82 VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
84 if (ret != sizeof(reg)) {
85 RTE_LOG(ERR, EAL, "Cannot read capability pointer from PCI "
90 /* we need first byte */
91 cap_offset = reg & 0xFF;
95 /* read PCI capability ID */
96 ret = pread64(fd, ®, sizeof(reg),
97 VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
99 if (ret != sizeof(reg)) {
100 RTE_LOG(ERR, EAL, "Cannot read capability ID from PCI "
105 /* we need first byte */
108 /* if we haven't reached MSI-X, check next capability */
109 if (cap_id != PCI_CAP_ID_MSIX) {
110 ret = pread64(fd, ®, sizeof(reg),
111 VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
113 if (ret != sizeof(reg)) {
114 RTE_LOG(ERR, EAL, "Cannot read capability pointer from PCI "
119 /* we need second byte */
120 cap_offset = (reg & 0xFF00) >> 8;
124 /* else, read table offset */
126 /* table offset resides in the next 4 bytes */
127 ret = pread64(fd, ®, sizeof(reg),
128 VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
130 if (ret != sizeof(reg)) {
131 RTE_LOG(ERR, EAL, "Cannot read table offset from PCI config "
136 *msix_bar = reg & RTE_PCI_MSIX_TABLE_BIR;
144 /* set PCI bus mastering */
146 pci_vfio_set_bus_master(int dev_fd)
151 ret = pread64(dev_fd, ®, sizeof(reg),
152 VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
154 if (ret != sizeof(reg)) {
155 RTE_LOG(ERR, EAL, "Cannot read command from PCI config space!\n");
159 /* set the master bit */
160 reg |= PCI_COMMAND_MASTER;
162 ret = pwrite64(dev_fd, ®, sizeof(reg),
163 VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) +
166 if (ret != sizeof(reg)) {
167 RTE_LOG(ERR, EAL, "Cannot write command to PCI config space!\n");
174 /* set up DMA mappings */
176 pci_vfio_setup_dma_maps(int vfio_container_fd)
178 const struct rte_memseg *ms = rte_eal_get_physmem_layout();
181 ret = ioctl(vfio_container_fd, VFIO_SET_IOMMU,
184 RTE_LOG(ERR, EAL, " cannot set IOMMU type, "
185 "error %i (%s)\n", errno, strerror(errno));
189 /* map all DPDK segments for DMA. use 1:1 PA to IOVA mapping */
190 for (i = 0; i < RTE_MAX_MEMSEG; i++) {
191 struct vfio_iommu_type1_dma_map dma_map;
193 if (ms[i].addr == NULL)
196 memset(&dma_map, 0, sizeof(dma_map));
197 dma_map.argsz = sizeof(struct vfio_iommu_type1_dma_map);
198 dma_map.vaddr = ms[i].addr_64;
199 dma_map.size = ms[i].len;
200 dma_map.iova = ms[i].phys_addr;
201 dma_map.flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE;
203 ret = ioctl(vfio_container_fd, VFIO_IOMMU_MAP_DMA, &dma_map);
206 RTE_LOG(ERR, EAL, " cannot set up DMA remapping, "
207 "error %i (%s)\n", errno, strerror(errno));
215 /* set up interrupt support (but not enable interrupts) */
217 pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
219 int i, ret, intr_idx;
221 /* default to invalid index */
222 intr_idx = VFIO_PCI_NUM_IRQS;
224 /* get interrupt type from internal config (MSI-X by default, can be
225 * overriden from the command line
227 switch (internal_config.vfio_intr_mode) {
228 case RTE_INTR_MODE_MSIX:
229 intr_idx = VFIO_PCI_MSIX_IRQ_INDEX;
231 case RTE_INTR_MODE_MSI:
232 intr_idx = VFIO_PCI_MSI_IRQ_INDEX;
234 case RTE_INTR_MODE_LEGACY:
235 intr_idx = VFIO_PCI_INTX_IRQ_INDEX;
237 /* don't do anything if we want to automatically determine interrupt type */
238 case RTE_INTR_MODE_NONE:
241 RTE_LOG(ERR, EAL, " unknown default interrupt type!\n");
245 /* start from MSI-X interrupt type */
246 for (i = VFIO_PCI_MSIX_IRQ_INDEX; i >= 0; i--) {
247 struct vfio_irq_info irq = { .argsz = sizeof(irq) };
250 /* skip interrupt modes we don't want */
251 if (internal_config.vfio_intr_mode != RTE_INTR_MODE_NONE &&
257 ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
259 RTE_LOG(ERR, EAL, " cannot get IRQ info, "
260 "error %i (%s)\n", errno, strerror(errno));
264 /* if this vector cannot be used with eventfd, fail if we explicitly
265 * specified interrupt type, otherwise continue */
266 if ((irq.flags & VFIO_IRQ_INFO_EVENTFD) == 0) {
267 if (internal_config.vfio_intr_mode != RTE_INTR_MODE_NONE) {
269 " interrupt vector does not support eventfd!\n");
275 /* set up an eventfd for interrupts */
278 RTE_LOG(ERR, EAL, " cannot set up eventfd, "
279 "error %i (%s)\n", errno, strerror(errno));
283 dev->intr_handle.fd = fd;
284 dev->intr_handle.vfio_dev_fd = vfio_dev_fd;
287 case VFIO_PCI_MSIX_IRQ_INDEX:
288 internal_config.vfio_intr_mode = RTE_INTR_MODE_MSIX;
289 dev->intr_handle.type = RTE_INTR_HANDLE_VFIO_MSIX;
291 case VFIO_PCI_MSI_IRQ_INDEX:
292 internal_config.vfio_intr_mode = RTE_INTR_MODE_MSI;
293 dev->intr_handle.type = RTE_INTR_HANDLE_VFIO_MSI;
295 case VFIO_PCI_INTX_IRQ_INDEX:
296 internal_config.vfio_intr_mode = RTE_INTR_MODE_LEGACY;
297 dev->intr_handle.type = RTE_INTR_HANDLE_VFIO_LEGACY;
300 RTE_LOG(ERR, EAL, " unknown interrupt type!\n");
307 /* if we're here, we haven't found a suitable interrupt vector */
311 /* open container fd or get an existing one */
313 pci_vfio_get_container_fd(void)
315 int ret, vfio_container_fd;
317 /* if we're in a primary process, try to open the container */
318 if (internal_config.process_type == RTE_PROC_PRIMARY) {
319 vfio_container_fd = open(VFIO_CONTAINER_PATH, O_RDWR);
320 if (vfio_container_fd < 0) {
321 RTE_LOG(ERR, EAL, " cannot open VFIO container, "
322 "error %i (%s)\n", errno, strerror(errno));
326 /* check VFIO API version */
327 ret = ioctl(vfio_container_fd, VFIO_GET_API_VERSION);
328 if (ret != VFIO_API_VERSION) {
330 RTE_LOG(ERR, EAL, " could not get VFIO API version, "
331 "error %i (%s)\n", errno, strerror(errno));
333 RTE_LOG(ERR, EAL, " unsupported VFIO API version!\n");
334 close(vfio_container_fd);
338 /* check if we support IOMMU type 1 */
339 ret = ioctl(vfio_container_fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU);
342 RTE_LOG(ERR, EAL, " could not get IOMMU type, "
343 "error %i (%s)\n", errno, strerror(errno));
345 RTE_LOG(ERR, EAL, " unsupported IOMMU type!\n");
346 close(vfio_container_fd);
350 return vfio_container_fd;
353 * if we're in a secondary process, request container fd from the
354 * primary process via our socket
358 socket_fd = vfio_mp_sync_connect_to_primary();
360 RTE_LOG(ERR, EAL, " cannot connect to primary process!\n");
363 if (vfio_mp_sync_send_request(socket_fd, SOCKET_REQ_CONTAINER) < 0) {
364 RTE_LOG(ERR, EAL, " cannot request container fd!\n");
368 vfio_container_fd = vfio_mp_sync_receive_fd(socket_fd);
369 if (vfio_container_fd < 0) {
370 RTE_LOG(ERR, EAL, " cannot get container fd!\n");
375 return vfio_container_fd;
381 /* open group fd or get an existing one */
383 pci_vfio_get_group_fd(int iommu_group_no)
387 char filename[PATH_MAX];
389 /* check if we already have the group descriptor open */
390 for (i = 0; i < vfio_cfg.vfio_group_idx; i++)
391 if (vfio_cfg.vfio_groups[i].group_no == iommu_group_no)
392 return vfio_cfg.vfio_groups[i].fd;
394 /* if primary, try to open the group */
395 if (internal_config.process_type == RTE_PROC_PRIMARY) {
396 snprintf(filename, sizeof(filename),
397 VFIO_GROUP_FMT, iommu_group_no);
398 vfio_group_fd = open(filename, O_RDWR);
399 if (vfio_group_fd < 0) {
400 /* if file not found, it's not an error */
401 if (errno != ENOENT) {
402 RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", filename,
409 /* if the fd is valid, create a new group for it */
410 if (vfio_cfg.vfio_group_idx == VFIO_MAX_GROUPS) {
411 RTE_LOG(ERR, EAL, "Maximum number of VFIO groups reached!\n");
414 vfio_cfg.vfio_groups[vfio_cfg.vfio_group_idx].group_no = iommu_group_no;
415 vfio_cfg.vfio_groups[vfio_cfg.vfio_group_idx].fd = vfio_group_fd;
416 return vfio_group_fd;
418 /* if we're in a secondary process, request group fd from the primary
419 * process via our socket
424 socket_fd = vfio_mp_sync_connect_to_primary();
427 RTE_LOG(ERR, EAL, " cannot connect to primary process!\n");
430 if (vfio_mp_sync_send_request(socket_fd, SOCKET_REQ_GROUP) < 0) {
431 RTE_LOG(ERR, EAL, " cannot request container fd!\n");
435 if (vfio_mp_sync_send_request(socket_fd, iommu_group_no) < 0) {
436 RTE_LOG(ERR, EAL, " cannot send group number!\n");
440 ret = vfio_mp_sync_receive_request(socket_fd);
446 vfio_group_fd = vfio_mp_sync_receive_fd(socket_fd);
447 /* if we got the fd, return it */
448 if (vfio_group_fd > 0) {
450 return vfio_group_fd;
452 /* fall-through on error */
454 RTE_LOG(ERR, EAL, " cannot get container fd!\n");
462 /* parse IOMMU group number for a PCI device
463 * returns -1 for errors, 0 for non-existent group */
465 pci_vfio_get_group_no(const char *pci_addr)
467 char linkname[PATH_MAX];
468 char filename[PATH_MAX];
469 char *tok[16], *group_tok, *end;
470 int ret, iommu_group_no;
472 memset(linkname, 0, sizeof(linkname));
473 memset(filename, 0, sizeof(filename));
475 /* try to find out IOMMU group for this device */
476 snprintf(linkname, sizeof(linkname),
477 SYSFS_PCI_DEVICES "/%s/iommu_group", pci_addr);
479 ret = readlink(linkname, filename, sizeof(filename));
481 /* if the link doesn't exist, no VFIO for us */
485 ret = rte_strsplit(filename, sizeof(filename),
486 tok, RTE_DIM(tok), '/');
489 RTE_LOG(ERR, EAL, " %s cannot get IOMMU group\n", pci_addr);
493 /* IOMMU group is always the last token */
495 group_tok = tok[ret - 1];
497 iommu_group_no = strtol(group_tok, &end, 10);
498 if ((end != group_tok && *end != '\0') || errno != 0) {
499 RTE_LOG(ERR, EAL, " %s error parsing IOMMU number!\n", pci_addr);
503 return iommu_group_no;
507 clear_current_group(void)
509 vfio_cfg.vfio_groups[vfio_cfg.vfio_group_idx].group_no = 0;
510 vfio_cfg.vfio_groups[vfio_cfg.vfio_group_idx].fd = -1;
515 * map the PCI resources of a PCI device in virtual memory (VFIO version).
516 * primary and secondary processes follow almost exactly the same path
519 pci_vfio_map_resource(struct rte_pci_device *dev)
521 struct vfio_group_status group_status = {
522 .argsz = sizeof(group_status)
524 struct vfio_device_info device_info = { .argsz = sizeof(device_info) };
525 int vfio_group_fd, vfio_dev_fd;
527 char pci_addr[PATH_MAX] = {0};
528 struct rte_pci_addr *loc = &dev->addr;
529 int i, ret, msix_bar;
530 struct mapped_pci_resource *vfio_res = NULL;
531 struct pci_map *maps;
533 dev->intr_handle.fd = -1;
534 dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN;
536 /* store PCI address string */
537 snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT,
538 loc->domain, loc->bus, loc->devid, loc->function);
540 /* get group number */
541 iommu_group_no = pci_vfio_get_group_no(pci_addr);
543 /* if 0, group doesn't exist */
544 if (iommu_group_no == 0) {
545 RTE_LOG(WARNING, EAL, " %s not managed by VFIO driver, skipping\n",
549 /* if negative, something failed */
550 else if (iommu_group_no < 0)
553 /* get the actual group fd */
554 vfio_group_fd = pci_vfio_get_group_fd(iommu_group_no);
555 if (vfio_group_fd < 0)
559 vfio_cfg.vfio_groups[vfio_cfg.vfio_group_idx].group_no = iommu_group_no;
560 vfio_cfg.vfio_groups[vfio_cfg.vfio_group_idx].fd = vfio_group_fd;
562 /* if group_fd == 0, that means the device isn't managed by VFIO */
563 if (vfio_group_fd == 0) {
564 RTE_LOG(WARNING, EAL, " %s not managed by VFIO driver, skipping\n",
566 /* we store 0 as group fd to distinguish between existing but
567 * unbound VFIO groups, and groups that don't exist at all.
569 vfio_cfg.vfio_group_idx++;
574 * at this point, we know at least one port on this device is bound to VFIO,
575 * so we can proceed to try and set this particular port up
578 /* check if the group is viable */
579 ret = ioctl(vfio_group_fd, VFIO_GROUP_GET_STATUS, &group_status);
581 RTE_LOG(ERR, EAL, " %s cannot get group status, "
582 "error %i (%s)\n", pci_addr, errno, strerror(errno));
583 close(vfio_group_fd);
584 clear_current_group();
586 } else if (!(group_status.flags & VFIO_GROUP_FLAGS_VIABLE)) {
587 RTE_LOG(ERR, EAL, " %s VFIO group is not viable!\n", pci_addr);
588 close(vfio_group_fd);
589 clear_current_group();
594 * at this point, we know that this group is viable (meaning, all devices
595 * are either bound to VFIO or not bound to anything)
598 /* check if group does not have a container yet */
599 if (!(group_status.flags & VFIO_GROUP_FLAGS_CONTAINER_SET)) {
601 /* add group to a container */
602 ret = ioctl(vfio_group_fd, VFIO_GROUP_SET_CONTAINER,
603 &vfio_cfg.vfio_container_fd);
605 RTE_LOG(ERR, EAL, " %s cannot add VFIO group to container, "
606 "error %i (%s)\n", pci_addr, errno, strerror(errno));
607 close(vfio_group_fd);
608 clear_current_group();
612 * at this point we know that this group has been successfully
613 * initialized, so we increment vfio_group_idx to indicate that we can
616 vfio_cfg.vfio_group_idx++;
620 * set up DMA mappings for container
622 * needs to be done only once, only when at least one group is assigned to
623 * a container and only in primary process
625 if (internal_config.process_type == RTE_PROC_PRIMARY &&
626 vfio_cfg.vfio_container_has_dma == 0) {
627 ret = pci_vfio_setup_dma_maps(vfio_cfg.vfio_container_fd);
629 RTE_LOG(ERR, EAL, " %s DMA remapping failed, "
630 "error %i (%s)\n", pci_addr, errno, strerror(errno));
633 vfio_cfg.vfio_container_has_dma = 1;
636 /* get a file descriptor for the device */
637 vfio_dev_fd = ioctl(vfio_group_fd, VFIO_GROUP_GET_DEVICE_FD, pci_addr);
638 if (vfio_dev_fd < 0) {
639 /* if we cannot get a device fd, this simply means that this
640 * particular port is not bound to VFIO
642 RTE_LOG(WARNING, EAL, " %s not managed by VFIO driver, skipping\n",
647 /* test and setup the device */
648 ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_INFO, &device_info);
650 RTE_LOG(ERR, EAL, " %s cannot get device info, "
651 "error %i (%s)\n", pci_addr, errno, strerror(errno));
656 /* get MSI-X BAR, if any (we have to know where it is because we can't
657 * mmap it when using VFIO) */
659 ret = pci_vfio_get_msix_bar(vfio_dev_fd, &msix_bar);
661 RTE_LOG(ERR, EAL, " %s cannot get MSI-X BAR number!\n", pci_addr);
666 /* if we're in a primary process, allocate vfio_res and get region info */
667 if (internal_config.process_type == RTE_PROC_PRIMARY) {
668 vfio_res = rte_zmalloc("VFIO_RES", sizeof(*vfio_res), 0);
669 if (vfio_res == NULL) {
671 "%s(): cannot store uio mmap details\n", __func__);
675 memcpy(&vfio_res->pci_addr, &dev->addr, sizeof(vfio_res->pci_addr));
677 /* get number of registers (up to BAR5) */
678 vfio_res->nb_maps = RTE_MIN((int) device_info.num_regions,
679 VFIO_PCI_BAR5_REGION_INDEX + 1);
681 /* if we're in a secondary process, just find our tailq entry */
682 TAILQ_FOREACH(vfio_res, pci_res_list, next) {
683 if (memcmp(&vfio_res->pci_addr, &dev->addr, sizeof(dev->addr)))
687 /* if we haven't found our tailq entry, something's wrong */
688 if (vfio_res == NULL) {
689 RTE_LOG(ERR, EAL, " %s cannot find TAILQ entry for PCI device!\n",
697 maps = vfio_res->maps;
699 for (i = 0; i < (int) vfio_res->nb_maps; i++) {
700 struct vfio_region_info reg = { .argsz = sizeof(reg) };
705 ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_REGION_INFO, ®);
708 RTE_LOG(ERR, EAL, " %s cannot get device region info "
709 "error %i (%s)\n", pci_addr, errno, strerror(errno));
711 if (internal_config.process_type == RTE_PROC_PRIMARY)
716 /* skip non-mmapable BARs */
717 if ((reg.flags & VFIO_REGION_INFO_FLAG_MMAP) == 0)
724 if (internal_config.process_type == RTE_PROC_PRIMARY) {
725 /* try mapping somewhere close to the end of hugepages */
726 if (pci_map_addr == NULL)
727 pci_map_addr = pci_find_max_end_va();
729 bar_addr = pci_map_resource(pci_map_addr, vfio_dev_fd, reg.offset,
731 pci_map_addr = RTE_PTR_ADD(bar_addr, (size_t) reg.size);
733 bar_addr = pci_map_resource(maps[i].addr, vfio_dev_fd, reg.offset,
737 if (bar_addr == MAP_FAILED ||
738 (internal_config.process_type == RTE_PROC_SECONDARY &&
739 bar_addr != maps[i].addr)) {
740 RTE_LOG(ERR, EAL, " %s mapping BAR%i failed: %s\n", pci_addr, i,
743 if (internal_config.process_type == RTE_PROC_PRIMARY)
748 maps[i].addr = bar_addr;
749 maps[i].offset = reg.offset;
750 maps[i].size = reg.size;
751 dev->mem_resource[i].addr = bar_addr;
754 /* if secondary process, do not set up interrupts */
755 if (internal_config.process_type == RTE_PROC_PRIMARY) {
756 if (pci_vfio_setup_interrupts(dev, vfio_dev_fd) != 0) {
757 RTE_LOG(ERR, EAL, " %s error setting up interrupts!\n", pci_addr);
763 /* set bus mastering for the device */
764 if (pci_vfio_set_bus_master(vfio_dev_fd)) {
765 RTE_LOG(ERR, EAL, " %s cannot set up bus mastering!\n", pci_addr);
771 /* Reset the device */
772 ioctl(vfio_dev_fd, VFIO_DEVICE_RESET);
775 if (internal_config.process_type == RTE_PROC_PRIMARY)
776 TAILQ_INSERT_TAIL(pci_res_list, vfio_res, next);
782 pci_vfio_enable(void)
784 /* initialize group list */
787 for (i = 0; i < VFIO_MAX_GROUPS; i++) {
788 vfio_cfg.vfio_groups[i].fd = -1;
789 vfio_cfg.vfio_groups[i].group_no = -1;
791 vfio_cfg.vfio_container_fd = pci_vfio_get_container_fd();
793 /* check if we have VFIO driver enabled */
794 if (vfio_cfg.vfio_container_fd != -1)
795 vfio_cfg.vfio_enabled = 1;
797 RTE_LOG(INFO, EAL, "VFIO support could not be initialized\n");
803 pci_vfio_is_enabled(void)
805 return vfio_cfg.vfio_enabled;