| 437 | } |
| 438 | |
| 439 | static int |
| 440 | pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd) |
| 441 | { |
| 442 | if (pci_vfio_setup_interrupts(dev, vfio_dev_fd) != 0) { |
| 443 | RTE_LOG(ERR, EAL, "Error setting up interrupts!\n"); |
| 444 | return -1; |
| 445 | } |
| 446 | |
| 447 | if (pci_vfio_enable_bus_memory(dev, vfio_dev_fd)) { |
| 448 | RTE_LOG(ERR, EAL, "Cannot enable bus memory!\n"); |
| 449 | return -1; |
| 450 | } |
| 451 | |
| 452 | if (rte_pci_set_bus_master(dev, true)) { |
| 453 | RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n"); |
| 454 | return -1; |
| 455 | } |
| 456 | |
| 457 | /* |
| 458 | * Reset the device. If the device is not capable of resetting, |
| 459 | * then it updates errno as EINVAL. |
| 460 | */ |
| 461 | if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) { |
| 462 | RTE_LOG(ERR, EAL, "Unable to reset device! Error: %d (%s)\n", |
| 463 | errno, strerror(errno)); |
| 464 | return -1; |
| 465 | } |
| 466 | |
| 467 | return 0; |
| 468 | } |
| 469 | |
| 470 | static int |
| 471 | pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res, |
no test coverage detected