ARM: dma-mapping: fix buffer chunk allocation order
authorMarek Szyprowski <m.szyprowski@samsung.com>
Thu, 21 Jun 2012 09:48:11 +0000 (11:48 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Tue, 26 Feb 2013 17:51:23 +0000 (19:51 +0200)
commitf517dd14e04d313c06318b0b32241a22de1f4762
tree9ee03b3a2b7e8715a96c5f1b39993bd7c93c1d1d
parenta8bd1d841122f535fda3c20db9fe2768513b12fa
ARM: dma-mapping: fix buffer chunk allocation order

IOMMU-aware dma_alloc_attrs() implementation allocates buffers in
power-of-two chunks to improve performance and take advantage of large
page mappings provided by some IOMMU hardware. However current code, due
to a subtle bug, allocated those chunks in the smallest-to-largest
order, what completely killed all the advantages of using larger than
page chunks. If a 4KiB chunk has been mapped as a first chunk, the
consecutive chunks are not aligned correctly to the power-of-two which
match their size and IOMMU drivers were not able to use internal
mappings of size other than the 4KiB (largest common denominator of
alignment and chunk size).

This patch fixes this issue by changing to the correct largest-to-smallest
chunk size allocation sequence.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
arch/arm/mm/dma-mapping.c