iommufd: Add iommufd_ctx_has_group()
authorYi Liu <yi.l.liu@intel.com>
Tue, 18 Jul 2023 10:55:36 +0000 (03:55 -0700)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 25 Jul 2023 16:17:52 +0000 (10:17 -0600)
commit86b0a96c2952fa07b782b37f6ec783ace63a01a6
treeeec72297c54a71f2094af4277704f777b9639403
parenteda175dfe2484c1e79afaee0f65eeebfb9f89a53
iommufd: Add iommufd_ctx_has_group()

This adds the helper to check if any device within the given iommu_group
has been bound with the iommufd_ctx. This is helpful for the checking on
device ownership for the devices which have not been bound but cannot be
bound to any other iommufd_ctx as the iommu_group has been bound.

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Yanting Jiang <yanting.jiang@intel.com>
Tested-by: Terrence Xu <terrence.xu@intel.com>
Tested-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Link: https://lore.kernel.org/r/20230718105542.4138-5-yi.l.liu@intel.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/iommu/iommufd/device.c
include/linux/iommufd.h