From patchwork Mon Nov 30 22:10:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Mostafa X-Patchwork-Id: 550461 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id E56AE140281; Tue, 1 Dec 2015 09:14:16 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1a3Wi6-0001Km-OJ; Mon, 30 Nov 2015 22:14:14 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1a3WeQ-0007Wg-4O for kernel-team@lists.ubuntu.com; Mon, 30 Nov 2015 22:10:26 +0000 Received: from 1.general.kamal.us.vpn ([10.172.68.52] helo=fourier) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1a3WeP-0001gI-KQ; Mon, 30 Nov 2015 22:10:25 +0000 Received: from kamal by fourier with local (Exim 4.82) (envelope-from ) id 1a3WeN-0003Ae-Dx; Mon, 30 Nov 2015 14:10:23 -0800 From: Kamal Mostafa To: Jason Liu Subject: [3.19.y-ckt stable] Patch "drivers: of: of_reserved_mem: fixup the alignment with CMA setup" has been added to staging queue Date: Mon, 30 Nov 2015 14:10:22 -0800 Message-Id: <1448921422-12158-1-git-send-email-kamal@canonical.com> X-Mailer: git-send-email 1.9.1 X-Extended-Stable: 3.19 Cc: Rob Herring , Kamal Mostafa , kernel-team@lists.ubuntu.com, Rob Herring , Grant Likely , Marek Szyprowski X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com This is a note to let you know that I have just added a patch titled drivers: of: of_reserved_mem: fixup the alignment with CMA setup to the linux-3.19.y-queue branch of the 3.19.y-ckt extended stable tree which can be found at: http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.19.y-queue This patch is scheduled to be released in version 3.19.8-ckt11. If you, or anyone else, feels it should not be added to this tree, please reply to this email. For more information about the 3.19.y-ckt tree, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable Thanks. -Kamal ------ From 98c34cd04795b5a38309282e9ba01ac69ee122de Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Tue, 10 Nov 2015 20:30:26 +0800 Subject: drivers: of: of_reserved_mem: fixup the alignment with CMA setup commit 1cc8e3458b5110253c8f5aaf1890d5ffea9bb7b7 upstream. 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 Acked-by: Marek Szyprowski Cc: Grant Likely Cc: Rob Herring Signed-off-by: Rob Herring Signed-off-by: Kamal Mostafa --- drivers/of/of_reserved_mem.c | 4 ++++ 1 file changed, 4 insertions(+) -- 1.9.1 diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index dc566b3..4442c1a 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -123,6 +123,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) {