Skip to content

Commit 21c0357

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu: Hide ops.domain_alloc behind CONFIG_FSL_PAMU
fsl_pamu is the last user of domain_alloc(), and it is using it to create something weird that doesn't really fit into the iommu subsystem architecture. It is a not a paging domain since it doesn't have any map/unmap ops. It may be some special kind of identity domain. For now just leave it as is. Wrap it's definition in CONFIG_FSL_PAMU to discourage any new drivers from attempting to use it. Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Link: https://lore.kernel.org/r/5-v4-ff5fb6b03bd1+288-iommu_virtio_domains_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent a4672d0 commit 21c0357

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

drivers/iommu/iommu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,8 +2025,10 @@ __iommu_paging_domain_alloc_flags(struct device *dev, unsigned int type,
20252025
domain = ops->domain_alloc_paging(dev);
20262026
else if (ops->domain_alloc_paging_flags)
20272027
domain = ops->domain_alloc_paging_flags(dev, flags, NULL);
2028+
#if IS_ENABLED(CONFIG_FSL_PAMU)
20282029
else if (ops->domain_alloc && !flags)
20292030
domain = ops->domain_alloc(IOMMU_DOMAIN_UNMANAGED);
2031+
#endif
20302032
else
20312033
return ERR_PTR(-EOPNOTSUPP);
20322034

include/linux/iommu.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,7 @@ iommu_copy_struct_from_full_user_array(void *kdst, size_t kdst_entry_size,
564564
* op is allocated in the iommu driver and freed by the caller after
565565
* use. The information type is one of enum iommu_hw_info_type defined
566566
* in include/uapi/linux/iommufd.h.
567-
* @domain_alloc: allocate and return an iommu domain if success. Otherwise
568-
* NULL is returned. The domain is not fully initialized until
569-
* the caller iommu_domain_alloc() returns.
567+
* @domain_alloc: Do not use in new drivers
570568
* @domain_alloc_identity: allocate an IDENTITY domain. Drivers should prefer to
571569
* use identity_domain instead. This should only be used
572570
* if dynamic logic is necessary.
@@ -627,7 +625,9 @@ struct iommu_ops {
627625
void *(*hw_info)(struct device *dev, u32 *length, u32 *type);
628626

629627
/* Domain allocation and freeing by the iommu driver */
628+
#if IS_ENABLED(CONFIG_FSL_PAMU)
630629
struct iommu_domain *(*domain_alloc)(unsigned iommu_domain_type);
630+
#endif
631631
struct iommu_domain *(*domain_alloc_identity)(struct device *dev);
632632
struct iommu_domain *(*domain_alloc_paging_flags)(
633633
struct device *dev, u32 flags,

0 commit comments

Comments
 (0)