lkml.org 
[lkml]   [2023]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v2 09/14] vfio-iommufd: Add detach_ioas support for physical VFIO devices
Date
> From: Liu, Yi L <yi.l.liu@intel.com>
> Sent: Monday, February 6, 2023 5:05 PM
>
> +static void __vfio_iommufd_detach(struct vfio_device *vdev)
> +{
> + iommufd_device_detach(vdev->iommufd_device);
> + vdev->iommufd_attached = false;
> +}
> +
> void vfio_iommufd_physical_unbind(struct vfio_device *vdev)
> {
> lockdep_assert_held(&vdev->dev_set->lock);
>
> - if (vdev->iommufd_attached) {
> - iommufd_device_detach(vdev->iommufd_device);
> - vdev->iommufd_attached = false;
> - }
> + if (vdev->iommufd_attached)
> + __vfio_iommufd_detach(vdev);

I'm not sure whether this abstraction really improves things.

Just two callers. and the old code reads clearer to me which
checks a flag, does something and then clear the flag.

> @@ -74,6 +74,7 @@ struct vfio_device {
> * @unbind_iommufd: Opposite of bind_iommufd
> * @attach_ioas: Called when attaching device to an IOAS/HWPT managed
> by the
> * bound iommufd. Undo in unbind_iommufd.

"Undo in unbind_iommufd if @detach_ioas is not called".

> + * @detach_ioas: Opposite of attach_ioas, this is for runtime undo.

remove "this is for runtime undo" which is confusing.

\
 
 \ /
  Last update: 2023-03-27 00:12    [W:0.305 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site