summaryrefslogtreecommitdiff
path: root/include/linux/iommufd.h
diff options
context:
space:
mode:
authorNicolin Chen <nicolinc@nvidia.com>2024-11-05 12:04:18 -0800
committerJason Gunthorpe <jgg@nvidia.com>2024-11-12 11:46:18 -0400
commit7d4f46c2372d5a850e28f63001013de50843b6e6 (patch)
treef4dddd0e13fed3afcb31c24bc80a5063f493b92d /include/linux/iommufd.h
parentd1b3dad9de7962f7bea861f27e352bac17b68bed (diff)
iommufd: Move _iommufd_object_alloc helper to a sharable file
The following patch will add a new vIOMMU allocator that will require this _iommufd_object_alloc to be sharable with IOMMU drivers (and iommufd too). Add a new driver.c file that will be built with CONFIG_IOMMUFD_DRIVER_CORE selected by CONFIG_IOMMUFD, and put the CONFIG_DRIVER under that remaining to be selectable for drivers to build the existing iova_bitmap.c file. Link: https://patch.msgid.link/r/2f4f6e116dc49ffb67ff6c5e8a7a8e789ab9e98e.1730836219.git.nicolinc@nvidia.com Suggested-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'include/linux/iommufd.h')
-rw-r--r--include/linux/iommufd.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/iommufd.h b/include/linux/iommufd.h
index 22948dd03d67..94522d4029ca 100644
--- a/include/linux/iommufd.h
+++ b/include/linux/iommufd.h
@@ -135,4 +135,17 @@ static inline int iommufd_vfio_compat_set_no_iommu(struct iommufd_ctx *ictx)
return -EOPNOTSUPP;
}
#endif /* CONFIG_IOMMUFD */
+
+#if IS_ENABLED(CONFIG_IOMMUFD_DRIVER_CORE)
+struct iommufd_object *_iommufd_object_alloc(struct iommufd_ctx *ictx,
+ size_t size,
+ enum iommufd_object_type type);
+#else /* !CONFIG_IOMMUFD_DRIVER_CORE */
+static inline struct iommufd_object *
+_iommufd_object_alloc(struct iommufd_ctx *ictx, size_t size,
+ enum iommufd_object_type type)
+{
+ return ERR_PTR(-EOPNOTSUPP);
+}
+#endif /* CONFIG_IOMMUFD_DRIVER_CORE */
#endif