android: ion: do not map in dma_map_attach() for Exynos
dma_buf ops of ION does two unneccessary works. One is duplicating
sg_table in dma_map_attach() and the other is dma_map_sg() call in
dma_buf_map_attachment(). The duplication of sg_table is neccessary
in fact because dma_map_sg() updates dma_address fields of scatter-
gather list in sg_table with the DMA address of the given device.
It is true with the devices with IOMMU that provides dma-mapping ops.
But our IOMMU, System MMU driver does not provide dma-mapping ops.
Therefor, DMA addresses of the same physical memory location are not
different between devices in Exynos SoCs.
ion_buffer_create() calls dma_map_sg() to initialize dma_address
fields sg_table from the following commit:
'commit
8215d29 ("android: ion: add fixups to ion exynos extension")'
Now we can use the sg_table in ion_buffer for all devices. We can
avoid duplicating sg_table on every dma_buf_attach() call. We can
replace dma_map_sg() with dma_sync_sg_for_device() in
dma_buf_map_attachment().
ion_dma_buf_attach() and ion_dma_buf_detach() are no more required.
it does nothing after sg_table duplication is removed.
For the maintenance reason, we do not remove the unused dma_buf ops
of ION in ion.c. Instead we adds our implementation of map_dma_buf()
and unmap_dma_buf() ops to dma_buf ops of ION if CONFIG_ION_EXYNOS
is configured.
Change-Id: I1764a7eb62e948f074b596e316fe3f48ed3f8662
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>