Skip to content

Commit ca37faf

Browse files
mszyprowjoergroedel
authored andcommitted
iommu: Move sg_table wrapper out of CONFIG_IOMMU_SUPPORT
Move the recently added sg_table wrapper out of CONFIG_IOMMU_SUPPORT to let the client code copile also when IOMMU support is disabled. Fixes: 48530d9 ("iommu: add generic helper for mapping sgtable objects") Signed-off-by: Marek Szyprowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 6255c8c commit ca37faf

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

include/linux/iommu.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -457,22 +457,6 @@ extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t io
457457
extern void iommu_set_fault_handler(struct iommu_domain *domain,
458458
iommu_fault_handler_t handler, void *token);
459459

460-
/**
461-
* iommu_map_sgtable - Map the given buffer to the IOMMU domain
462-
* @domain: The IOMMU domain to perform the mapping
463-
* @iova: The start address to map the buffer
464-
* @sgt: The sg_table object describing the buffer
465-
* @prot: IOMMU protection bits
466-
*
467-
* Creates a mapping at @iova for the buffer described by a scatterlist
468-
* stored in the given sg_table object in the provided IOMMU domain.
469-
*/
470-
static inline size_t iommu_map_sgtable(struct iommu_domain *domain,
471-
unsigned long iova, struct sg_table *sgt, int prot)
472-
{
473-
return iommu_map_sg(domain, iova, sgt->sgl, sgt->orig_nents, prot);
474-
}
475-
476460
extern void iommu_get_resv_regions(struct device *dev, struct list_head *list);
477461
extern void iommu_put_resv_regions(struct device *dev, struct list_head *list);
478462
extern void generic_iommu_put_resv_regions(struct device *dev,
@@ -1079,6 +1063,22 @@ static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev)
10791063
}
10801064
#endif /* CONFIG_IOMMU_API */
10811065

1066+
/**
1067+
* iommu_map_sgtable - Map the given buffer to the IOMMU domain
1068+
* @domain: The IOMMU domain to perform the mapping
1069+
* @iova: The start address to map the buffer
1070+
* @sgt: The sg_table object describing the buffer
1071+
* @prot: IOMMU protection bits
1072+
*
1073+
* Creates a mapping at @iova for the buffer described by a scatterlist
1074+
* stored in the given sg_table object in the provided IOMMU domain.
1075+
*/
1076+
static inline size_t iommu_map_sgtable(struct iommu_domain *domain,
1077+
unsigned long iova, struct sg_table *sgt, int prot)
1078+
{
1079+
return iommu_map_sg(domain, iova, sgt->sgl, sgt->orig_nents, prot);
1080+
}
1081+
10821082
#ifdef CONFIG_IOMMU_DEBUGFS
10831083
extern struct dentry *iommu_debugfs_dir;
10841084
void iommu_debugfs_setup(void);

0 commit comments

Comments
 (0)