From patchwork Wed Jan 21 05:01:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 5674921 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4482B9F358 for ; Wed, 21 Jan 2015 04:55:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5CEAD204E7 for ; Wed, 21 Jan 2015 04:55:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C765204A9 for ; Wed, 21 Jan 2015 04:55:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752455AbbAUEze (ORCPT ); Tue, 20 Jan 2015 23:55:34 -0500 Received: from mail-pd0-f175.google.com ([209.85.192.175]:42600 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751691AbbAUEze (ORCPT ); Tue, 20 Jan 2015 23:55:34 -0500 Received: by mail-pd0-f175.google.com with SMTP id fl12so14490311pdb.6 for ; Tue, 20 Jan 2015 20:55:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:subject; bh=966yRRxrPUKZANO7GbvbiaNQvC/eL4C2UfYkODr+ELs=; b=Co72XacLGBbBVBfSID2yZiLmFAHrLLU9Fs/qVSR3kuSDWgIAf2dVP+KsC/WcyV6o4/ PiVej2QCfsWfnS3n4Yy/NxsNJLK0W5luGQNGSOiaTr8WiGewuMiQN9Fk1qUV4SMVCpCD 97mADYXk2vDq+goWAUVTkE47EW1r8wCechzNjtJboZglAEZB1CWnjAeNRvC8jDFn4lvg o0Fpg8xuHIiaIBcf8/7ojhMgKcyev3eEt3a+qLdpUbKpq4lwXkfWvb0PX54kfwzQFYFm LK/KRnxqvP1xDT38xLxJmlyivNrQKEI1SjXCtyB5i3CdoBke9qjlh+ZXGjnNhU3rTtkf FtLQ== X-Received: by 10.66.163.228 with SMTP id yl4mr33368279pab.51.1421816133754; Tue, 20 Jan 2015 20:55:33 -0800 (PST) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by mx.google.com with ESMTPSA id ul5sm4781879pab.36.2015.01.20.20.55.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jan 2015 20:55:32 -0800 (PST) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , horms@verge.net.au, geert+renesas@glider.be Date: Wed, 21 Jan 2015 14:01:37 +0900 Message-Id: <20150121050137.8410.36127.sendpatchset@little-apple> Subject: [PATCH v2] ARM: shmobile: No R-Car Gen2 CMA reservation when HIGHMEM=n Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm Allow R-Car Gen2 platforms to boot with CMA enabled and HIGHMEM disabled. This patch adds code to check if the R-Car Gen2 specific memory reservation window is included in the kernel memory range or not. When HIGHMEM is disabled the R-Car Gen2 reservation area is outside the kernel memory range and in such case the memory reservation is simply skipped over. Without this patch the kernel boot hangs when CMA is enabled and HIGHMEM is disabled on the r8a7791 Koelsch hardware platform: WARNING: CPU: 1 PID: 1 at mm/cma.c:113 cma_init_reserved_areas+0x88/0x1d4() ... WARNING: CPU: 1 PID: 1 at mm/cma.c:121 cma_init_reserved_areas+0xf8/0x1d4() ... Unable to handle kernel NULL pointer dereference at virtual address 00000160 pgd = c0003000 [00000160] *pgd=80000040004003, *pmd=00000000 Internal error: Oops: 206 [#1] SMP ARM Modules linked in: CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 3.19.0-rc4-koelsch-01450-g7f9b6075ce12c3ea-dirty #735 Hardware name: Generic R8A7791 (Flattened Device Tree) task: edc553c0 ti: edc56000 task.ti: edc56000 PC is at set_pfnblock_flags_mask+0x54/0xa0 LR is at 0x440 In the current shmobile_defconfig HIGHMEM is enabled while CMA is disabled, so to trigger this the kernel configuration for both CMA and HIGHMEM needs to be adjusted. Signed-off-by: Magnus Damm Tested-by: Geert Uytterhoeven --- Changes since V1: - Included error log and Tested-by from Geert - thanks! Written on top of renesas-devel-20150114v2-v3.19-rc4 arch/arm/mach-shmobile/setup-rcar-gen2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/arch/arm/mach-shmobile/setup-rcar-gen2.c +++ work/arch/arm/mach-shmobile/setup-rcar-gen2.c 2015-01-15 14:20:47.089397114 +0900 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -197,7 +198,7 @@ void __init rcar_gen2_reserve(void) of_scan_flat_dt(rcar_gen2_scan_mem, &mrc); #ifdef CONFIG_DMA_CMA - if (mrc.size) + if (mrc.size && memblock_is_region_memory(mrc.base, mrc.size)) dma_contiguous_reserve_area(mrc.size, mrc.base, 0, &rcar_gen2_dma_contiguous, true); #endif