From: Jason Gunthorpe jgg@nvidia.com Sent: Friday, April 21, 2023 2:51 AM
During creation the hwpt must have the ioas->mutex held until the object is finalized. This means we need to be able to call iommufd_object_abort_and_destroy() while holding the mutex.
Since iommufd_hw_pagetable_destroy() also needs the mutex this is problematic.
Fix it by creating a special abort op for the object that can assume the caller is holding the lock, as required by the contract.
The next patch will add another iommufd_object_abort_and_destroy() for a hwpt.
Fixes: e8d57210035b ("iommufd: Add kAPI toward external drivers for physical devices") Signed-off-by: Jason Gunthorpe jgg@nvidia.com
Reviewed-by: Kevin Tian kevin.tian@intel.com