Thread (14 messages) 14 messages, 2 authors, 2012-05-11

[PATCHv9 10/10] ARM: dma-mapping: add support for IOMMU mapper

From: Paul Gortmaker <hidden>
Date: 2012-05-11 02:09:12
Also in: linux-arch, linux-iommu, linux-mm, linux-next

On Wed, Apr 18, 2012 at 9:44 AM, Marek Szyprowski
[off-list ref] wrote:
This patch add a complete implementation of DMA-mapping API for
devices which have IOMMU support.
Hi Marek,

It looks like this patch breaks no-MMU builds on ARM, at least
according to git bisect.  Here is a link to a linux-next failure:

http://kisskb.ellerman.id.au/kisskb/buildresult/6291233/

arch/arm/mm/dma-mapping.c:726:42: error: 'pgprot_kernel' undeclared
(first use in this function)
make[2]: *** [arch/arm/mm/dma-mapping.o] Error 1

Please have a look, thanks.

Paul.
---

This implementation tries to optimize dma address space usage by remapping
all possible physical memory chunks into a single dma address space chunk.

DMA address space is managed on top of the bitmap stored in the
dma_iommu_mapping structure stored in device->archdata. Platform setup
code has to initialize parameters of the dma address space (base address,
size, allocation precision order) with arm_iommu_create_mapping()
function.
To reduce the size of the bitmap, all allocations are aligned to the
specified order of base 4 KiB pages.

dma_alloc_* functions allocate physical memory in chunks, each with
alloc_pages() function to avoid failing if the physical memory gets
fragmented. In worst case the allocated buffer is composed of 4 KiB page
chunks.

dma_map_sg() function minimizes the total number of dma address space
chunks by merging of physical memory chunks into one larger dma address
space chunk. If requested chunk (scatter list entry) boundaries
match physical page boundaries, most calls to dma_map_sg() requests will
result in creating only one chunk in dma address space.

dma_map_page() simply creates a mapping for the given page(s) in the dma
address space.

All dma functions also perform required cache operation like their
counterparts from the arm linear physical memory mapping version.

This patch contains code and fixes kindly provided by:
- Krishna Reddy [off-list ref],
- Andrzej Pietrasiewicz [off-list ref],
- Hiroshi DOYU [off-list ref]

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Konrad Rzeszutek Wilk <redacted>
Tested-By: Subash Patel <redacted>
---
?arch/arm/Kconfig ? ? ? ? ? ? ? ? | ? ?8 +
?arch/arm/include/asm/device.h ? ?| ? ?3 +
?arch/arm/include/asm/dma-iommu.h | ? 34 ++
?arch/arm/mm/dma-mapping.c ? ? ? ?| ?727
+++++++++++++++++++++++++++++++++++++-
?arch/arm/mm/vmregion.h ? ? ? ? ? | ? ?2 +-
?5 files changed, 759 insertions(+), 15 deletions(-)
?create mode 100644 arch/arm/include/asm/dma-iommu.h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help