* This file is only compiled if CONFIG_RTE_EAL_VFIO is set to "y".
*/
-#ifdef RTE_EAL_VFIO
+#ifdef VFIO_PRESENT
#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
#define PAGE_MASK (~(PAGE_SIZE - 1))
}
static int
-pci_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
+pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
{
if (pci_vfio_setup_interrupts(dev, vfio_dev_fd) != 0) {
RTE_LOG(ERR, EAL, "Error setting up interrupts!\n");
return -1;
}
- /* Reset the device */
- if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET)) {
+ /*
+ * Reset the device. If the device is not capable of resetting,
+ * then it updates errno as EINVAL.
+ */
+ if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
RTE_LOG(ERR, EAL, "Unable to reset device! Error: %d (%s)\n",
errno, strerror(errno));
return -1;
snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT,
loc->domain, loc->bus, loc->devid, loc->function);
- ret = vfio_setup_device(pci_get_sysfs_path(), pci_addr,
+ ret = rte_vfio_setup_device(pci_get_sysfs_path(), pci_addr,
&vfio_dev_fd, &device_info);
if (ret)
return ret;
dev->mem_resource[i].addr = maps[i].addr;
}
- if (pci_vfio_setup_device(dev, vfio_dev_fd) < 0) {
+ if (pci_rte_vfio_setup_device(dev, vfio_dev_fd) < 0) {
RTE_LOG(ERR, EAL, " %s setup device failed\n", pci_addr);
goto err_vfio_res;
}
snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT,
loc->domain, loc->bus, loc->devid, loc->function);
- ret = vfio_setup_device(pci_get_sysfs_path(), pci_addr,
+ ret = rte_vfio_setup_device(pci_get_sysfs_path(), pci_addr,
&vfio_dev_fd, &device_info);
if (ret)
return ret;
/* if we're in a secondary process, just find our tailq entry */
TAILQ_FOREACH(vfio_res, vfio_res_list, next) {
- if (pci_addr_cmp(&vfio_res->pci_addr,
+ if (rte_pci_addr_cmp(&vfio_res->pci_addr,
&dev->addr))
continue;
break;
return -1;
}
- ret = vfio_release_device(pci_get_sysfs_path(), pci_addr,
+ ret = rte_vfio_release_device(pci_get_sysfs_path(), pci_addr,
dev->intr_handle.vfio_dev_fd);
if (ret < 0) {
RTE_LOG(ERR, EAL,
int
pci_vfio_is_enabled(void)
{
- return vfio_is_enabled("vfio_pci");
+ return rte_vfio_is_enabled("vfio_pci");
}
#endif