Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 158a6d3c authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by Christoph Hellwig
Browse files

iommu/dma: add a new dma_map_ops of get_merge_boundary()



This patch adds a new dma_map_ops of get_merge_boundary() to
expose the DMA merge boundary if the domain type is IOMMU_DOMAIN_DMA.

Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Acked-by: default avatarJoerg Roedel <jroedel@suse.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 6ba99411
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1086,6 +1086,13 @@ static int iommu_dma_get_sgtable(struct device *dev, struct sg_table *sgt,
	return ret;
}

static unsigned long iommu_dma_get_merge_boundary(struct device *dev)
{
	struct iommu_domain *domain = iommu_get_dma_domain(dev);

	return (1UL << __ffs(domain->pgsize_bitmap)) - 1;
}

static const struct dma_map_ops iommu_dma_ops = {
	.alloc			= iommu_dma_alloc,
	.free			= iommu_dma_free,
@@ -1101,6 +1108,7 @@ static const struct dma_map_ops iommu_dma_ops = {
	.sync_sg_for_device	= iommu_dma_sync_sg_for_device,
	.map_resource		= iommu_dma_map_resource,
	.unmap_resource		= iommu_dma_unmap_resource,
	.get_merge_boundary	= iommu_dma_get_merge_boundary,
};

/*