X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Flinuxapp%2Feal%2Feal_pci_vfio.c;h=cf5ac502c8a8bc480070687dc076db85ec7abaa6;hb=a20d5f06e2e19d3622620d838006ea4eaaa594fb;hp=ee9660f3cbf79cbd7abe465694c48d74ae79fa73;hpb=9e67561acd1a10ec41fffe5ca512a6376de96369;p=dpdk.git diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index ee9660f3cb..cf5ac502c8 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -41,7 +41,6 @@ #include #include -#include #include #include #include @@ -65,6 +64,11 @@ #define PAGE_SIZE (sysconf(_SC_PAGESIZE)) #define PAGE_MASK (~(PAGE_SIZE - 1)) +static struct rte_tailq_elem rte_vfio_tailq = { + .name = "VFIO_RESOURCE_LIST", +}; +EAL_REGISTER_TAILQ(rte_vfio_tailq) + #define VFIO_DIR "/dev/vfio" #define VFIO_CONTAINER_PATH "/dev/vfio/vfio" #define VFIO_GROUP_FMT "/dev/vfio/%u" @@ -290,7 +294,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) } /* set up an eventfd for interrupts */ - fd = eventfd(0, 0); + fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (fd < 0) { RTE_LOG(ERR, EAL, " cannot set up eventfd, " "error %i (%s)\n", errno, strerror(errno)); @@ -547,6 +551,8 @@ pci_vfio_map_resource(struct rte_pci_device *dev) struct rte_pci_addr *loc = &dev->addr; int i, ret, msix_bar; struct mapped_pci_resource *vfio_res = NULL; + struct mapped_pci_res_list *vfio_res_list = RTE_TAILQ_CAST(rte_vfio_tailq.head, mapped_pci_res_list); + struct pci_map *maps; uint32_t msix_table_offset = 0; uint32_t msix_table_size = 0; @@ -701,7 +707,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev) VFIO_PCI_BAR5_REGION_INDEX + 1); } else { /* if we're in a secondary process, just find our tailq entry */ - TAILQ_FOREACH(vfio_res, pci_res_list, next) { + TAILQ_FOREACH(vfio_res, vfio_res_list, next) { if (memcmp(&vfio_res->pci_addr, &dev->addr, sizeof(dev->addr))) continue; break; @@ -722,7 +728,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev) struct vfio_region_info reg = { .argsz = sizeof(reg) }; void *bar_addr; struct memreg { - uint32_t offset, size; + unsigned long offset, size; } memreg[2] = {}; reg.index = i; @@ -765,7 +771,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev) RTE_LOG(DEBUG, EAL, "Trying to map BAR %d that contains the MSI-X " "table. Trying offsets: " - "%04x:%04x, %04x:%04x\n", i, + "0x%04lx:0x%04lx, 0x%04lx:0x%04lx\n", i, memreg[0].offset, memreg[0].size, memreg[1].offset, memreg[1].size); } @@ -855,7 +861,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev) } if (internal_config.process_type == RTE_PROC_PRIMARY) - TAILQ_INSERT_TAIL(pci_res_list, vfio_res, next); + TAILQ_INSERT_TAIL(vfio_res_list, vfio_res, next); return 0; } @@ -893,7 +899,7 @@ pci_vfio_enable(void) if (vfio_cfg.vfio_container_fd != -1) vfio_cfg.vfio_enabled = 1; else - RTE_LOG(INFO, EAL, "VFIO support could not be initialized\n"); + RTE_LOG(NOTICE, EAL, "VFIO support could not be initialized\n"); return 0; }