iommufd: Add iommufd_ctx_from_fd()
authorYi Liu <yi.l.liu@intel.com>
Tue, 18 Jul 2023 13:55:45 +0000 (06:55 -0700)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 25 Jul 2023 16:19:53 +0000 (10:19 -0600)
commit1c9dc07487cb0f246075b2d3b305bba91156d376
treed0c650d7449e67bb9b886d6dcb2350c6436bc28f
parent5c6de3ea73768d1781024e4a41f77d6d71bc64cb
iommufd: Add iommufd_ctx_from_fd()

It's common to get a reference to the iommufd context from a given file
descriptor. So adds an API for it. Existing users of this API are compiled
only when IOMMUFD is enabled, so no need to have a stub for the IOMMUFD
disabled case.

Tested-by: Yanting Jiang <yanting.jiang@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Link: https://lore.kernel.org/r/20230718135551.6592-21-yi.l.liu@intel.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/iommu/iommufd/main.c
include/linux/iommufd.h