summaryrefslogtreecommitdiff
path: root/drivers/vfio
diff options
context:
space:
mode:
authorYi Liu <yi.l.liu@intel.com>2023-03-27 12:33:48 +0300
committerJason Gunthorpe <jgg@nvidia.com>2023-03-31 19:43:31 +0300
commit4508a533fce4db0004c1e8dd047c1e77046fc9c5 (patch)
tree9d4571d9f8afd90e83966275e4994c2489de4a2b /drivers/vfio
parent54b47585db6658a5eb898d4d45be18d1e581c1bf (diff)
downloadlinux-4508a533fce4db0004c1e8dd047c1e77046fc9c5.tar.xz
vfio-iommufd: No need to record iommufd_ctx in vfio_device
iommufd_ctx is stored in vfio_device for emulated devices per bind_iommufd. However, as iommufd_access is created in bind, no more need to stored it since iommufd_access implicitly stores it. Link: https://lore.kernel.org/r/20230327093351.44505-4-yi.l.liu@intel.com Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Tested-by: Terrence Xu <terrence.xu@intel.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Acked-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/iommufd.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/vfio/iommufd.c b/drivers/vfio/iommufd.c
index 0695a06db30d..78e2486586d7 100644
--- a/drivers/vfio/iommufd.c
+++ b/drivers/vfio/iommufd.c
@@ -142,14 +142,10 @@ int vfio_iommufd_emulated_bind(struct vfio_device *vdev,
lockdep_assert_held(&vdev->dev_set->lock);
- iommufd_ctx_get(ictx);
user = iommufd_access_create(ictx, &vfio_user_ops, vdev);
- if (IS_ERR(user)) {
- iommufd_ctx_put(ictx);
+ if (IS_ERR(user))
return PTR_ERR(user);
- }
vdev->iommufd_access = user;
- vdev->iommufd_ictx = ictx;
return 0;
}
EXPORT_SYMBOL_GPL(vfio_iommufd_emulated_bind);
@@ -163,8 +159,6 @@ void vfio_iommufd_emulated_unbind(struct vfio_device *vdev)
vdev->iommufd_attached = false;
vdev->iommufd_access = NULL;
}
- iommufd_ctx_put(vdev->iommufd_ictx);
- vdev->iommufd_ictx = NULL;
}
EXPORT_SYMBOL_GPL(vfio_iommufd_emulated_unbind);