On Tuesday 15 January 2013, Marek Szyprowski wrote:
I'm sorry, but from my perspective this patch and the yet another dma attribute shows that there is something fishy happening in the exynos-drm driver. Creating a mapping in DMA address space is the MAIN purpose of the DMA mapping subsystem, so adding an attribute which skips this operation already should give you a sign of warning that something is not used right.
It looks that dma-mapping in the current state is simply not adequate for this driver. I noticed that DRM drivers are already known for implementing a lots of common code for their own with slightly changed behavior, like custom page manager/allocator. It looks that exynos-drm driver grew to the point where it also needs such features. It already contains custom code for CPU cache handling, IOMMU and contiguous memory special cases management. I would advise to drop DMA-mapping API completely, avoid adding yet another dozen of DMA attributes useful only for one driver and implement your own memory manager with direct usage of IOMMU API, alloc_pages() and dma_alloc_pages_from_contiguous(). This way DMA mapping subsystem can be kept simple, robust and easy to understand without confusing or conflicting parts.
Makes sense. DRM drivers and KVM are the two cases where you typically want to use the iommu API rather than the dma-mapping API, because you need protection between multiple concurrent user contexts.
Arnd