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

Commit 835197da authored by Neeti Desai's avatar Neeti Desai Committed by Matt Wagantall
Browse files

arm64: dma_mapping: Implement .dma_supported()



The dma_supported() API checks to see if the device can support DMA to
the memory described by the mask.  Implement this for the DMA IOMMU
mapper by calling into the IOMMU's iommu_dma_supported API.

Change-Id: I5e31e386cd40c3f3312e1be1ca516c6e72213547
Signed-off-by: default avatarNeeti Desai <neetid@codeaurora.org>
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent 67206876
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -1404,6 +1404,18 @@ static void arm_iommu_sync_single_for_device(struct device *dev,
	__dma_page_cpu_to_dev(page, offset, size, dir);
}

static int arm_iommu_dma_supported(struct device *dev, u64 mask)
{
	struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev);

	if (!mapping) {
		dev_warn(dev, "No IOMMU mapping for device\n");
		return 0;
	}

	return iommu_dma_supported(mapping->domain, dev, mask);
}

const struct dma_map_ops iommu_ops = {
	.alloc		= arm_iommu_alloc_attrs,
	.free		= arm_iommu_free_attrs,
@@ -1421,6 +1433,7 @@ const struct dma_map_ops iommu_ops = {
	.sync_sg_for_device	= arm_iommu_sync_sg_for_device,

	.set_dma_mask		= arm_dma_set_mask,
	.dma_supported		= arm_iommu_dma_supported,
};

const struct dma_map_ops iommu_coherent_ops = {
@@ -1436,6 +1449,7 @@ const struct dma_map_ops iommu_coherent_ops = {
	.unmap_sg	= arm_coherent_iommu_unmap_sg,

	.set_dma_mask	= arm_dma_set_mask,
	.dma_supported   = arm_iommu_dma_supported,
};

/**