diff options
-rw-r--r-- | arch/arm/Kconfig | 21 | ||||
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 3 |
2 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 67874b82a4ed..4e89112b57e0 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -75,6 +75,27 @@ config ARM_DMA_USE_IOMMU | |||
75 | select ARM_HAS_SG_CHAIN | 75 | select ARM_HAS_SG_CHAIN |
76 | select NEED_SG_DMA_LENGTH | 76 | select NEED_SG_DMA_LENGTH |
77 | 77 | ||
78 | if ARM_DMA_USE_IOMMU | ||
79 | |||
80 | config ARM_DMA_IOMMU_ALIGNMENT | ||
81 | int "Maximum PAGE_SIZE order of alignment for DMA IOMMU buffers" | ||
82 | range 4 9 | ||
83 | default 8 | ||
84 | help | ||
85 | DMA mapping framework by default aligns all buffers to the smallest | ||
86 | PAGE_SIZE order which is greater than or equal to the requested buffer | ||
87 | size. This works well for buffers up to a few hundreds kilobytes, but | ||
88 | for larger buffers it just a waste of address space. Drivers which has | ||
89 | relatively small addressing window (like 64Mib) might run out of | ||
90 | virtual space with just a few allocations. | ||
91 | |||
92 | With this parameter you can specify the maximum PAGE_SIZE order for | ||
93 | DMA IOMMU buffers. Larger buffers will be aligned only to this | ||
94 | specified order. The order is expressed as a power of two multiplied | ||
95 | by the PAGE_SIZE. | ||
96 | |||
97 | endif | ||
98 | |||
78 | config HAVE_PWM | 99 | config HAVE_PWM |
79 | bool | 100 | bool |
80 | 101 | ||
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 2163af4b31b8..6e2511561c3e 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -1029,6 +1029,9 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping, | |||
1029 | unsigned int count, start; | 1029 | unsigned int count, start; |
1030 | unsigned long flags; | 1030 | unsigned long flags; |
1031 | 1031 | ||
1032 | if (order > CONFIG_ARM_DMA_IOMMU_ALIGNMENT) | ||
1033 | order = CONFIG_ARM_DMA_IOMMU_ALIGNMENT; | ||
1034 | |||
1032 | count = ((PAGE_ALIGN(size) >> PAGE_SHIFT) + | 1035 | count = ((PAGE_ALIGN(size) >> PAGE_SHIFT) + |
1033 | (1 << mapping->order) - 1) >> mapping->order; | 1036 | (1 << mapping->order) - 1) >> mapping->order; |
1034 | 1037 | ||