Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752663AbbKJMh5 (ORCPT ); Tue, 10 Nov 2015 07:37:57 -0500 Received: from mail-bn1bon0114.outbound.protection.outlook.com ([157.56.111.114]:1488 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752199AbbKJMhx (ORCPT ); Tue, 10 Nov 2015 07:37:53 -0500 X-Greylist: delayed 34180 seconds by postgrey-1.27 at vger.kernel.org; Tue, 10 Nov 2015 07:37:52 EST Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; samsung.com; dkim=none (message not signed) header.d=none;samsung.com; dmarc=none action=none header.from=freescale.com; From: Jason Liu To: CC: , , , , Subject: [PATCH 1/1] drivers: of: of_reserved_mem: fixup the alignment with CMA setup Date: Tue, 10 Nov 2015 20:30:26 +0800 Message-ID: <1447158626-7773-1-git-send-email-r64343@freescale.com> X-Mailer: git-send-email 1.8.3.2 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11OLC015;1:nnzuuMAGC0hYXH638yYISg60Vwv9a0fpT6KT9z9JS8PAN9XNjdMZ6IKMdgMLbIyYTmjOei5Ub6mxpK9+pVJYmlzVacloXltyBg7/x07oCMWdAYMWC/s0XhA1hmz7Nmwg92mpnyYtS3Lzv86HpfUSBgs/k2GqktLONQ2YSaSGP4faUdH0V14AIvnbFDbE64xrnrnGWOUix8YL6tzSSEz7v4o+YgzlX75aWi3EhY8X5ODcsHqbKZDEvHh3RBuXm/W1mxVX/UrRUIEityADf65iiGlU9eqhf15vO59s4eky/OxvdICE64pmwO+vdqvevlZFvz7+LIDb/NLb3VsfYCubdxzDmdnjPFl6b09CHHHyiBpyuGbcwchVAD3CZhbi/Avf X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(50986999)(106466001)(105606002)(50466002)(36756003)(33646002)(104016004)(2351001)(5007970100001)(6806005)(110136002)(11100500001)(229853001)(85426001)(15975445007)(48376002)(50226001)(77096005)(87936001)(5008740100001)(19580395003)(69596002)(19580405001)(97736004)(81156007)(189998001)(5001960100002)(5003940100001)(5001920100001)(92566002)(47776003);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0301MB1223;H:az84smr01.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1223;2:hTFmin2SA1bkU2sBWmXN+Zj3caJ3tW/opzvoK1CbiMfVanWReAwwoMsYpEBtNgP/LOTM41EZDJPWnYIvJwVUIHaRDCjRpK/Ut6oc3lS7noOLYGow3bN7k7JtK3lLXA+9PJPjm/fipmt8Oj6yNtgNN0H0na6PYyoOu7UnCs3lpLU=;3:qEUrzxScFSjl5Xar7sUXNuuU+tOZbd77dX+eg82r2KuK51reG0D5LCTPGRVIRsfAvDqnWI2ttCQdcX9HRN/9nasdgQ5EjWZmTwdfWPoAR+x/zjUtxLdqfwhBByPt6udb3xT7EEwxSfWxLihKNHamHhR7+ZPujiLsImbT8uZ9GKwdcp9KBzWOl/lk/FfTlMCLDOpKB566ImC/JljJOmPDWLkIVpYnEQKJSTCtckuRErc=;25:RKTfI3V48kTfbWelC+r6LXERfFT7mbuyuR5IDgeuvzWB8ZXSdUk5vmBMEicC1AxDw9gM7yxhx3TR+fWLJZ7wtsRmIcj2lWgAMllfv10GdPpfCS+RckaFABmH4cOwcVocc5VPsEvFZulBwMW28tB8TyOfoAtTElcfg5nP16ji+8p+EF//oBh/ak5COqBCaCk3trT4xArtlo+XYToPYNyHFlNhEO1GKZsqQcRT9v/kl4ArIy71jzNI+92jub2ebEENdLnYhsTt0H2hsmqM5v33RQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1223; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1223;20:8SiDkvNYZCI/I1DdWhFna7SarumhDgnSuKo0oBA3z8RqxtX7VFbzmIdfJ6RVVLc4nM1+L3+o7z6uwmfqbVZYPJ3CgS90sXdKSuHHIC1mrsSrgOvdLX+OCpoKiyn/fcMQ/oW2ipvMWDZv559AhwWOmbGVt28l1WkTS00n3mboARWpJg7Dt+lV4uK3oHxn5CaOc7MPm4KXmeSm7sW9yJtNTC5PzLF7ESI/2xZwgludV4h4EzVXetzJKUOvmTtX73Dhlus/FuPDKuMFraNSDxYn6r9FSTeqIoEWed2evL5S1hDLsM76Wx0rDPOombbnYhqU42f+3EdjRgR0SRXtWm4jeWcIC6V8PdE/RMFGuY6M51o=;4:mPFudfHUN1v3/gOiHqInqIlgTgGhv/rJC0m0wlA47N0vicJboJENGMBiLR+2O1HTsN1bEseVKNIrGvQ7CV07CwcAL+niJ+b82c6ZHS54/bBAfanatl5PgHACkk0UAKjMEeYcHFBjMOYiBwdGmf7M+5Jy5Z/omlTrr6XhkC+1pdAHurP1iXH7EanK/bkIMA8pFTv/wo7SZ9185etGzk1DE8KrqKPU0SuMBcZU4cz5R0vmabOkvNX7LvHr4TvP1/Dt2TdpkPzvho39+hR/ltsh4DA07p0OTUlX31IRVTKHZ8ZfOqDAI/nXJ2DbdUThvuDvWSxoDdM0bwi8nb9F+0FFz+5WXxmwGdy7YIvIPrr6/Rwqz+QuflqEwyVFgQrn1YxR X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001)(10201501046);SRVR:BY1PR0301MB1223;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1223; X-Forefront-PRVS: 07562C22DA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY1PR0301MB1223;23:kea8/oDP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KnC?= =?us-ascii?Q?O32mDLEV+GsVBsNVBYNWndCfi/OsttTDvx2VTxLstW70XH/aXjTZyr7ANcTo?= =?us-ascii?Q?9/GxzdkFHB4/rAp59tATXO4/ryMTJ5WVNCarU/RdKTQlWInkwcP3DlMV2VAT?= =?us-ascii?Q?sNfnyJedqjqBcBJa35R1J+cDPyhFEH+sKXeVq5sS555tPkRsep6Ev2AOyQUp?= =?us-ascii?Q?t1QFzHDY=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1223;5:AG/HacT8p+W90jUGfCXCLWSGToEtJtF7gh6KXlRQIV3XtG6O2HzAuCarxhGfs/Ain4daY5szymGkWqTsltRfPoBC6yyUmNVwsMgqJhmThLPzrTSFwKvKiFmmjzFROFqmHPFr+OMVpklu9wRqLl64bw==;24:TtG9HLsTe9M2p3689eXRtirfx/ckLt7VryZLUVVTD53Pg6Wa+aeHiYLsXvbaItR6fvAfGA7wTLRCB4iYXRJqUGhp7jkbWSODLAEuIOCnDvI=;20:GMt3VXshl+t3ElaEM2gp+dMCGiWY8jYAGz3JZGHvnSeXyMoTtD0RSoTg8eVvg2JnFi3L55udsZinWAaskFsGyA== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2015 12:37:49.3437 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1223 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1863 Lines: 46 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 --- 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) { -- 1.8.3.2 -- 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/