Re: [PATCH v2 2/4] vfio-iommufd: Support pasid [at|de]tach for physical VFIO devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On 2024/4/23 20:43, Jason Gunthorpe wrote:
On Fri, Apr 12, 2024 at 01:21:19AM -0700, Yi Liu wrote:
+int vfio_iommufd_physical_pasid_attach_ioas(struct vfio_device *vdev,
+					    u32 pasid, u32 *pt_id)
+	int rc;
+	lockdep_assert_held(&vdev->dev_set->lock);
+	if (WARN_ON(!vdev->iommufd_device))
+		return -EINVAL;
+	rc = ida_get_lowest(&vdev->pasids, pasid, pasid);

A helper inline

     bool ida_is_allocate(&ida, id)

Would be nicer for that


diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index cb5b7f865d58..e0198851ffd2 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -142,6 +142,8 @@ static const struct vfio_device_ops vfio_pci_ops = {
  	.unbind_iommufd	= vfio_iommufd_physical_unbind,
  	.attach_ioas	= vfio_iommufd_physical_attach_ioas,
  	.detach_ioas	= vfio_iommufd_physical_detach_ioas,
+	.pasid_attach_ioas	= vfio_iommufd_physical_pasid_attach_ioas,
+	.pasid_detach_ioas	= vfio_iommufd_physical_pasid_detach_ioas,

This should be copied into mlx5 and nvgrace-gpu at least as well

looks like Kevin has a different idea on it.

Yi Liu

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux