> From: Liu, Yi L <yi.l.liu@xxxxxxxxx> > Sent: Thursday, March 30, 2023 8:48 PM > if (fill->cur == fill->max) > return -EAGAIN; /* Something changed, try again */ > @@ -791,7 +812,24 @@ static int vfio_pci_fill_devs(struct pci_dev *pdev, void *data) > if (!iommu_group) > return -EPERM; /* Cannot reset non-isolated devices */ > > - fill->devices[fill->cur].group_id = iommu_group_id(iommu_group); > + /* > + * If dev_id is needed, fill in the dev_id field, otherwise > + * fill in group_id. > + */ > + if (fill->require_devid) { > + /* > + * Report the devices that are opened as cdev and have > + * the same iommufd with the fill->iommufd. Otherwise, > + * just fill in an IOMMUFD_INVALID_ID. > + */ > + vdev = vfio_pci_find_device_in_devset(dev_set, pdev); > + if (vdev && !vfio_device_cdev_opened(vdev) && a typo..it should be if (vdev && vfio_device_cdev_opened(vdev) && > + fill->iommufd == vfio_iommufd_physical_ictx(vdev)) > + vfio_iommufd_physical_devid(vdev, &fill->devices[fill- > >cur].dev_id); > + fill->devices[fill->cur].dev_id = IOMMUFD_INVALID_ID; > + } else { > + fill->devices[fill->cur].group_id = iommu_group_id(iommu_group); > + } > fill->devices[fill->cur].segment = pci_domain_nr(pdev->bus); > fill->devices[fill->cur].bus = pdev->bus->number; > fill->devices[fill->cur].devfn = pdev->devfn; Regards, Yi Liu