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

Commit 040a288a authored by Neeti Desai's avatar Neeti Desai Committed by Patrick Daly
Browse files

arm64: dma_mapping: Add support for .dma_mapping_error() ops



If dma_map_single() or dma_map_page() fail to create a mapping, clients
can check these errors by testing the returned address with
.dma_mapping_error(). The implementation was missing for DMA IOMMU
mapper.  Add it.

Change-Id: I7e62bdbcd013cab915134fce9e55b1e7b580915a
Signed-off-by: default avatarNeeti Desai <neetid@codeaurora.org>
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent 5ee55de8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1921,6 +1921,12 @@ static void arm_iommu_sync_single_for_device(struct device *dev,
	__dma_page_cpu_to_dev(page, offset, size, dir);
}

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,
@@ -1938,6 +1944,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,
	.mapping_error		= arm_iommu_mapping_error,
};

const struct dma_map_ops iommu_coherent_ops = {