• Marek Szyprowski's avatar
    ARM: dma-mapping: fix buffer chunk allocation order · 593f4735
    Marek Szyprowski authored
    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: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
    593f4735
dma-mapping.c 43.1 KB