summaryrefslogtreecommitdiff
path: root/include/linux/iommu.h
diff options
context:
space:
mode:
authorVasant Hegde <vasant.hegde@amd.com>2024-02-05 14:56:07 +0300
committerJoerg Roedel <jroedel@suse.de>2024-02-09 15:16:26 +0300
commitbf8aff2945ba4091f503df673b9df33002546e6a (patch)
treecbaeb7324c602f203e6696778b08d72cc0ba8021 /include/linux/iommu.h
parentb2e8a7f5d2c3d99285e13cdd330d339d9b040599 (diff)
downloadlinux-bf8aff2945ba4091f503df673b9df33002546e6a.tar.xz
iommu: Introduce iommu_group_mutex_assert()
Add function to check iommu group mutex lock. So that device drivers can rely on group mutex lock instead of adding another driver level lock before modifying driver specific device data structure. Suggested-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Vasant Hegde <vasant.hegde@amd.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20240205115615.6053-10-vasant.hegde@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'include/linux/iommu.h')
-rw-r--r--include/linux/iommu.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 32bb121e8032..8141a37556d5 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -1356,6 +1356,14 @@ static inline ioasid_t iommu_alloc_global_pasid(struct device *dev)
static inline void iommu_free_global_pasid(ioasid_t pasid) {}
#endif /* CONFIG_IOMMU_API */
+#if IS_ENABLED(CONFIG_LOCKDEP) && IS_ENABLED(CONFIG_IOMMU_API)
+void iommu_group_mutex_assert(struct device *dev);
+#else
+static inline void iommu_group_mutex_assert(struct device *dev)
+{
+}
+#endif
+
/**
* iommu_map_sgtable - Map the given buffer to the IOMMU domain
* @domain: The IOMMU domain to perform the mapping