]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ARM: DMA-mapping: add missing GFP_DMA flag for atomic buffer allocation
authorMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 26 Feb 2013 06:46:24 +0000 (07:46 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Mar 2013 19:18:14 +0000 (12:18 -0700)
commit 9d1400cf79afb49584b4873eb22cd5130cb341db upstream.

Atomic pool should always be allocated from DMA zone if such zone is
available in the system to avoid issues caused by limited dma mask of
any of the devices used for making an atomic allocation.

Reported-by: Krzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/mm/dma-mapping.c

index dda3904dc64c1cb3f7681cf20998397c1e103f76..5397da03e462d51732951d8bbda41132fc82fe51 100644 (file)
@@ -330,6 +330,7 @@ static int __init atomic_pool_init(void)
 {
        struct dma_pool *pool = &atomic_pool;
        pgprot_t prot = pgprot_dmacoherent(pgprot_kernel);
+       gfp_t gfp = GFP_KERNEL | GFP_DMA;
        unsigned long nr_pages = pool->size >> PAGE_SHIFT;
        unsigned long *bitmap;
        struct page *page;
@@ -348,8 +349,8 @@ static int __init atomic_pool_init(void)
        if (IS_ENABLED(CONFIG_CMA))
                ptr = __alloc_from_contiguous(NULL, pool->size, prot, &page);
        else
-               ptr = __alloc_remap_buffer(NULL, pool->size, GFP_KERNEL, prot,
-                                          &page, NULL);
+               ptr = __alloc_remap_buffer(NULL, pool->size, gfp, prot, &page,
+                                          NULL);
        if (ptr) {
                int i;