From 9525fd7f37b8d6c214fad960448f9e883cb48682 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 6 Feb 2013 13:21:14 +0900 Subject: [PATCH] --- yaml --- r: 358822 b: refs/heads/master c: 60460abffc71523d65774f43ce1252972eeb0629 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/arm/Kconfig | 21 +++++++++++++++++++++ trunk/arch/arm/mm/dma-mapping.c | 3 +++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 784e5d6287b7..ea1f8954c8c4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f8669bef11fadfe811a5d7d59cb327499edac088 +refs/heads/master: 60460abffc71523d65774f43ce1252972eeb0629 diff --git a/trunk/arch/arm/Kconfig b/trunk/arch/arm/Kconfig index 67874b82a4ed..4e89112b57e0 100644 --- a/trunk/arch/arm/Kconfig +++ b/trunk/arch/arm/Kconfig @@ -75,6 +75,27 @@ config ARM_DMA_USE_IOMMU select ARM_HAS_SG_CHAIN select NEED_SG_DMA_LENGTH +if ARM_DMA_USE_IOMMU + +config ARM_DMA_IOMMU_ALIGNMENT + int "Maximum PAGE_SIZE order of alignment for DMA IOMMU buffers" + range 4 9 + default 8 + help + DMA mapping framework by default aligns all buffers to the smallest + PAGE_SIZE order which is greater than or equal to the requested buffer + size. This works well for buffers up to a few hundreds kilobytes, but + for larger buffers it just a waste of address space. Drivers which has + relatively small addressing window (like 64Mib) might run out of + virtual space with just a few allocations. + + With this parameter you can specify the maximum PAGE_SIZE order for + DMA IOMMU buffers. Larger buffers will be aligned only to this + specified order. The order is expressed as a power of two multiplied + by the PAGE_SIZE. + +endif + config HAVE_PWM bool diff --git a/trunk/arch/arm/mm/dma-mapping.c b/trunk/arch/arm/mm/dma-mapping.c index 2163af4b31b8..6e2511561c3e 100644 --- a/trunk/arch/arm/mm/dma-mapping.c +++ b/trunk/arch/arm/mm/dma-mapping.c @@ -1029,6 +1029,9 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping, unsigned int count, start; unsigned long flags; + if (order > CONFIG_ARM_DMA_IOMMU_ALIGNMENT) + order = CONFIG_ARM_DMA_IOMMU_ALIGNMENT; + count = ((PAGE_ALIGN(size) >> PAGE_SHIFT) + (1 << mapping->order) - 1) >> mapping->order;