Re: [RFC 03/12] vfio: Accept vfio device file in the driver facing kAPI

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

 



On 2022/12/21 12:07, Tian, Kevin wrote:
From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
Sent: Monday, December 19, 2022 4:47 PM

+static bool vfio_device_enforced_coherent(struct vfio_device *device)
+{
+	bool ret;
+
+	if (!vfio_device_try_get_registration(device))
+		return true;
+
+	ret = device_iommu_capable(device->dev,
+
IOMMU_CAP_ENFORCE_CACHE_COHERENCY);
+
+	vfio_device_put_registration(device);
+	return ret;
+}

This probably needs an explanation that recounting is required because
this might be called before vfio_device_open() is called to hold the count.

yes.

+static void vfio_device_file_set_kvm(struct file *file, struct kvm *kvm)
+{
+	struct vfio_device_file *df = file->private_data;
+	struct vfio_device *device = df->device;
+
+	/*
+	 * The kvm is first recorded in the df, and will be propagated
+	 * to vfio_device::kvm when the file binds iommufd successfully in
+	 * the vfio device cdev path.
+	 */

/*
  * The kvm is first recorded in vfio_device_file and later propagated
  * to vfio_device::kvm when the file is successfully bound to iommufd
  * in the cdev path
  */

got it.

--
Regards,
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