Lines Matching full:bdf
351 static unsigned int vfio_pci_get_group_from_dev(const char *bdf) in vfio_pci_get_group_from_dev() argument
358 snprintf(sysfs_path, PATH_MAX, "%s/%s/iommu_group", PCI_SYSFS_PATH, bdf); in vfio_pci_get_group_from_dev()
361 VFIO_ASSERT_NE(ret, -1, "Failed to get the IOMMU group for device: %s\n", bdf); in vfio_pci_get_group_from_dev()
364 VFIO_ASSERT_EQ(ret, 1, "Failed to get the IOMMU group for device: %s\n", bdf); in vfio_pci_get_group_from_dev()
369 static void vfio_pci_group_setup(struct vfio_pci_device *device, const char *bdf) in vfio_pci_group_setup() argument
377 group = vfio_pci_get_group_from_dev(bdf); in vfio_pci_group_setup()
389 static void vfio_pci_container_setup(struct vfio_pci_device *device, const char *bdf) in vfio_pci_container_setup() argument
402 vfio_pci_group_setup(device, bdf); in vfio_pci_container_setup()
409 device->fd = ioctl(device->group_fd, VFIO_GROUP_GET_DEVICE_FD, bdf); in vfio_pci_container_setup()
441 const char *vfio_pci_get_cdev_path(const char *bdf) in vfio_pci_get_cdev_path() argument
451 snprintf(dir_path, sizeof(dir_path), "/sys/bus/pci/devices/%s/vfio-dev/", bdf); in vfio_pci_get_cdev_path()
547 static void vfio_pci_iommufd_setup(struct vfio_pci_device *device, const char *bdf) in vfio_pci_iommufd_setup() argument
549 const char *cdev_path = vfio_pci_get_cdev_path(bdf); in vfio_pci_iommufd_setup()
568 struct vfio_pci_device *vfio_pci_device_init(const char *bdf, const char *iommu_mode) in vfio_pci_device_init() argument
580 vfio_pci_container_setup(device, bdf); in vfio_pci_device_init()
582 vfio_pci_iommufd_setup(device, bdf); in vfio_pci_device_init()
629 char *bdf; in vfio_selftests_get_bdf() local
634 bdf = getenv("VFIO_SELFTESTS_BDF"); in vfio_selftests_get_bdf()
635 if (bdf) { in vfio_selftests_get_bdf()
636 VFIO_ASSERT_TRUE(is_bdf(bdf), "Invalid BDF: %s\n", bdf); in vfio_selftests_get_bdf()
637 return bdf; in vfio_selftests_get_bdf()