Hello,

This is a request for comments on dma-mapping patches for ARM. I did some additions for issue related to kernel virtual memory allocations in the iommu ops defined in dma-mapping framework. 

The patches are based on:

git://git.linaro.org/people/mszyprowski/linux-dma-mapping.git 3.4-rc3-arm-dma-v9

The code has been tested on Samsung Exynos5 SMDK5250.

These patches do the following:

1. Define a new dma attribute to identify user space allocation.

2. Add new wrapper functions to pass the dma attribute defined in (1) above, as in the current framework there is no way to pass the new attribute which can be used to differentiate between kernel and user allocations.

3. Extend the existing arm_dma_ops for iommu enabled devices to differentiate between kernel and user space allocations.

Patch summary:

[PATCH 1/3]:

Common: add DMA_ATTR_USER_SPACE to dma-attr. This can be passed to arm_dma_ops to identify the type of allocation which can be either from kernel or from user.

[PATCH 2/3]:

ARM: add "struct page_infodma" to hold information for allocated pages. This can be attached to any of the devices which is making use of dma-mapping APIs. Any interested device should allocate this structure and store all the relevant information about the allocated pages to be able to do a look up for all future references.

ARM: add dma_alloc_writecombine_user() function to pass DMA_ATTR_USER_SPACE attribute

ARM: add dma_free_writecombine_user() function to pass DMA_ATTR_USER_SPACE attribute

ARM: add dma_mmap_writecombine_user() function to pass DMA_ATTR_USER_SPACE attribute

[PATCH 3/3]:

ARM: add check for allocation type in __dma_alloc_remap() function

ARM: add check for allocation type in arm_iommu_alloc_attrs() function

ARM: add check for allocation type in arm_iommu_mmap_attrs() function

ARM: re-used dma_addr as a flag to check for memory allocation type. It was an unused argument and the prototype does not pass dma-attrs, so used this as a means to pass the flag.

ARM: add check for allocation type in arm_iommu_free_attrs() function

arch/arm/include/asm/dma-mapping.h |   31 +++++++

arch/arm/mm/dma-mapping.c          |  168 ++++++++++++++++++++++++++----------

include/linux/dma-attrs.h          |    1 +

3 files changed, 155 insertions(+), 45 deletions(-)