diff options
author | Charan Teja Reddy <charante@codeaurora.org> | 2017-04-11 18:28:03 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-04-11 06:03:22 -0700 |
commit | 32cec6bec311c0a1e12f287e0c3299f15da975ac (patch) | |
tree | 356a43e0f00bd291ab2d250c9e06b5af7fc0866e /arch/arm/mm | |
parent | de6efb5e9454a2fd41c722daea210bae7b6134fe (diff) |
dma-mapping: add the missing functions to dma_map_ops
Add the missing callback functions on 32bit systems that can be used to
set the dma_mask and get the dma error information.
Change-Id: I69c454ea8cbceb4301ec812c5f74f6a751fc7df1
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 00cc892fbe59..8bda55f00b7b 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -2085,6 +2085,25 @@ 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); +} + +static int arm_iommu_mapping_error(struct device *dev, + dma_addr_t dma_addr) +{ + return dma_addr == DMA_ERROR_CODE; +} + + const struct dma_map_ops iommu_ops = { .alloc = arm_iommu_alloc_attrs, .free = arm_iommu_free_attrs, @@ -2102,6 +2121,8 @@ 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, + .mapping_error = arm_iommu_mapping_error, }; const struct dma_map_ops iommu_coherent_ops = { |