AnsweredAssumed Answered

i.MX6 2GiB RAM, DMA failed to allocate 100 KiB pool

Question asked by Jose Diaz de Grenu de Pedro on Jul 3, 2017
Latest reply on Jul 4, 2017 by Jose Diaz de Grenu de Pedro

After the following commit (see at the end), my i.MX6 based module with 2GiB of RAM memory is failing to boot, with this message:

 

[    0.026409] DMA: failed to allocate 100 KiB pool for atomic coherent allocation

 

Could it be because the memory modules have different physical memory adrress blocks ? Any suggestion to fix it?

 

[v4.1/dey-2.2/maint] jdepedro:~/projects/linux$ git show 444cf5487d5f51a3ecce2a0dfe237156290dfc7f
commit 444cf5487d5f51a3ecce2a0dfe237156290dfc7f
Author: Vinayak Menon <vinmenon@codeaurora.org>
Date: Mon Feb 22 19:15:44 2016 +0530

of: alloc anywhere from memblock if range not specified

[ Upstream commit e53b50c0cbe392c946807abf7d07615a3c588642 ]

early_init_dt_alloc_reserved_memory_arch passes end as 0 to
__memblock_alloc_base, when limits are not specified. But
__memblock_alloc_base takes end value of 0 as MEMBLOCK_ALLOC_ACCESSIBLE
and limits the end to memblock.current_limit. This results in regions
never being placed in HIGHMEM area, for e.g. CMA.
Let __memblock_alloc_base allocate from anywhere in memory if limits are
not specified.

Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Cc: stable@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 726ebe792813..26fb7b0b856c 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -31,11 +31,13 @@ int __init __weak early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
phys_addr_t align, phys_addr_t start, phys_addr_t end, bool nomap,
phys_addr_t *res_base)
{
+ phys_addr_t base;
/*
* We use __memblock_alloc_base() because memblock_alloc_base()
* panic()s on allocation failure.
*/
- phys_addr_t base = __memblock_alloc_base(size, align, end);
+ end = !end ? MEMBLOCK_ALLOC_ANYWHERE : end;
+ base = __memblock_alloc_base(size, align, end);
if (!base)
return -ENOMEM;

Outcomes