summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorNeeti Desai <neetid@codeaurora.org>2015-05-13 17:57:25 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:12:41 -0700
commit5ba8d1e0c463cdff70cca40c0992e9ad47a1e051 (patch)
treed66f1ed9c95df66d633bbb376d82d757c2045121 /arch
parentad9a4c040c188d7761f7da055bfc6b4ad3b4ab62 (diff)
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: Neeti Desai <neetid@codeaurora.org> Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm64/mm/dma-mapping.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 08df069bc056..7f6d6e318e88 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -1942,6 +1942,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,
@@ -1959,6 +1971,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 = {
@@ -1974,6 +1987,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,
};
/**