Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753110AbbKJNnM (ORCPT ); Tue, 10 Nov 2015 08:43:12 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:18416 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752211AbbKJNnJ (ORCPT ); Tue, 10 Nov 2015 08:43:09 -0500 X-AuditID: cbfec7f5-f794b6d000001495-e1-5641f46bd601 Subject: Re: [PATCH 1/1] drivers: of: of_reserved_mem: fixup the alignment with CMA setup To: Jason Liu , devicetree@vger.kernel.org References: <1447158626-7773-1-git-send-email-r64343@freescale.com> Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, grant.likely@linaro.org From: Marek Szyprowski Message-id: <5641F469.2030503@samsung.com> Date: Tue, 10 Nov 2015 14:43:05 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-version: 1.0 In-reply-to: <1447158626-7773-1-git-send-email-r64343@freescale.com> Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrCLMWRmVeSWpSXmKPExsVy+t/xa7rZXxzDDP6+4rGYf+Qcq8WBPzsY LTY9vsZqcXnXHDaLN6cPM1m07j3C7sDm8e9wP5PHplWdbB53ru1h89i8pN7j8ya5ANYoLpuU 1JzMstQifbsErozuAz+YCj7xVcw4OJ+xgXEeTxcjJ4eEgInErl8H2CBsMYkL99YD2VwcQgJL GSW+XnvFCuE8Z5T437aLGaRKWCBa4vrOTSwgtoiAg8TKnS8ZQWwhAWeJy/++sncxcnAwC5RK XLvLBxJmEzCU6HrbBbaAV0BLYsHCd2A2i4CqxMUTZ8BsUYEYifebVjFC1AhK/Jh8jwVkDKeA i8TulaIgYWYBM4kvLw+zQtjyEpvXvGWewCgwC0nHLCRls5CULWBkXsUomlqaXFCclJ5rpFec mFtcmpeul5yfu4kREtZfdzAuPWZ1iFGAg1GJh3fCN4cwIdbEsuLK3EOMEhzMSiK8jK8dw4R4 UxIrq1KL8uOLSnNSiw8xSnOwKInzztz1PkRIID2xJDU7NbUgtQgmy8TBKdXAyO7sl5t+eo/Q 09PvmhJ2cRcpNmxVvl1wXsfOyvs6z42Xaz2Yk7JezLq5ycdLecHUI0bBjl9ZWrt0FrJFTJ3D yhzc9N+D58D/nx1zso58Vy7zXnAxesIM8wcbQ3LC/KfNkb0e4RZ4Oz4rQefovzjPo5M8zyU9 jTawvX2DKzEtwbMrZp9apkOrEktxRqKhFnNRcSIA2t+St2cCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2101 Lines: 55 Hello, On 2015-11-10 13:30, Jason Liu wrote: > There is an alignment mismatch issue between the of_reserved_mem and > the CMA setup requirement. The of_reserved_mem will try to get the > alignment value from the DTS and pass it to __memblock_alloc_base to > do the memory block base allocation, but the alignment value specified > in the DTS may not satisfy the CAM setup requirement since CMA setup > required the alignment as the following in the code: > > align = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order); > > The sanity check in the function of rmem_cma_setup will fail if the > alignment does not setup correctly and thus CMA will fail to setup. > > This patch is to fixup the alignment to meet the CMA setup required. > > Mailing-list-thread: https://lkml.org/lkml/2015/11/9/138 > Signed-off-by: Jason Liu > Cc: Marek Szyprowski > Cc: Grant Likely > Cc: Rob Herring Acked-by: Marek Szyprowski > --- > drivers/of/of_reserved_mem.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c > index 62f467b..9394311 100644 > --- a/drivers/of/of_reserved_mem.c > +++ b/drivers/of/of_reserved_mem.c > @@ -124,6 +124,10 @@ static int __init __reserved_mem_alloc_size(unsigned long node, > align = dt_mem_next_cell(dt_root_addr_cells, &prop); > } > > + /* Need adjust the alignment to satisfy the CMA requirement */ > + if (IS_ENABLED(CONFIG_CMA) && of_flat_dt_is_compatible(node, "shared-dma-pool")) > + align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order)); > + > prop = of_get_flat_dt_prop(node, "alloc-ranges", &len); > if (prop) { > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/